Use isvalidatom to validate PROVIDE entries. (trunk r15397)
authorZac Medico <zmedico@gentoo.org>
Tue, 2 Mar 2010 20:38:54 +0000 (20:38 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 2 Mar 2010 20:38:54 +0000 (20:38 -0000)
svn path=/main/branches/2.1.7/; revision=15619

pym/_emerge/Package.py

index 4ecc1052e392c20b94f344ec15e9323815b1e265..97be8ccf2ff931d49529437762962fd318170221 100644 (file)
@@ -7,7 +7,7 @@ import sys
 from itertools import chain
 import portage
 from portage.cache.mappings import slot_dict_class
-from portage.dep import paren_reduce, use_reduce, \
+from portage.dep import isvalidatom, paren_reduce, use_reduce, \
        paren_normalize, paren_enclose, _slot_re
 from _emerge.Task import Task
 
@@ -289,9 +289,15 @@ class _PackageMetadataWrapper(_PackageMetadataWrapperBase):
                        getattr(self, "_set_" + k.lower())(k, v)
                elif k in self._use_conditional_keys:
                        try:
-                               use_reduce(paren_reduce(v), matchall=1)
+                               reduced = use_reduce(paren_reduce(v), matchall=1)
                        except portage.exception.InvalidDependString as e:
                                self._pkg._invalid_metadata(k + ".syntax", "%s: %s" % (k, e))
+                       else:
+                               if reduced and k == 'PROVIDE':
+                                       for x in portage.flatten(reduced):
+                                               if not isvalidatom(x):
+                                                       self._pkg._invalid_metadata(k + ".syntax",
+                                                               "%s: %s" % (k, x))
 
        def _set_inherited(self, k, v):
                if isinstance(v, basestring):