* Split out a _get_masking_status() method that returns categorized
authorZac Medico <zmedico@gentoo.org>
Fri, 6 Aug 2010 12:30:42 +0000 (05:30 -0700)
committerZac Medico <zmedico@gentoo.org>
Fri, 6 Aug 2010 12:30:42 +0000 (05:30 -0700)
  message objects instead of plain strings.
* Move masks to the "invalid" category.

pym/_emerge/depgraph.py
pym/portage/package/ebuild/getmaskingstatus.py

index cc697ccf760c732e948898d6676615681b5f3e8a..4addbd449225e2d34df84d3bc4b499c7c1bf971b 100644 (file)
@@ -20,6 +20,8 @@ from portage.dep import Atom
 from portage.output import bold, blue, colorize, create_color_func, darkblue, \
        darkgreen, green, nc_len, red, teal, turquoise, yellow
 bad = create_color_func("BAD")
+from portage.package.ebuild.getmaskingstatus import \
+       _getmaskingstatus, _MaskReason
 from portage.sets import SETPREFIX
 from portage.sets.base import InternalPackageSet
 from portage.util import cmp_sort_key, writemsg, writemsg_stdout
@@ -6020,21 +6022,27 @@ def show_blocker_docs_link():
        print()
 
 def get_masking_status(pkg, pkgsettings, root_config):
+       return [mreason.message for \
+               mreason in _get_masking_status(pkg, pkgsettings, root_config)]
 
-       mreasons = portage.getmaskingstatus(
+def _get_masking_status(pkg, pkgsettings, root_config):
+
+       mreasons = _getmaskingstatus(
                pkg, settings=pkgsettings,
                portdb=root_config.trees["porttree"].dbapi)
 
        if not pkg.installed:
                if not pkgsettings._accept_chost(pkg.cpv, pkg.metadata):
-                       mreasons.append("CHOST: %s" % \
-                               pkg.metadata["CHOST"])
+                       mreasons.append(_MaskReason("CHOST", "CHOST: %s" % \
+                               pkg.metadata["CHOST"]))
                if pkg.invalid:
                        for msg_type, msgs in pkg.invalid.items():
                                for msg in msgs:
-                                       mreasons.append("invalid: %s" % (msg,))
+                                       mreasons.append(
+                                               _MaskReason("invalid", "invalid: %s" % (msg,)))
 
        if not pkg.metadata["SLOT"]:
-               mreasons.append("invalid: SLOT is undefined")
+               mreasons.append(
+                       _MaskReason("invalid", "SLOT: undefined"))
 
        return mreasons
index f1ccd6d90aabe92b5106362e5216ccfbf15ded6f..61a06e76af87ea061aeef4dd159ca3daa1511478 100644 (file)
@@ -147,7 +147,7 @@ def _getmaskingstatus(mycpv, settings, portdb):
                        msg.append("license(s)")
                        rValue.append(_MaskReason("LICENSE", " ".join(msg)))
        except portage.exception.InvalidDependString as e:
-               rValue.append(_MaskReason("LICENSE", "LICENSE: "+str(e)))
+               rValue.append(_MaskReason("invalid", "LICENSE: "+str(e)))
 
        try:
                missing_properties = settings._getMissingProperties(mycpv, metadata)
@@ -161,7 +161,7 @@ def _getmaskingstatus(mycpv, settings, portdb):
                        msg.append("properties")
                        rValue.append(_MaskReason("PROPERTIES", " ".join(msg)))
        except portage.exception.InvalidDependString as e:
-               rValue.append(_MaskReason("PROPERTIES", "PROPERTIES: "+str(e)))
+               rValue.append(_MaskReason("invalid", "PROPERTIES: "+str(e)))
 
        # Only show KEYWORDS masks for installed packages
        # if they're not masked for any other reason.