Make Package.invalid suitable for use by repoman.
authorZac Medico <zmedico@gentoo.org>
Sun, 28 Jun 2009 19:03:33 +0000 (19:03 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 28 Jun 2009 19:03:33 +0000 (19:03 -0000)
svn path=/main/trunk/; revision=13726

pym/_emerge/Package.py
pym/_emerge/depgraph.py

index 938c17733393dec02a794c4260c189dbbc7ebdad..512703b8318e6d1507e36307c37d7723754cf66b 100644 (file)
@@ -52,10 +52,14 @@ class Package(Task):
                self.cpv_split = portage.catpkgsplit(self.cpv)
                self.pv_split = self.cpv_split[1:]
 
-       def _invalid_metadata(self, msg):
+       def _invalid_metadata(self, msg_type, msg):
                if self.invalid is None:
-                       self.invalid = []
-               self.invalid.append(msg)
+                       self.invalid = {}
+               msgs = self.invalid.get(msg_type)
+               if msgs is None:
+                       msgs = []
+                       self.invalid[msg_type] = msgs
+               msgs.append(msg)
 
        class _use_class(object):
 
@@ -217,7 +221,7 @@ class _PackageMetadataWrapper(_PackageMetadataWrapperBase):
                        try:
                                use_reduce(paren_reduce(v), matchall=1)
                        except portage.exception.InvalidDependString, e:
-                               self._pkg._invalid_metadata("%s: %s" % (k, e))
+                               self._pkg._invalid_metadata(k + ".syntax", "%s: %s" % (k, e))
 
        def _set_inherited(self, k, v):
                if isinstance(v, basestring):
index 371c0b1ea925b0f729b833b9e88f0bad10106d88..bb0f4da3bce95865d1117f0a9ac71dd63e2aba2d 100644 (file)
@@ -4898,8 +4898,9 @@ def get_masking_status(pkg, pkgsettings, root_config):
                        mreasons.append("CHOST: %s" % \
                                pkg.metadata["CHOST"])
                if pkg.invalid:
-                       for msg in pkg.invalid:
-                               mreasons.append("invalid: %s" % (msg,))
+                       for msg_type, msgs in pkg.invalid.iteritems():
+                               for msg in msgs:
+                                       mreasons.append("invalid: %s" % (msg,))
 
        if not pkg.metadata["SLOT"]:
                mreasons.append("invalid: SLOT is undefined")