Add a _MaskReason.hint attribute that the --autounmask code can use
authorZac Medico <zmedico@gentoo.org>
Fri, 6 Aug 2010 12:49:28 +0000 (05:49 -0700)
committerZac Medico <zmedico@gentoo.org>
Fri, 6 Aug 2010 12:49:28 +0000 (05:49 -0700)
to simplify the 'unstable keyword' check.

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

index 4dd3c3f1c08ce11f7c99d8ce976bf6fdec81c8f7..b7bbbd4b57423d58c55f39dacb40544fb5483cce 100644 (file)
@@ -2540,8 +2540,7 @@ class depgraph(object):
                        return False
                mreasons = _get_masking_status(pkg, pkgsettings, root_config)
                if len(mreasons) == 1 and \
-                       mreasons[0].category == 'KEYWORDS' and \
-                       mreasons[0].message.startswith("~"):
+                       mreasons[0].hint == 'unstable keyword':
                        return True
                else:
                        return False
index 61a06e76af87ea061aeef4dd159ca3daa1511478..5b20901865d2e050e7902792c8d9e1d29100110e 100644 (file)
@@ -17,11 +17,12 @@ if sys.hexversion >= 0x3000000:
 
 class _MaskReason(object):
 
-       __slots__ = ('category', 'message')
+       __slots__ = ('category', 'message', 'hint')
 
-       def __init__(self, category, message):
+       def __init__(self, category, message, hint=None):
                self.category = category
                self.message = message
+               self.hint = hint
 
 def getmaskingstatus(mycpv, settings=None, portdb=None):
        if settings is None:
@@ -114,6 +115,7 @@ def _getmaskingstatus(mycpv, settings, portdb):
                del inc_pgroups
 
        kmask = "missing"
+       kmask_hint = None
 
        if '**' in pgroups:
                kmask = None
@@ -133,6 +135,7 @@ def _getmaskingstatus(mycpv, settings, portdb):
                                break
                        elif gp=="~"+myarch and myarch in pgroups:
                                kmask="~"+myarch
+                               kmask_hint = "unstable keyword"
                                break
 
        try:
@@ -166,6 +169,7 @@ def _getmaskingstatus(mycpv, settings, portdb):
        # Only show KEYWORDS masks for installed packages
        # if they're not masked for any other reason.
        if kmask and (not installed or not rValue):
-               rValue.append(_MaskReason("KEYWORDS", kmask + " keyword"))
+               rValue.append(_MaskReason("KEYWORDS",
+                       kmask + " keyword", hint=kmask_hint))
 
        return rValue