[game-data-packager] 04/06: Add support for flagging files in YAML as known-but-unsuitable, and use it for older versions of various .wad files

Simon McVittie smcv at debian.org
Mon Jan 12 10:49:24 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 cd25e649d7c0bc025229afa50189c9a2be0ae375
Author: Simon McVittie <smcv at debian.org>
Date:   Mon Jan 12 10:10:52 2015 +0000

    Add support for flagging files in YAML as known-but-unsuitable, and use it for older versions of various .wad files
---
 data/doom.yaml                     | 24 ++++++++++++++--------
 data/doom2.yaml                    | 41 +++++++++++++++++++-------------------
 data/heretic.yaml                  |  6 +++---
 data/hexen.yaml                    | 14 ++++++-------
 debian/changelog                   |  2 ++
 lib/game_data_packager/__init__.py | 11 ++++++++++
 6 files changed, 60 insertions(+), 38 deletions(-)

diff --git a/data/doom.yaml b/data/doom.yaml
index 88c584c..6e750ad 100644
--- a/data/doom.yaml
+++ b/data/doom.yaml
@@ -83,45 +83,53 @@ files:
 
   # Older versions
   doom.wad_0.2:
-    distinctive_name: false
     size: 496250
     md5: 740901119ba2953e3c7f3764eca6e128
     sha1: 89d934616c57fe974b06c2b37a9837853a89dbbc
+    look_for: [doom1.wad]
+    unsuitable: Doom 1.9 or The Ultimate Doom is required
   doom.wad_0.4:
-    distinctive_name: false
     size: 2675669
     md5: b6afa12a8b22e2726a8ff5bd249223de
     sha1: 5f78b23fbffc828f5863ecff7e908d556241ff45
+    look_for: [doom1.wad]
+    unsuitable: Doom 1.9 or The Ultimate Doom is required
   doom.wad_0.5:
-    distinctive_name: false
     size: 3522207
     md5: 9c877480b8ef33b7074f1f0c07ed6487
     sha1: d3648d720b5324ce3c7bf58cf019e395911d677e
+    look_for: [doom1.wad]
+    unsuitable: Doom 1.9 or The Ultimate Doom is required
   doom.wad_beta:
-    distinctive_name: false
     size: 5468456
     md5: 049e32f18d9c9529630366cfc72726ea
     sha1: 692994db9579be4201730b9ac77797fae2111bde
+    look_for: [doom1.wad]
+    unsuitable: Doom 1.9 or The Ultimate Doom is required
   doom.wad_1.1:
-    distinctive_name: false
     size: 10396254
     md5: 981b03e6d1dc033301aa3095acc437ce
     sha1: df0040ccb29cc1622e74ceb3b7793a2304cca2c8
+    look_for: [doom1.wad]
+    unsuitable: Doom 1.9 or The Ultimate Doom is required
   doom.wad_1.2:
-    distinctive_name: false
     size: 10399316
     md5: 792fd1fea023d61210857089a7c1e351
     sha1: b5f86a559642a2b3bdfb8a75e91c8da97f057fe6
+    look_for: [doom1.wad]
+    unsuitable: Doom 1.9 or The Ultimate Doom is required
   doom.wad_1.666:
-    distinctive_name: false
     size: 11159840
     md5: 54978d12de87f162b9bcc011676cb3c0
     sha1: 2e89b86859acd9fc1e552f587b710751efcffa8e
+    look_for: [doom1.wad]
+    unsuitable: Doom 1.9 or The Ultimate Doom is required
   doom.wad_1.8:
-    distinctive_name: false
     size: 11159840
     md5: 11e1cd216801ea2657723abc86ecb01f
     sha1: 2c8212631b37f21ad06d18b5638c733a75e179ff
+    look_for: [doom1.wad]
+    unsuitable: Doom 1.9 or The Ultimate Doom is required
 
 ...
 # vim:set sw=2 sts=2 et:
diff --git a/data/doom2.yaml b/data/doom2.yaml
index df1266c..b5dfcc3 100644
--- a/data/doom2.yaml
+++ b/data/doom2.yaml
@@ -38,26 +38,6 @@ files:
   doom2.wad_bfg:
     size: 14691821
     look_for: [doom2.wad]
-  doom2.wad_1.666g:
-    size: 14824716
-    look_for: [doom2.wad]
-    distinctive_name: false
-  doom2.wad_1.666:
-    size: 14943400
-    look_for: [doom2.wad]
-    distinctive_name: false
-  doom2.wad_1.7:
-    size: 14612688
-    look_for: [doom2.wad]
-    distinctive_name: false
-  doom2.wad_1.7a:
-    size: 14612688
-    look_for: [doom2.wad]
-    distinctive_name: false
-  doom2.wad_1.8:
-    size: 14612688
-    look_for: [doom2.wad]
-    distinctive_name: false
   doom2.wad_xbox360_bfg:
     size: 14677988
     look_for: [doom2.wad]
@@ -74,6 +54,27 @@ files:
     size: 14639397
     look_for: [doom2.wad]
 
+  doom2.wad_1.666g:
+    size: 14824716
+    look_for: [doom2.wad]
+    unsuitable: Doom 2 v1.9 is required
+  doom2.wad_1.666:
+    size: 14943400
+    look_for: [doom2.wad]
+    unsuitable: Doom 2 v1.9 is required
+  doom2.wad_1.7:
+    size: 14612688
+    look_for: [doom2.wad]
+    unsuitable: Doom 2 v1.9 is required
+  doom2.wad_1.7a:
+    size: 14612688
+    look_for: [doom2.wad]
+    unsuitable: Doom 2 v1.9 is required
+  doom2.wad_1.8:
+    size: 14612688
+    look_for: [doom2.wad]
+    unsuitable: Doom 2 v1.9 is required
+
 md5sums: |
   25e1459ca71d321525f84628f45ca8cd  doom2.wad_1.9
   c3bea40570c23e511a7ed3ebcd9865f7  doom2.wad_bfg
diff --git a/data/heretic.yaml b/data/heretic.yaml
index e6e188d..4864c4d 100644
--- a/data/heretic.yaml
+++ b/data/heretic.yaml
@@ -58,23 +58,23 @@ files:
     look_for: [heretic.wad]
 
   heretic.wad_1.2:
-    distinctive_name: false
     size: 11095516
     look_for: [heretic.wad]
+    unsuitable: Heretic v1.3 is required
 
   heretic.wad_1.0:
-    distinctive_name: false
     size: 11096488
     look_for: [heretic.wad]
+    unsuitable: Heretic v1.3 is required
 
   heretic1.wad_1.2:
     size: 5120920
     look_for: [heretic1.wad]
 
   heretic1.wad_1.0:
-    distinctive_name: false
     size: 5120300
     look_for: [heretic1.wad]
+    unsuitable: Heretic shareware v1.2 is required
 
 md5sums: |
   420b23b3d8f2cbd164c121369eaa2b09  htic_v12.zip
diff --git a/data/hexen.yaml b/data/hexen.yaml
index 5e65294..c74e9aa 100644
--- a/data/hexen.yaml
+++ b/data/hexen.yaml
@@ -18,7 +18,7 @@ help_text: |
 
 # hexen-demo-data requires HEXEN.WAD from the Hexen demo v1.2, which
 # will be downloaded automatically if necessary. It will be renamed to
-# hexen-demo.wad to avoid colliding with the full version of Hexen.
+# hexendemo.wad to avoid colliding with the full version of Hexen.
 
 plugin: doom_common
 doom_engine: hexen
@@ -43,7 +43,7 @@ packages:
   #  install_to: usr/share/games/hexen
   #   type: demo
   #  install:
-  #  - hexen-demo.wad
+  #  - hexendemo.wad
 
 files:
 
@@ -56,19 +56,19 @@ files:
     - hexdd.wad_1.1
     - hexdd.wad_1.0
 
-  hexen-demo.wad:
+  hexendemo.wad:
     alternatives:
     - hexen.wad_demo_1.0
 
   hexen.wad_demo_1.0:
-    distinctive_name: false
     size: 10644136
     look_for: [hexen.wad]
+    unsuitable: Hexen 1.1 (registered) is required
 
   hexen.wad_demo_beta:
-    distinctive_name: false
     size:  10615976
     look_for: [hexen.wad]
+    unsuitable: Hexen 1.1 (registered) is required
 
   hexdd.wad_1.1:
     size: 4440584
@@ -83,14 +83,14 @@ files:
     look_for: [hexen.wad]
 
   hexen.wad_1.0:
-    distinctive_name: false
     size:  20128392
     look_for: [hexen.wad]
+    unsuitable: Hexen 1.1 (registered) is required
 
   hexen.wad_beta:
-    distinctive_name: false
     size: 20428208
     look_for: [hexen.wad]
+    unsuitable: Hexen 1.1 (registered) is required
 
   hexndemo.zip:
     download:
diff --git a/debian/changelog b/debian/changelog
index 089b740..157b268 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -36,6 +36,8 @@ game-data-packager (39) UNRELEASED; urgency=medium
   * Switch Doom packages' icons to .png, GNOME Shell doesn't like .xpm
   * Redo logic for files with alternatives to avoid unnecessary warnings
     (Closes: #775152)
+  * Add support for flagging files in YAML as known-but-unsuitable,
+    and use it for older versions of various .wad files
 
  -- Simon McVittie <smcv at debian.org>  Mon, 05 Jan 2015 19:38:04 +0000
 
diff --git a/lib/game_data_packager/__init__.py b/lib/game_data_packager/__init__.py
index 3bacd9a..68000d2 100644
--- a/lib/game_data_packager/__init__.py
+++ b/lib/game_data_packager/__init__.py
@@ -174,6 +174,7 @@ class WantedFile(HashedFile):
         self._provides = set()
         self._size = None
         self.unpack = None
+        self.unsuitable = None
 
     @property
     def look_for(self):
@@ -593,6 +594,7 @@ class GameData(object):
                     'size',
                     'skip_hash_matching',
                     'unpack',
+                    'unsuitable',
                     ):
                 if k in data:
                     setattr(f, k, data[k])
@@ -648,6 +650,12 @@ class GameData(object):
                     hashes.sha256)
             return False
 
+        if wanted.unsuitable:
+            logger.warning('"%s" matches known file "%s" but cannot '
+                    'be used:\n%s', path, wanted.name, wanted.unsuitable)
+            # ... but do not continue processing
+            return True
+
         logger.debug('... yes, looks good')
         self.found[wanted.name] = path
         return True
@@ -734,6 +742,9 @@ class GameData(object):
         args = (why, path, size, hashes.md5, hashes.sha1, hashes.sha256)
 
         for candidate in candidates:
+            if candidate.unsuitable:
+                continue
+
             message = message + ('  %s:\n' +
                     '    size:   ' + (
                         '%s' if candidate.size is None else '%d bytes') +

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