[game-data-packager] 01/01: rework prepare_packages(): log unwanted packages earlier

Alexandre Detiste detiste-guest at moszumanska.debian.org
Fri Oct 9 12:36:52 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 32b21eb28fcbd05b063b91d415d4be970aa052ab
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date:   Fri Oct 9 14:34:28 2015 +0200

    rework prepare_packages(): log unwanted packages earlier
    
    make log more readable, also remove spurious warning
    about unwatend dubbed expansions.
---
 game_data_packager/build.py | 73 +++++++++++++++++++++++----------------------
 1 file changed, 37 insertions(+), 36 deletions(-)

diff --git a/game_data_packager/build.py b/game_data_packager/build.py
index c125376..5b40638 100644
--- a/game_data_packager/build.py
+++ b/game_data_packager/build.py
@@ -2077,20 +2077,42 @@ class PackagingTask(object):
         if not possible:
             raise NoPackagesPossible()
 
-        ready = set()
-        lgogdownloaded = set()
+        for package in set(possible):
+            score = max(set(lang_score(l) for l in package.langs))
+            if score == 0:
+                logger.info('will not produce "%s" '
+                            'because "%s" is not in LANGUAGE selection',
+                            package.name, package.lang)
+                possible.discard(package)
+                continue
+            # keep only prefered language for this virtual package
+            virtual = package.debian.get('provides')
+            if virtual:
+                for other_p in possible:
+                    if other_p.name == package.name:
+                        continue
+                    other_virtual = other_p.debian.get('provides')
+                    if other_virtual != virtual:
+                        continue
+                    if score < lang_score(other_p.lang):
+                        logger.info('will not produce "%s" '
+                                    'because "%s" is prefered language',
+                                    package.name, other_p.lang)
+                        possible.discard(package)
+                        break
+        if not possible:
+            raise NoPackagesPossible()
 
-        for package in possible:
+        for package in set(possible):
             if (package.better_version
                 and self.game.packages[package.better_version] in possible):
                   logger.info('will not produce "%s" because better version '
                      '"%s" is also available',
                      package.name,
                      package.better_version)
+                  possible.discard(package)
                   continue
 
-            abort = False
-
             if (package.expansion_for
               and self.game.packages[package.expansion_for] not in possible
               and not PACKAGE_CACHE.is_installed(package.expansion_for)):
@@ -2100,7 +2122,7 @@ class PackagingTask(object):
                           'full game "%s" is neither available nor already installed;'
                           ' and we are packaging "%s" instead.',
                           package.name, package.expansion_for, fullgame.name)
-                        abort = True
+                        possible.discard(package)
                         break
                 else:
                   logger.warning('will generate "%s" expansion, but full game '
@@ -2108,17 +2130,21 @@ class PackagingTask(object):
                      package.name, package.expansion_for)
 
             if not build_demos and package.demo_for:
-                for p in possible:
+                for p in set(possible):
                     if p.type == 'full':
                         # no point in packaging a demo if we have any full
                         # version
                         logger.info('will not produce "%s" because we have '
                             'the full version "%s"', package.name, p.name)
-                        abort = True
-                        break
-            if abort:
-                continue
+                        possible.discard(package)
+        if not possible:
+            raise NoPackagesPossible()
+
+        ready = set()
+        lgogdownloaded = set()
 
+        for package in possible:
+            abort = False
             for previous in ready:
                 if previous.debian.get('conflicts') == package.name:
                     logger.error('will not produce "%s" because it '
@@ -2127,31 +2153,6 @@ class PackagingTask(object):
             if abort:
                 continue
 
-            # keep only prefered language for this virtual package
-            virtual = package.debian.get('provides')
-            if virtual:
-                score = max(set(lang_score(l) for l in package.langs))
-                if score == 0:
-                    logger.info('will not produce "%s" '
-                                'because %s is not in LANGUAGE selection',
-                                package.name, package.lang)
-                    continue
-                for other_p in possible:
-                    if other_p.name == package.name:
-                        continue
-                    other_virtual = other_p.debian.get('provides')
-                    if other_virtual != virtual:
-                        continue
-                    other_score = lang_score(other_p.lang)
-                    if score < other_score:
-                        logger.info('will not produce "%s" '
-                                    'because %s is prefered language',
-                                     package.name, other_p.lang)
-                        abort = True
-                        break
-            if abort:
-                continue
-
             logger.debug('will produce %s', package.name)
             result = self.fill_gaps(package=package, download=download,
               log=package.name not in possible_with_lgogdownloader,

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