From 0d529b7829b19b3f55dc05747dc8299ae32498e1 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 6 Aug 2010 05:30:42 -0700 Subject: * Split out a _get_masking_status() method that returns categorized message objects instead of plain strings. * Move masks to the "invalid" category. --- pym/_emerge/depgraph.py | 18 +++++++++++++----- pym/portage/package/ebuild/getmaskingstatus.py | 4 ++-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index cc697ccf..4addbd44 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -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 diff --git a/pym/portage/package/ebuild/getmaskingstatus.py b/pym/portage/package/ebuild/getmaskingstatus.py index f1ccd6d9..61a06e76 100644 --- a/pym/portage/package/ebuild/getmaskingstatus.py +++ b/pym/portage/package/ebuild/getmaskingstatus.py @@ -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. -- cgit v1.2.3-65-gdbad