Be verbose about why we're not considering certain built targets
authorAndrew Gaffney <agaffney@gentoo.org>
Sat, 19 Dec 2009 19:42:40 +0000 (13:42 -0600)
committerAndrew Gaffney <agaffney@gentoo.org>
Sat, 19 Dec 2009 19:42:40 +0000 (13:42 -0600)
ChangeLog
modules/catalyst/target/__init__.py

index d873b956793e4af481efb0a9c3b3dba73d975c6d..d4eba2480ad1f4a119ed7136ffd584f4b274576d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,10 @@
 # Distributed under the GPL v2
 # $Id$
 
+  19 Dec 2009; Andrew Gaffney <agaffney@gentoo.org>
+  modules/catalyst/target/__init__.py:
+  Be verbose about why we're not considering certain built targets
+
   19 Dec 2009; Andrew Gaffney <agaffney@gentoo.org>
   modules/catalyst/target/__init__.py:
   Use a regex to parse the built target filenames
index 05334a90f98e26245aaee21e1c320733c3c88229..ce8ed8f7b5e382b81040946243c775a52781f80f 100644 (file)
@@ -5,8 +5,8 @@ Parent module of all target modules
 import os
 import re
 import catalyst.util
+import catalyst.output
 from catalyst.error import CatalystError
-from catalyst.output import warn
 
 def find_target_modules():
        search_dir = os.path.abspath(os.path.dirname(__file__))
@@ -19,7 +19,7 @@ def get_targets():
        for x in find_target_modules():
                target_modules[x] = catalyst.util.load_module("catalyst.target." + x)
                if target_modules[x] is None:
-                       warn("Cannot import catalyst.target." + x + ". This usually only " + \
+                       catalyst.output.warn("Cannot import catalyst.target." + x + ". This usually only " + \
                                "happens due to a syntax error, which should be reported as " \
                                "a bug.")
        return target_modules
@@ -37,7 +37,10 @@ def find_built_targets(build_dir):
        for root, dir, files in os.walk(build_dir):
                for file in files:
                        try:
-                               built_targets.append(built_target(root + '/' + file))
+                               foo = built_target(root + '/' + file)
+                               # We don't even want to consider files like .CONTENTS and .DIGESTS
+                               if foo.get_media_extra() is None:
+                                       built_targets.append(foo)
                        except:
                                catalyst.output.warn("Failed to parse '%s' as a built target" % (file,))
 
@@ -94,6 +97,8 @@ def build_target_buildplan():
                                        info['arch'] == target['info']['arch'] and info['rel_type'] == target['info']['rel_type']:
                                        targets[i]['parent'] = 'built'
                                        break
+                               else:
+                                       catalyst.output.warn("Not considering %s/%s-%s-%s.%s due to not matching arch, rel_type, version_stamp, or needed target type" % (info['rel_type'], info['target'], info['arch'], info['version_stamp'], info['media']))
 
                        for y in targets:
                                info = y['info']
@@ -173,7 +178,7 @@ class built_target(target):
                (rel_type, file) = filename.split('/')[-2:]
                self._rel_type = rel_type
 
-               matches = re.search(r'^([^-]+)-([^-]+)-(.+?)\.(tar\..+?)(?:\.(DIGESTS|CONTENTS))?$', file)
+               matches = re.search(r'^([^-]+)-([^-]+)-(.+?)\.(tar\..+?)(?:\.((?:DIGESTS|CONTENTS).*))?$', file)
                if matches is None:
                        raise CatalystError("The file '%s' cannot be parsed as a built target" % (filename,))