[game-data-packager] 01/01: support mutually_exclusive for demo_for & better_version too

Alexandre Detiste detiste-guest at moszumanska.debian.org
Sat Nov 7 08:56:29 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 c931d099b29c914abf75c8eafc806466c3b5ba09
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date:   Sat Nov 7 09:55:23 2015 +0100

    support mutually_exclusive for demo_for & better_version too
    
    trim yaml files
---
 data/descent1.yaml             |  5 ++---
 data/descent2.yaml             |  1 -
 data/duke3d.yaml               |  5 +----
 data/hexen2.yaml               |  5 +----
 data/quake.yaml                |  7 +++----
 data/quake2.yaml               |  2 --
 data/quake4.yaml               |  6 ++++--
 data/theme-hospital.yaml       |  5 ++---
 doc/tags.txt                   |  1 +
 game_data_packager/__init__.py |  6 +++++-
 game_data_packager/build.py    | 12 ++++++++++++
 11 files changed, 31 insertions(+), 24 deletions(-)

diff --git a/data/descent1.yaml b/data/descent1.yaml
index a7b2e2a..a78b98c 100644
--- a/data/descent1.yaml
+++ b/data/descent1.yaml
@@ -8,8 +8,9 @@ genre: Flight simulator
 packages:
   descent1-demo-data:
     demo_for: descent1-data
+    mutually_exclusive: True
     debian:
-      conflicts: [descent1-full-data, descent1-data]
+      conflicts: descent1-full-data
     install_to: usr/share/games/d1x-rebirth/
     copyright_notice: |
       DESCENT is a trademark of Interplay Productions, Inc.
@@ -33,8 +34,6 @@ packages:
 
   descent1-data:
     debian:
-      conflicts: [descent1-full-data, descent1-demo-data]
-      provides: descent1-full-data
       replaces: descent1-full-data
     gog:
       # http://www.gog.com/game/${url}?pp=${pp}
diff --git a/data/descent2.yaml b/data/descent2.yaml
index 5b5fb6c..0feac9a 100644
--- a/data/descent2.yaml
+++ b/data/descent2.yaml
@@ -26,7 +26,6 @@ packages:
       id: 273580
       path: "common/Descent 2"
     debian:
-      conflicts: descent2-full-data
       provides: descent2-full-data
       replaces: descent2-full-data
     install_to: usr/share/games/d2x-rebirth
diff --git a/data/duke3d.yaml b/data/duke3d.yaml
index 4fe720b..72ddbd2 100644
--- a/data/duke3d.yaml
+++ b/data/duke3d.yaml
@@ -14,9 +14,8 @@ packages:
   duke3d-shareware:
     install_to: usr/share/games/eduke32
     demo_for: duke3d-data
+    mutually_exclusive: True
     version: '1.3d'
-    debian:
-      conflicts: duke3d-data
     install:
     - duke3d.grp?demo
     optional:
@@ -34,8 +33,6 @@ packages:
       # banner at http://eduke32.com/
       pp: 6c1e671f9af5b46d9c1a52067bdf0e53685674f7
     url_misc: https://3drealms.com/catalog/duke-nukem-3d_27/
-    debian:
-      replaces: duke3d-shareware
     install:
     - duke3d.grp
     optional:
diff --git a/data/hexen2.yaml b/data/hexen2.yaml
index 6a1509a..23fa0ee 100644
--- a/data/hexen2.yaml
+++ b/data/hexen2.yaml
@@ -22,8 +22,7 @@ help_text: |
 packages:
   hexen2-demo-data:
     demo_for: hexen2-data
-    debian:
-      conflicts: hexen2-data
+    mutually_exclusive: True
     install_to: usr/share/games/hexen2
     install:
     - data1/pak0.pak_demo
@@ -35,8 +34,6 @@ packages:
     steam:
       id: 9060
       path: "common/Hexen 2"
-    debian:
-      replaces: heretic2-demo-data
     install:
     - data1/pak0.pak
     - data1/pak1.pak
diff --git a/data/quake.yaml b/data/quake.yaml
index 04c3ae3..dcdf560 100644
--- a/data/quake.yaml
+++ b/data/quake.yaml
@@ -30,11 +30,11 @@ help_text: |
 packages:
   quake-shareware:
     demo_for: quake-registered
+    mutually_exclusive: True
     longname: Quake (shareware)
     component: non-free
     debian:
       provides: quake-data
-      conflicts: quake-registered
     install:
     - id1/pak0.pak?106
     license:
@@ -45,9 +45,8 @@ packages:
   quake-registered:
     debian:
       provides: quake-data
-      # when a replaces: is set,
-      # a conflicts: is implied too
-      replaces: quake-shareware
+      # "replaces: quake-shareware" is implied by 'mutually_exclusive:'
+      # & 'demo_for:' tags on 'quake-shareware'
     steam:
       id: 2310
       path: common/Quake
diff --git a/data/quake2.yaml b/data/quake2.yaml
index dec7a76..1f7852f 100644
--- a/data/quake2.yaml
+++ b/data/quake2.yaml
@@ -114,7 +114,6 @@ packages:
     debian:
       build-depends: [gcc, make, libc6-dev]
       provides: quake2-xatrix
-      conflicts: quake2-xatrix
       replaces: quake2-xatrix
     expansion_for: quake2-full-data
     # this is what Makefile says has been tested
@@ -167,7 +166,6 @@ packages:
     debian:
       build-depends: [gcc, make, libc6-dev]
       provides: quake2-rogue
-      conflicts: quake2-rogue
       replaces: quake2-rogue
     expansion_for: quake2-full-data
     # this is what Makefile says has been tested
diff --git a/data/quake4.yaml b/data/quake4.yaml
index 4cccfcd..16fe494 100644
--- a/data/quake4.yaml
+++ b/data/quake4.yaml
@@ -66,8 +66,11 @@ packages:
     longname: Quake 4
     debian:
       provides: quake4-any-data
-      conflicts: quake4-any-data
       replaces: quake4-any-data
+      #conflicts: quake4-any-data
+      # This is extraneous because the 'replaces' set
+      # is always added to the 'conflicts' set.
+      #   dep['conflicts'] |= dep['replaces']
     langs:
       - en
       - cs
@@ -97,7 +100,6 @@ packages:
     version: "1.4.2"
     debian:
       provides: quake4-any-data
-      conflicts: quake4-any-data
       replaces: quake4-any-data
     install_to: usr/share/games/quake4
     # this is not actually dubbed, just censored
diff --git a/data/theme-hospital.yaml b/data/theme-hospital.yaml
index a629bdf..58b90d7 100644
--- a/data/theme-hospital.yaml
+++ b/data/theme-hospital.yaml
@@ -26,8 +26,6 @@ packages:
   theme-hospital-data:
     langs: [en,da,de,es,fi,fr,it,nb,nl,pt,sv]
     debian:
-      conflicts: [theme-hospital-demo-data, theme-hospital-full-data]
-      provides: theme-hospital-full-data
       replaces: theme-hospital-full-data
     gog:
       url: theme_hospital
@@ -473,8 +471,9 @@ packages:
   theme-hospital-demo-data:
     install_to: usr/share/games/theme-hospital
     demo_for: theme-hospital-data
+    mutually_exclusive: True
     debian:
-      conflicts: [theme-hospital-data, theme-hospital-full-data]
+      conflicts: theme-hospital-full-data
     install:
     - anims/winlevel.smk?demo
     - data/award03v.dat
diff --git a/doc/tags.txt b/doc/tags.txt
index d7f201d..6297621 100644
--- a/doc/tags.txt
+++ b/doc/tags.txt
@@ -36,6 +36,7 @@ packages:
     expansion_for_ext: string
     lang: string
     provides: string
+    mutually_exclusive: bool
     debian:
       breaks:
       conflicts:
diff --git a/game_data_packager/__init__.py b/game_data_packager/__init__.py
index d6c00eb..5bf6bc1 100644
--- a/game_data_packager/__init__.py
+++ b/game_data_packager/__init__.py
@@ -199,6 +199,7 @@ class GameDataPackage(object):
         self.expansion_for = None
         # use this to group together dubs
         self.provides = None
+        # use this for games with demo_for/better_version/provides
         self.mutually_exclusive = False
         # expansion for a package outside of this yaml file;
         # may be another GDP package or a package not made by GDP
@@ -814,7 +815,7 @@ class GameData(object):
                 assert package.name not in v, \
                    "A package shouldn't extraneously %s itself" % k
 
-        if 'provides' in d or package.mutually_exclusive:
+        if 'provides' in d:
             assert type(package.provides) is str
             assert package.name != package.provides, \
                "A package shouldn't extraneously provide itself"
@@ -841,6 +842,9 @@ class GameData(object):
             if not package.longname and package.lang != 'en':
                 package.longname = self.longname + ' (%s)' % package.lang
 
+        if package.mutually_exclusive:
+            assert package.demo_for or package.better_version or package.provides
+
         if 'expansion_for' in d:
             if package.disks is None:
                 package.disks = 1
diff --git a/game_data_packager/build.py b/game_data_packager/build.py
index 4f84004..099cb18 100644
--- a/game_data_packager/build.py
+++ b/game_data_packager/build.py
@@ -1657,6 +1657,11 @@ class PackagingTask(object):
                       'recommends', 'replaces', 'suggests'):
             dep[field] = set(package.debian.get(field,[]))
 
+        if package.mutually_exclusive:
+            dep['conflicts'] |= package.demo_for
+            if package.better_version:
+                dep['conflicts'].add(package.better_version)
+
         if package.provides:
             dep['provides'].add(package.provides)
             if package.mutually_exclusive:
@@ -1680,9 +1685,16 @@ class PackagingTask(object):
             dep['recommends'].add(engine)
         elif not package.expansion_for and self.game.engine:
             dep['recommends'].add(engine)
+
+        # dependencies derived from *other* package's data
         for other_package in self.game.packages.values():
             if other_package.expansion_for == package.name:
                 dep['suggests'].add(other_package.name)
+            if other_package.mutually_exclusive:
+                if other_package.better_version == package.name:
+                    dep['replaces'].add(other_package.name)
+                if package.name in other_package.demo_for:
+                    dep['replaces'].add(other_package.name)
 
         # Shortcut: if A Replaces B, A automatically Conflicts B
         dep['conflicts'] |= dep['replaces']

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