[game-data-packager] 02/07: Never try to unpack an archive more than once

Simon McVittie smcv at debian.org
Wed Oct 21 11:00:45 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 8359abd8c1e902a66c2702bce60da39f2ef772b4
Author: Simon McVittie <smcv at debian.org>
Date:   Wed Oct 21 08:23:40 2015 +0100

    Never try to unpack an archive more than once
---
 debian/changelog            |  1 +
 game_data_packager/build.py | 15 ++++++++++-----
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index a6d7294..f2c723e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -91,6 +91,7 @@ game-data-packager (43) UNRELEASED; urgency=medium
   * quake2: mark videos as optional (Closes: #800575)
   * Enable parallel build
   * Log external commands at debug level before we run them
+  * Never try to unpack an archive more than once
 
  -- Simon McVittie <smcv at debian.org>  Thu, 16 Jul 2015 09:59:23 +0200
 
diff --git a/game_data_packager/build.py b/game_data_packager/build.py
index 0914541..ad2c853 100644
--- a/game_data_packager/build.py
+++ b/game_data_packager/build.py
@@ -356,8 +356,8 @@ class PackagingTask(object):
         # Set of executables we wanted but don't have
         self.missing_tools = set()
 
-        # Set of filenames we couldn't unpack
-        self.unpack_failed = set()
+        # Set of filenames we couldn't unpack, or already unpacked
+        self.unpack_tried = set()
 
         # Block device from which to rip audio
         self.cd_device = None
@@ -977,12 +977,17 @@ class PackagingTask(object):
                     logger.debug('other part "%s" is %s' % (p, part_status))
                     provider_status &= part_status
 
-            if provider_status is FillResult.COMPLETE:
+            if provider_name in self.unpack_tried:
+                logger.debug('already tried unpacking provider %s',
+                        provider_name)
+            elif provider_status is FillResult.COMPLETE:
                 found_name = self.found[provider_name]
                 logger.debug('trying provider %s found at %s',
                         provider_name, found_name)
                 fmt = provider.unpack['format']
 
+                self.unpack_tried.add(provider_name)
+
                 if self.verbose and fmt in ('zip', 'unzip'):
                     with zipfile.ZipFile(found_name, 'r') as zf:
                         encoding = provider.unpack.get('encoding', 'cp437')
@@ -2366,7 +2371,7 @@ class PackagingTask(object):
         if not wanted.unpack:
             return True
 
-        if wanted.name in self.unpack_failed:
+        if wanted.name in self.unpack_tried:
             return False
 
         fmt = wanted.unpack['format']
@@ -2389,7 +2394,7 @@ class PackagingTask(object):
         logger.warning('cannot unpack "%s": tool "%s" is not ' +
                        'installed', wanted.name, fmt)
         self.missing_tools.add(fmt)
-        self.unpack_failed.add(wanted.name)
+        self.unpack_tried.add(wanted.name)
         return False
 
     def log_missing_tools(self):

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