repoman: validate use restrict atoms, bug #442786
authorZac Medico <zmedico@gentoo.org>
Wed, 14 Nov 2012 03:17:24 +0000 (19:17 -0800)
committerZac Medico <zmedico@gentoo.org>
Wed, 14 Nov 2012 03:17:24 +0000 (19:17 -0800)
bin/repoman
pym/portage/tests/repoman/test_simple.py

index 553b1d20f8164e7986f413ff403b7b770bcd8618..91a98153b21d7ec2212e048fa50526424cd27733 100755 (executable)
@@ -69,8 +69,9 @@ import portage.checksum
 import portage.const
 from portage import cvstree, normalize_path
 from portage import util
-from portage.exception import (FileNotFound, MissingParameter,
+from portage.exception import (FileNotFound, InvalidAtom, MissingParameter,
        ParseError, PermissionDenied)
+from portage.dep import Atom
 from portage.process import find_binary, spawn
 from portage.output import bold, create_color_func, \
        green, nocolor, red
@@ -1661,6 +1662,22 @@ for x in effective_scanlist:
                                metadata_bad = True
                                stats["metadata.bad"] += 1
                                fails["metadata.bad"].append("%s/metadata.xml: %s" % (x, e))
+                       else:
+                               for atom in chain(*musedict.values()):
+                                       if atom is None:
+                                               continue
+                                       try:
+                                               atom = Atom(atom)
+                                       except InvalidAtom as e:
+                                               stats["metadata.bad"] += 1
+                                               fails["metadata.bad"].append(
+                                                       "%s/metadata.xml: Invalid atom: %s" % (x, e))
+                                       else:
+                                               if atom.cp != x:
+                                                       stats["metadata.bad"] += 1
+                                                       fails["metadata.bad"].append(
+                                                               ("%s/metadata.xml: Atom contains "
+                                                               "unexpected cat/pn: %s") % (x, atom))
 
                        # Run other metadata.xml checkers
                        try:
index f29a177f015112738ba000d047e469a44c880ca7..908fb2d20336aa3ec5cf22edd8bc735a6b2fbff3 100644 (file)
@@ -133,7 +133,7 @@ class SimpleRepomanTestCase(TestCase):
                                "dev-libs/A",
                                {
                                        "herd" : "base-system",
-                                       "flags" : "<flag name='flag'>Description of how USE='flag' affects this package</flag>",
+                                       "flags" : "<flag name='flag' restrict='&gt;=dev-libs/A-0'>Description of how USE='flag' affects this package</flag>",
                                },
                        ),
                        (