[game-data-packager] 01/01: fedora: implement build_rpm()
Alexandre Detiste
detiste-guest at moszumanska.debian.org
Mon Nov 2 11:36:43 UTC 2015
This is an automated email from the git hooks/post-receive script.
detiste-guest pushed a commit to branch master
in repository game-data-packager.
commit 836c6e935e36ae0f4edf9f0da49d672b0effabd7
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date: Mon Nov 2 12:36:15 2015 +0100
fedora: implement build_rpm()
---
game_data_packager/build.py | 34 +++++++++++++++++++++++++++++-----
game_data_packager/util_rpm.py | 2 +-
2 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/game_data_packager/build.py b/game_data_packager/build.py
index 7a72106..c01031e 100644
--- a/game_data_packager/build.py
+++ b/game_data_packager/build.py
@@ -2300,17 +2300,20 @@ class PackagingTask(object):
return ready
def build_packages(self, ready, destination, compress):
- debs = set()
+ packages = set()
for package in ready:
- deb = self.build_deb(package, destination, compress=compress)
+ if FORMAT == 'deb':
+ pkg = self.build_deb(package, destination, compress=compress)
+ elif FORMAT == 'rpm':
+ pkg = self.build_rpm(package)
- if deb is None:
+ if pkg is None:
raise SystemExit(1)
- debs.add(deb)
+ packages.add(pkg)
- return debs
+ return packages
def locate_steam_icon(self, package):
id = package.steam.get('id') or self.game.steam.get('id')
@@ -2477,6 +2480,27 @@ class PackagingTask(object):
rm_rf(destdir)
return outfile
+ def build_rpm(self, package):
+ destdir = os.path.join(self.get_workdir(), '%s.deb.d' % package.name)
+
+ if not self.fill_dest_dir(package, destdir):
+ return None
+
+ assert os.path.isdir(os.path.join(destdir, 'usr')), destdir
+
+ try:
+ logger.info('generating package %s', package.name)
+ specfile = os.path.join(self.get_workdir(), '%s.spec' % package.name)
+ check_output(['rpmbuild', '--buildroot', destdir,
+ '-bb', '-v', specfile],
+ cwd=self.get_workdir())
+ except subprocess.CalledProcessError as cpe:
+ print(cpe.output)
+ raise
+
+ return (os.path.expanduser('~/rpmbuild/RPMS/noarch/')
+ + package.name + '-' + package.version + '-0.noarch.rpm')
+
def check_unpacker(self, wanted):
if not wanted.unpack:
return True
diff --git a/game_data_packager/util_rpm.py b/game_data_packager/util_rpm.py
index 6c2becb..5974889 100644
--- a/game_data_packager/util_rpm.py
+++ b/game_data_packager/util_rpm.py
@@ -61,4 +61,4 @@ PACKAGE_CACHE = PackageCache()
def install_packages(debs, method, gain_root='su'):
"""Install one or more packages (a list of filenames)."""
- run_as_root(['rpm', '-ivh'] + list(debs), gain_root)
+ run_as_root(['dnf', 'install'] + list(debs), gain_root)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/game-data-packager.git
More information about the Pkg-games-commits
mailing list