diff options
author | Zac Medico <zmedico@gentoo.org> | 2010-08-26 12:46:35 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-08-26 12:46:35 -0700 |
commit | 9d71e68de000d94ac627e40a7e53e77d6e53ac9a (patch) | |
tree | f1138375a8ed997489e2ebbf12665f5d4eebb832 | |
parent | 2efd2a76cc9a954e43651d616c273c573e5a95ac (diff) | |
download | portage-9d71e68de000d94ac627e40a7e53e77d6e53ac9a.tar.gz portage-9d71e68de000d94ac627e40a7e53e77d6e53ac9a.tar.bz2 portage-9d71e68de000d94ac627e40a7e53e77d6e53ac9a.zip |
Fix up error handling for egencache --update-use-local-desc.
-rwxr-xr-x | bin/egencache | 13 | ||||
-rw-r--r-- | pym/repoman/utilities.py | 8 |
2 files changed, 16 insertions, 5 deletions
diff --git a/bin/egencache b/bin/egencache index 4bfb5be8f..515c6566d 100755 --- a/bin/egencache +++ b/bin/egencache @@ -347,9 +347,16 @@ class GenUseLocalDesc(object): level=logging.ERROR, noiselevel=-1) self.returncode |= 1 else: - usedict = parse_metadata_use(metadata) - for flag in sorted(usedict.keys()): - output.write('%s:%s - %s\n' % (cp, flag, usedict[flag])) + try: + usedict = parse_metadata_use(metadata) + except portage.exception.ParseError as e: + writemsg_level( + "ERROR: failed parsing %s/metadata.xml: %s\n" % (cp, e), + level=logging.ERROR, noiselevel=-1) + self.returncode |= 1 + else: + for flag in sorted(usedict.keys()): + output.write('%s:%s - %s\n' % (cp, flag, usedict[flag])) output.close() diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py index ed0de4449..b2d17fc9a 100644 --- a/pym/repoman/utilities.py +++ b/pym/repoman/utilities.py @@ -131,11 +131,15 @@ def parse_metadata_use(xml_tree): for flag in flags: pkg_flag = flag.get("name") - pkg_flag_value = whitespace_re.sub(' ', flag.text).strip() if pkg_flag is None: raise exception.ParseError("missing 'name' attribute for 'flag' tag") + if flag.text is None: + raise exception.ParseError("missing USE description with " + \ + "the 'flag' tag (name=%s)" % pkg_flag) + pkg_flag_value = whitespace_re.sub(' ', flag.text).strip() if not pkg_flag_value: - raise exception.ParseError("missing USE description with the 'flag' tag") + raise exception.ParseError("missing USE description with " + \ + "the 'flag' tag (name=%s)" % pkg_flag) uselist[pkg_flag] = pkg_flag_value return uselist |