Make metadata.xml <flag/> errors non-fatal to repoman.
authorMichał Górny <gentoo@mgorny.alt.pl>
Sat, 17 Apr 2010 12:26:49 +0000 (12:26 +0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 24 Apr 2010 07:59:34 +0000 (00:59 -0700)
Previously, <flag/>-related errors in metadata.xml caused repoman
to abort the checks without even reporting the full path to broken
metadata.xml file. Now they are accounted as 'metadata.bad' errors.

bin/repoman
pym/repoman/utilities.py

index 23fcd4da81c996b8826f2c7ca0a4e0c0edd515ca..aa3a95268ac83ce7a5b37e80e68c75aefaba21f0 100755 (executable)
@@ -1314,7 +1314,13 @@ for x in scanlist:
                        del e
                else:
                        # load USE flags from metadata.xml
-                       utilities.parse_metadata_use(_metadata_xml, muselist)
+                       try:
+                               utilities.parse_metadata_use(_metadata_xml, muselist)
+                       except portage.exception.ParseError as e:
+                               metadata_bad = True
+                               stats["metadata.bad"] += 1
+                               fails["metadata.bad"].append("%s/metadata.xml: %s" % (x, e))
+                               muselist = []
 
                        # Run other metadata.xml checkers
                        try:
index 52ebba7254c59bdfafce4b70fc8dadc233b60cfb..30508041164e91c6161c99d921aef2fffe6abe2b 100644 (file)
@@ -119,14 +119,12 @@ def parse_metadata_use(xml_tree, uselist=None):
 
        flags = usetag[0].findall("flag")
        if not flags:
-               raise exception.ParseError("metadata.xml: " + \
-                       "Malformed input: missing 'flag' tag(s)")
+               raise exception.ParseError("missing 'flag' tag(s)")
 
        for flag in flags:
                pkg_flag = flag.get("name")
                if pkg_flag is None:
-                       raise exception.ParseError("metadata.xml: " + \
-                               "Malformed input: missing 'name' attribute for 'flag' tag")
+                       raise exception.ParseError("missing 'name' attribute for 'flag' tag")
                uselist.append(pkg_flag)
        return uselist