[game-data-packager] 09/12: Generalize package.debian to a map, package.specifics

Simon McVittie smcv at debian.org
Wed Jan 6 12:46:59 UTC 2016


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 a9e1fae23a61c004229cba60358bcaea07fc93aa
Author: Simon McVittie <smcv at debian.org>
Date:   Wed Jan 6 12:23:34 2016 +0000

    Generalize package.debian to a map, package.specifics
---
 game_data_packager/__init__.py | 44 +++++++++++++++++++++++++-----------------
 game_data_packager/build.py    |  8 +++++---
 2 files changed, 31 insertions(+), 21 deletions(-)

diff --git a/game_data_packager/__init__.py b/game_data_packager/__init__.py
index 4b4d496..185deff 100644
--- a/game_data_packager/__init__.py
+++ b/game_data_packager/__init__.py
@@ -270,8 +270,8 @@ class GameDataPackage(object):
         # expansion's dedicated Wiki page, appended to GameData.wikibase
         self.wiki = None
 
-        # depedency information needed to build the debian/control file
-        self.debian = {}
+        # format- and distribution-specific overrides
+        self.specifics = {}
 
         # set of names of WantedFile instances to be installed
         self._install = set()
@@ -394,12 +394,12 @@ class GameDataPackage(object):
 
         for k in (
                 'aliases',
-                'debian',
                 'demo_for',
                 'dotemu',
                 'gog',
                 'origin',
                 'rip_cd',
+                'specifics',
                 'steam',
                 'symlinks',
                 ):
@@ -809,7 +809,7 @@ class GameData(object):
 
     def _populate_package(self, package, d):
         for k in ('expansion_for', 'expansion_for_ext', 'longname', 'symlinks', 'install_to',
-                'install_contents_of', 'debian', 'description', 'depends',
+                'install_contents_of', 'description', 'depends',
                 'rip_cd', 'architecture', 'aliases', 'better_version', 'langs', 'mutually_exclusive',
                 'copyright', 'engine', 'lang', 'component', 'section', 'disks', 'provides',
                 'steam', 'gog', 'dotemu', 'origin', 'url_misc', 'wiki', 'copyright_notice',
@@ -817,19 +817,26 @@ class GameData(object):
             if k in d:
                 setattr(package, k, d[k])
 
-        for port in ('debian', 'rpm'):
-            if port in d and (FORMAT == port or
+        for port in (
+                # packaging formats (we treat "debian" as "any dpkg-based"
+                # for historical reasons)
+                'debian', 'rpm',
+                # specific distributions
+                'arch', 'fedora', 'suse',
+                ):
+            if port in d:
+                package.specifics[port] = d[port]
+
+            # FIXME: this object's contents should be 1:1 mapped from the
+            # YAML, and not format- or distribution-specific.
+            # Distribution-specific stuff should be done in the PackagingTask
+            # or PackagingSystem
+            if port in d and (FORMAT == port or DISTRO == port or
                     (FORMAT == 'deb' and port == 'debian')):
                 for k in ('engine', 'install_to', 'description', 'depends', 'provides'):
                     if k in d[port]:
                         setattr(package, k, d[port][k])
 
-        for port in ('arch', 'fedora', 'suse'):
-            if DISTRO == port and port in d:
-                for k in ('engine', 'install_to', 'description', 'depends', 'provides'):
-                    if k in d[port]:
-                        setattr(package, k, d[port][k])
-
         # Fedora doesn't handle alternatives, everything must be handled with
         # virtual packages
         if FORMAT == 'rpm':
@@ -844,15 +851,16 @@ class GameData(object):
         assert type(package.mutually_exclusive) is bool
 
         if 'debian' in d:
-            assert type(package.debian) is dict
-            for k, v in package.debian.items():
+            debian = d['debian']
+            assert type(debian) is dict
+            for k, v in debian.items():
                 assert k in ('breaks', 'conflicts', 'depends', 'provides',
                              'recommends', 'replaces', 'suggests',
-                             'build-depends'), (package.name, package.debian)
-                assert type(v) in (str, list), (package.name, package.debian)
+                             'build-depends'), (package.name, debian)
+                assert type(v) in (str, list), (package.name, debian)
                 if type(v) == str:
-                    assert ',' not in v, (package.name, package.debian)
-                    package.debian[k] = list([v])
+                    assert ',' not in v, (package.name, debian)
+                    package.specifics['debian'][k] = [v]
                 assert package.name not in v, \
                    "A package shouldn't extraneously %s itself" % k
 
diff --git a/game_data_packager/build.py b/game_data_packager/build.py
index fa57e46..8428f4b 100644
--- a/game_data_packager/build.py
+++ b/game_data_packager/build.py
@@ -1727,9 +1727,10 @@ class PackagingTask(object):
             control['Architecture'] = self.packaging.get_architecture(package.architecture)
 
         dep = dict()
+        debian = package.specifics.get('debian', {})
         for field in ('breaks', 'conflicts', 'provides',
                       'recommends', 'replaces', 'suggests'):
-            dep[field] = set(package.debian.get(field,[]))
+            dep[field] = set(debian.get(field,[]))
 
         dep['depends'] = package.depends
 
@@ -2242,8 +2243,9 @@ class PackagingTask(object):
                     possible.discard(package)
 
         for package in set(possible):
-            if 'build-depends' in package.debian:
-                for tool in package.debian['build-depends']:
+            debian = package.specifics.get('debian', {})
+            if 'build-depends' in debian:
+                for tool in debian['build-depends']:
                     tool = tool.strip()
                     if not which(tool) and not self.packaging.is_installed(tool):
                         logger.error('package "%s" is needed to build "%s"' %

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