[game-data-packager] 10/12: Merge distribution-specific package dependencies instead of overwriting

Simon McVittie smcv at debian.org
Wed Jan 6 12:47:00 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 652ba05e704b7812c5684c7af2031551e2bd7919
Author: Simon McVittie <smcv at debian.org>
Date:   Wed Jan 6 12:27:00 2016 +0000

    Merge distribution-specific package dependencies instead of overwriting
---
 data/wip/unreal.yaml           | 28 +++++++++++-----------------
 game_data_packager/__init__.py |  2 +-
 game_data_packager/build.py    | 22 ++++++++++++++++++++--
 3 files changed, 32 insertions(+), 20 deletions(-)

diff --git a/data/wip/unreal.yaml b/data/wip/unreal.yaml
index 1dca4fb..29663e6 100644
--- a/data/wip/unreal.yaml
+++ b/data/wip/unreal.yaml
@@ -221,6 +221,12 @@ packages:
       url: unreal_gold
     architecture: i386
     install_to: usr/lib/unreal-gold
+    depends:
+      - unreal-data
+      - unreal-gold-data
+      - unreal-launcher-dependencies
+      - unreal-libfmod
+      - unreal-libmikmod2
     debian:
       depends:
         - libalut0
@@ -229,11 +235,6 @@ packages:
         - libopenal1
         - libsdl1.2debian
         - libstdc++6
-        - unreal-data
-        - unreal-gold-data
-        - unreal-launcher-dependencies
-        - unreal-libfmod
-        - unreal-libmikmod2
       suggests:
         # required by UnrealXLinux.bin which is not the default
         - libxxf86dga1
@@ -245,11 +246,6 @@ packages:
         - libopenal.so.1
         - libSDL-1.2.so.0
         - libstdc++.so.6
-        - unreal-data
-        - unreal-gold-data
-        - unreal-launcher-dependencies
-        - unreal-libfmod
-        - unreal-libmikmod2
       suggests:
         - libXxf86dga.so.1
     install:
@@ -308,6 +304,11 @@ packages:
     data_type: binaries
     install_to: usr/lib/unreal-classic
     architecture: i386
+    depends:
+      - unreal-data
+      - unreal-launcher-dependencies
+      - unreal-libfmod
+      - unreal-libmikmod2
     debian:
       depends:
         - libalut0
@@ -316,10 +317,6 @@ packages:
         - libopenal1
         - libsdl1.2debian
         - libstdc++6
-        - unreal-data
-        - unreal-launcher-dependencies
-        - unreal-libfmod
-        - unreal-libmikmod2
       suggests:
         # required by UnrealXLinux.bin which is not the default
         - libxxf86dga1
@@ -331,9 +328,6 @@ packages:
         - libopenal.so.1
         - libSDL-1.2.so.0
         - libstdc++.so.6
-        - unreal-data
-        - unreal-libfmod
-        - unreal-libmikmod2
       suggests:
         - libXxf86dga.so.1
     install:
diff --git a/game_data_packager/__init__.py b/game_data_packager/__init__.py
index 185deff..7989963 100644
--- a/game_data_packager/__init__.py
+++ b/game_data_packager/__init__.py
@@ -833,7 +833,7 @@ class GameData(object):
             # 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'):
+                for k in ('engine', 'install_to', 'description', 'provides'):
                     if k in d[port]:
                         setattr(package, k, d[port][k])
 
diff --git a/game_data_packager/build.py b/game_data_packager/build.py
index 8428f4b..db355cf 100644
--- a/game_data_packager/build.py
+++ b/game_data_packager/build.py
@@ -1460,6 +1460,22 @@ class PackagingTask(object):
                  '--options=!all,use-set,type,uid,gid,mode,time,size,md5,sha256,link']
                  + sorted(files), env={'LANG':'C'}, cwd=destdir)
 
+    def __merge_relationships(self, package, related, key):
+        # copy it so we don't modify it in-place
+        related = set(related)
+
+        if FORMAT in package.specifics:
+            related |= set(package.specifics[FORMAT].get(key, ()))
+
+        if FORMAT == 'deb' and 'debian' in package.specifics:
+            # we treat "debian" as "any dpkg-based" for historical reasons
+            related |= set(package.specifics['debian'].get(key, ()))
+
+        if DISTRO in package.specifics:
+            related |= set(package.specifics[DISTRO].get(key, ()))
+
+        return related
+
     def fill_dest_dir_rpm(self, package, destdir, compress):
         specfile = os.path.join(self.get_workdir(), '%s.spec' % package.name)
         short_desc, long_desc = self.generate_description(package)
@@ -1521,7 +1537,8 @@ class PackagingTask(object):
                 engine = package.engine or self.game.engine
                 if engine and len(engine.split()) == 1:
                     spec.write('Requires: %s\n' % engine)
-            for p in package.depends:
+            for p in self.__merge_relationships(package, package.depends,
+                    'depends'):
                 spec.write('Requires: %s\n' % p)
             if not compress or not self.compress_deb or package.rip_cd:
                 spec.write('%define _binary_payload w0.gzdio\n')
@@ -1732,7 +1749,8 @@ class PackagingTask(object):
                       'recommends', 'replaces', 'suggests'):
             dep[field] = set(debian.get(field,[]))
 
-        dep['depends'] = package.depends
+        dep['depends'] = self.__merge_relationships(package, package.depends,
+                'depends')
 
         if package.mutually_exclusive:
             dep['conflicts'] |= package.demo_for

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