[game-data-packager] 04/04: Skip some of the more elaborate consistency checks when running a packaged version

Simon McVittie smcv at debian.org
Wed Jul 5 08:34:10 UTC 2017


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 10083aedc947fe0f31b20ece0c9bcf938fff7a62
Author: Simon McVittie <smcv at debian.org>
Date:   Wed Jul 5 09:33:14 2017 +0100

    Skip some of the more elaborate consistency checks when running a packaged version
---
 debian/changelog               | 3 +++
 game_data_packager/__init__.py | 6 +++++-
 tools/check_equivalence.py     | 8 +++++---
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index af0f339..dcaf1b6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,9 @@ game-data-packager (54) UNRELEASED; urgency=medium
       of them being included and the other being omitted. [smcv]
     - Add a consistency check to prevent the above happening again [smcv]
     - morrowind: Do not issue warnings about a modified Morrowind.ini [smcv]
+  * Internal changes:
+    - Skip some of the more elaborate consistency checks when running a
+      packaged version [smcv]
 
  -- Simon McVittie <smcv at debian.org>  Wed, 05 Jul 2017 08:31:13 +0100
 
diff --git a/game_data_packager/__init__.py b/game_data_packager/__init__.py
index 05ab7e0..721914b 100644
--- a/game_data_packager/__init__.py
+++ b/game_data_packager/__init__.py
@@ -594,7 +594,8 @@ class GameData(object):
                 current_group.apply_group_attributes(f)
                 current_group.group_members.add(f.name)
 
-    def load_file_data(self, use_vfs=USE_VFS):
+    def load_file_data(self, use_vfs=USE_VFS,
+            check=('GDP_UNINSTALLED' in os.environ)):
         if self.loaded_file_data:
             return
 
@@ -712,6 +713,9 @@ class GameData(object):
             if f.sha256 is not None:
                 self.known_sha256s.setdefault(f.sha256, set()).add(filename)
 
+        if not check:
+            return
+
         # check for different files that shares same md5 & look_for
         for file in self.known_md5s:
             if len(self.known_md5s[file]) == 1:
diff --git a/tools/check_equivalence.py b/tools/check_equivalence.py
index d45e57e..171907b 100755
--- a/tools/check_equivalence.py
+++ b/tools/check_equivalence.py
@@ -73,17 +73,19 @@ if __name__ == '__main__':
     for (name, game) in sorted(from_vfs.items()):
         print('# %s -----------------------------------------' % name)
 
-        game.load_file_data()
+        # Do this one without checking consistency, so that we can assert
+        # that skipping the consistency checks does not affect the outcome
+        game.load_file_data(check=False)
         ascii_safe(game.longname, force=True).encode('ascii')
         ascii_safe(game.help_text, force=True).encode('ascii')
         vfs_to_json = dump(game.to_data())
 
         json_game = from_json[name]
-        json_game.load_file_data()
+        json_game.load_file_data(check=True)
         json_to_json = dump(json_game.to_data())
 
         yaml_game = from_yaml[name]
-        yaml_game.load_file_data()
+        yaml_game.load_file_data(check=True)
         yaml_to_json = dump(yaml_game.to_data())
 
         if yaml_to_json != vfs_to_json:

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