[game-data-packager] 01/01: check that needed tools (bsdtar/rpmbuild) are present when cross-building

Alexandre Detiste detiste-guest at moszumanska.debian.org
Wed Mar 15 10:29:26 UTC 2017


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 2e37e973d3dd89a3ba6c93bfa75854d855c3eef4
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date:   Wed Mar 15 11:28:34 2017 +0100

    check that needed tools (bsdtar/rpmbuild) are present when cross-building
---
 debian/changelog                         | 2 ++
 game_data_packager/build.py              | 7 +++++++
 game_data_packager/packaging/__init__.py | 3 +++
 game_data_packager/packaging/arch.py     | 1 +
 game_data_packager/packaging/deb.py      | 1 +
 game_data_packager/packaging/rpm.py      | 1 +
 6 files changed, 15 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 2c74cc0..c16e569 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,8 @@ game-data-packager (50) UNRELEASED; urgency=medium
     - Refresh French translation of man page [adetiste]
     - XCom-UFO: fix swapped file definitions,
                 add GOG url. (Closes: #856253) [R1dO]
+    - Ensure that bsdtar/rpmbuild are present
+      before attempting to build Arch/RPM packages [adetiste]
 
  -- Simon McVittie <smcv at debian.org>  Thu, 22 Dec 2016 16:43:05 +0000
 
diff --git a/game_data_packager/build.py b/game_data_packager/build.py
index 9b552a0..7a8bae8 100644
--- a/game_data_packager/build.py
+++ b/game_data_packager/build.py
@@ -1556,6 +1556,13 @@ class PackagingTask(object):
                 raise SystemExit('Must specify a destination when '
                         'building packages for a different packaging '
                         'system')
+            for tool in self.packaging.BUILD_DEP:
+                if not which(tool):
+                    logger.error('tool "%s" is needed to cross-build packages', tool)
+                    self.missing_tools.add(tool)
+            if self.missing_tools:
+                self.log_missing_tools()
+                raise SystemExit(1)
 
         if getattr(args, 'compress', None) is None:
             # default to not compressing if we aren't going to install it
diff --git a/game_data_packager/packaging/__init__.py b/game_data_packager/packaging/__init__.py
index 87fa202..242989f 100644
--- a/game_data_packager/packaging/__init__.py
+++ b/game_data_packager/packaging/__init__.py
@@ -36,6 +36,9 @@ class PackagingSystem(metaclass=ABCMeta):
     CHECK_CMD = None
     INSTALL_CMD = None
 
+    # Generic tools needed to build packages
+    BUILD_DEP = {}
+
     # Exceptions to our normal heuristic for mapping a tool to a package:
     # the executable tool 'unzip' is in the unzip package, etc.
     #
diff --git a/game_data_packager/packaging/arch.py b/game_data_packager/packaging/arch.py
index 283e3ab..c94da92 100644
--- a/game_data_packager/packaging/arch.py
+++ b/game_data_packager/packaging/arch.py
@@ -35,6 +35,7 @@ class ArchPackaging(PackagingSystem):
     LICENSEDIR = '$datadir/licenses'
     CHECK_CMD = 'namcap'
     INSTALL_CMD = ['pacman', '-S']
+    BUILD_DEP = {'bsdtar'}
     PACKAGE_MAP = {
                   'id-shr-extract': None,
                   '7z': 'p7zip',
diff --git a/game_data_packager/packaging/deb.py b/game_data_packager/packaging/deb.py
index a1cbb2c..6f662c9 100644
--- a/game_data_packager/packaging/deb.py
+++ b/game_data_packager/packaging/deb.py
@@ -46,6 +46,7 @@ class DebPackaging(PackagingSystem):
     ASSETS = '$datadir/games'
     CHECK_CMD = 'lintian'
     INSTALL_CMD = ['apt-get', 'install']
+    BUILD_DEP = {'dpkg', 'fakeroot'}
     PACKAGE_MAP = {
                   'id-shr-extract': 'dynamite',
                   'lha': 'lhasa',
diff --git a/game_data_packager/packaging/rpm.py b/game_data_packager/packaging/rpm.py
index 45bdddb..4f39e6c 100644
--- a/game_data_packager/packaging/rpm.py
+++ b/game_data_packager/packaging/rpm.py
@@ -34,6 +34,7 @@ logger = logging.getLogger(__name__)
 class RpmPackaging(PackagingSystem):
     INSTALL_CMD = ['rpm', '-U']
     CHECK_CMD = 'rpmlint'
+    BUILD_DEP = {'rpmbuild'}
     ARCH_DECODE = {
                   'all': 'noarch',
                   'i386': 'i686',

-- 
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