From: Andrew Gaffney Date: Sat, 19 Dec 2009 19:42:40 +0000 (-0600) Subject: Be verbose about why we're not considering certain built targets X-Git-Tag: CATALYST-2.0.10~3^2~71 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=53dfea1db039c1717a5b2364910171b8846e0e89;p=catalyst.git Be verbose about why we're not considering certain built targets --- diff --git a/ChangeLog b/ChangeLog index d873b956..d4eba248 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,10 @@ # Distributed under the GPL v2 # $Id$ + 19 Dec 2009; Andrew Gaffney + modules/catalyst/target/__init__.py: + Be verbose about why we're not considering certain built targets + 19 Dec 2009; Andrew Gaffney modules/catalyst/target/__init__.py: Use a regex to parse the built target filenames diff --git a/modules/catalyst/target/__init__.py b/modules/catalyst/target/__init__.py index 05334a90..ce8ed8f7 100644 --- a/modules/catalyst/target/__init__.py +++ b/modules/catalyst/target/__init__.py @@ -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,))