[game-data-packager] 13/21: support architecture-specific packages

Simon McVittie smcv at debian.org
Thu Jan 22 01:10:47 UTC 2015


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch master
in repository game-data-packager.

commit 69ddd5a70d696b730f05895370aeca15cca3f9ad
Author: Simon McVittie <smcv at debian.org>
Date:   Thu Jan 22 00:03:22 2015 +0000

    support architecture-specific packages
---
 lib/game_data_packager/__init__.py | 36 +++++++++++++++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/lib/game_data_packager/__init__.py b/lib/game_data_packager/__init__.py
index 2814b44..3d62997 100644
--- a/lib/game_data_packager/__init__.py
+++ b/lib/game_data_packager/__init__.py
@@ -361,6 +361,9 @@ class GameDataPackage(object):
         # CD audio stuff from YAML
         self.rip_cd = {}
 
+        # Debian architecture(s)
+        self.architecture = 'all'
+
     @property
     def install(self):
         return self._install
@@ -398,6 +401,7 @@ class GameDataPackage(object):
 
     def to_yaml(self):
         return {
+            'architecture': self.architecture,
             'demo_for': sorted(self.demo_for),
             'expansion_for': self.expansion_for,
             'install': sorted(self.install),
@@ -524,6 +528,9 @@ class GameData(object):
         # e.g. { 'quake-music': { 2: '/usr/.../id1/music/track02.ogg' } }
         self.cd_tracks = {}
 
+        # Debian architecture
+        self._architecture = None
+
         self._populate_files(self.yaml.get('files'))
 
         assert 'packages' in self.yaml
@@ -689,7 +696,7 @@ class GameData(object):
     def _populate_package(self, package, d):
         for k in ('expansion_for', 'longname', 'symlinks', 'install_to',
                 'install_to_docdir', 'install_contents_of', 'steam', 'debian',
-                'rip_cd'):
+                'rip_cd', 'architecture'):
             if k in d:
                 setattr(package, k, d[k])
 
@@ -1626,6 +1633,10 @@ class GameData(object):
         for field in default_values:
             if field not in control:
                 control[field] = default_values[field]
+
+        if package.architecture != 'all':
+            control['Architecture'] = self.get_architecture()
+
         if control['Architecture'] == 'all' and 'Multi-Arch' not in control:
             control['Multi-Arch'] = 'foreign'
 
@@ -1907,6 +1918,13 @@ class GameData(object):
                     package.name)
             raise CDRipFailed()
 
+    def get_architecture(self):
+        if self._architecture is None:
+            self._architecture = subprocess.check_output(['dpkg-architecture',
+                '-qDEB_BUILD_ARCH']).strip().decode('ascii')
+
+        return self._architecture
+
     def prepare_packages(self, packages, build_demos=False, download=True,
             log_immediately=True):
         possible = set()
@@ -1968,7 +1986,23 @@ class GameData(object):
                 else:
                     raise NoPackagesPossible()
 
+        # copy the set so we can alter the original while iterating
+        for package in set(possible):
+            if package.architecture == 'all':
+                continue
+            elif package.architecture == 'any':
+                # we'll need this later, cache it
+                self.get_architecture()
+            else:
+                archs = package.architecture.split()
+                if self.get_architecture() not in archs:
+                    logger.warning('cannot produce "%s" on architecture %s',
+                            package.name, self.get_architecture())
+                    possible.discard(package)
+
         logger.debug('possible packages: %r', possible)
+        if not possible:
+            raise NoPackagesPossible()
 
         ready = set()
 

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