[game-data-packager] 07/08: Add support for installing an alternative under its own name

Simon McVittie smcv at debian.org
Thu Jan 15 09:40:16 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 71ca55ca7db3f5ed5e1b29930ba0131fc00ff9d4
Author: Simon McVittie <smcv at debian.org>
Date:   Thu Jan 15 09:32:23 2015 +0000

    Add support for installing an alternative under its own name
    
    Use it to add support for the CD or site-license versions of ROTT *.RTC.
---
 data/rott.yaml                     | 62 +++++++++++++++++++++++++-------------
 lib/game_data_packager/__init__.py |  6 ++--
 2 files changed, 45 insertions(+), 23 deletions(-)

diff --git a/data/rott.yaml b/data/rott.yaml
index 32a87e9..e49c442 100644
--- a/data/rott.yaml
+++ b/data/rott.yaml
@@ -15,16 +15,16 @@ packages:
     # this shareware data are considered a as full game because
     # it includes the HUNT Begin levels not present in the commercial game
 
-    install_files_from_cksums: |
-      742977862  27028   DEMO1_3.DMO
-      2546107232 34360   DEMO2_3.DMO
-      1805302629 47704   DEMO3_3.DMO
-      1175016822 36412   DEMO4_3.DMO
-      2739574572 54258   HUNTBGIN.RTC
-      2540183019 103316  HUNTBGIN.RTL
-      498832626  6436871 HUNTBGIN.WAD
-      3228256652 110484  REMOTE1.RTS
-      4153237746 7752    VENDOR.DOC
+    install:
+    - DEMO1_3.DMO
+    - DEMO2_3.DMO
+    - DEMO3_3.DMO
+    - DEMO4_3.DMO
+    - HUNTBGIN.RTC
+    - HUNTBGIN.RTL
+    - HUNTBGIN.WAD
+    - REMOTE1.RTS
+    - VENDOR.DOC
     symlinks:
       usr/share/doc/rott-data/VENDOR.DOC:
         usr/share/games/rott/VENDOR.DOC
@@ -33,11 +33,11 @@ packages:
     type: full
     longname: "Rise of the Triad: Dark War"
     install_to: usr/share/games/rott
-    install_files_from_cksums: |
-      2270167158 162646   DARKWAR.RTC
-      2187295173 408096   DARKWAR.RTL
-      3057779008 14610149 DARKWAR.WAD
-      2680866599 2628     LICENSE.TXT
+    install:
+    - any_registered_rtc
+    - DARKWAR.RTL
+    - DARKWAR.WAD
+    - LICENSE.TXT
     symlinks:
       usr/share/doc/rott-registered-data/LICENSE.TXT:
         usr/share/games/rott/LICENSE.TXT
@@ -53,6 +53,13 @@ packages:
         usr/share/games/rott/LICENSE.TXT
 
 files:
+  any_registered_rtc:
+    alternatives:
+    - ROTTCD.RTC
+    - ROTTSITE.RTC
+    - DARKWAR.RTC
+    install_as: $alternative
+
   1rott13.zip:
     size: 3668139
     download:
@@ -87,12 +94,25 @@ files:
       format: zip
 
 cksums: |
-  1102508826 12548  DEMO1_3.DMO_darkwar
-  2113068632 17468  DEMO2_3.DMO_darkwar
-  1131557042 28508  DEMO3_3.DMO_darkwar
-  530889864  29612  DEMO4_3.DMO_darkwar
-  163316606  207174 ROTTCD.RTC
-  1168858976 296840 ROTTSITE.RTC
+  2270167158 162646   DARKWAR.RTC
+  2187295173 408096   DARKWAR.RTL
+  3057779008 14610149 DARKWAR.WAD
+  742977862  27028    DEMO1_3.DMO
+  1102508826 12548    DEMO1_3.DMO_darkwar
+  2546107232 34360    DEMO2_3.DMO
+  2113068632 17468    DEMO2_3.DMO_darkwar
+  1805302629 47704    DEMO3_3.DMO
+  1131557042 28508    DEMO3_3.DMO_darkwar
+  1175016822 36412    DEMO4_3.DMO
+  530889864  29612    DEMO4_3.DMO_darkwar
+  2739574572 54258    HUNTBGIN.RTC
+  2540183019 103316   HUNTBGIN.RTL
+  498832626  6436871  HUNTBGIN.WAD
+  2680866599 2628     LICENSE.TXT
+  3228256652 110484   REMOTE1.RTS
+  163316606  207174   ROTTCD.RTC
+  1168858976 296840   ROTTSITE.RTC
+  4153237746 7752     VENDOR.DOC
 
 md5sums: |
   001a2aafefe4f5394655f735ee60c326  DEMO1_3.DMO
diff --git a/lib/game_data_packager/__init__.py b/lib/game_data_packager/__init__.py
index 0b2e476..5a972eb 100644
--- a/lib/game_data_packager/__init__.py
+++ b/lib/game_data_packager/__init__.py
@@ -1310,6 +1310,7 @@ class GameData(object):
 
         for filename in package.install:
             wanted = self.files[filename]
+            install_as = wanted.install_as
 
             if filename in self.found:
                 copy_from = self.found[filename]
@@ -1317,6 +1318,8 @@ class GameData(object):
                 for alt in wanted.alternatives:
                     if alt in self.found:
                         copy_from = self.found[alt]
+                        if wanted.install_as == '$alternative':
+                            install_as = self.files[alt].install_as
                         break
                 else:
                     raise AssertionError('we already checked that %s exists' %
@@ -1339,8 +1342,7 @@ class GameData(object):
                     if wanted.name.startswith(prefix + '/'):
                         install_to = 'usr/share/doc/%s' % package.name
 
-                copy_to = os.path.join(destdir, install_to,
-                        wanted.install_as)
+                copy_to = os.path.join(destdir, install_to, install_as)
                 copy_to_dir = os.path.dirname(copy_to)
                 logger.debug('Copying to %s', copy_to)
                 if not os.path.isdir(copy_to_dir):

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