Pass a keyword hint from getmaskingstatus() to the autounmask code.
authorZac Medico <zmedico@gentoo.org>
Mon, 23 Aug 2010 17:38:49 +0000 (10:38 -0700)
committerZac Medico <zmedico@gentoo.org>
Mon, 23 Aug 2010 17:38:49 +0000 (10:38 -0700)
pym/_emerge/depgraph.py
pym/portage/package/ebuild/getmaskingstatus.py

index f9b581e0ecc70edfd4ce02f0b78ab8a806e119e3..2173d1031827970135e5b64325bdbfdb70644248 100644 (file)
@@ -2429,7 +2429,8 @@ class depgraph(object):
                root_config = self._frozen_config.roots[pkg.root]
                mreasons = _get_masking_status(pkg, pkgsettings, root_config, use=self._pkg_use_enabled(pkg))
                if len(mreasons) == 1 and \
-                       mreasons[0].hint == 'unstable keyword':
+                       mreasons[0].unmask_hint and \
+                       mreasons[0].unmask_hint.key == 'unstable keyword':
                        return True
                else:
                        return False
@@ -5196,8 +5197,16 @@ class depgraph(object):
                        self._show_merge_list()
                        if pkg in self._dynamic_config.digraph.nodes.keys():
                                pkgsettings = self._frozen_config.pkgsettings[pkg.root]
+                               mreasons = _get_masking_status(pkg, pkgsettings, pkg.root_config,
+                                       use=self._pkg_use_enabled(pkg))
+                               if len(mreasons) == 1 and \
+                                       mreasons[0].unmask_hint and \
+                                       mreasons[0].unmask_hint.key == 'unstable keyword':
+                                       keyword = mreasons[0].unmask_hint.value
+                               else:
+                                       keyword = '~' + pkgsettings.get('ARCH', '*')
                                unstable_keyword_msg.append(get_dep_chain(pkg))
-                               unstable_keyword_msg.append("=%s ~%s\n" % (pkg.cpv, pkgsettings["ACCEPT_KEYWORDS"]))
+                               unstable_keyword_msg.append("=%s %s\n" % (pkg.cpv, keyword))
 
                use_changes_msg = []
                for pkg, needed_use_config_change in self._dynamic_config._needed_use_config_changes.items():
index 5b20901865d2e050e7902792c8d9e1d29100110e..a09aa33ddf5c7c35ea4a18fbac3e541739de9f58 100644 (file)
@@ -15,14 +15,22 @@ from portage.versions import catpkgsplit, cpv_getkey
 if sys.hexversion >= 0x3000000:
        basestring = str
 
+class _UnmaskHint(object):
+
+       __slots__ = ('key', 'value')
+
+       def __init__(self, key, value):
+               self.key = key
+               self.value = value
+
 class _MaskReason(object):
 
-       __slots__ = ('category', 'message', 'hint')
+       __slots__ = ('category', 'message', 'unmask_hint')
 
-       def __init__(self, category, message, hint=None):
+       def __init__(self, category, message, unmask_hint=None):
                self.category = category
                self.message = message
-               self.hint = hint
+               self.unmask_hint = unmask_hint
 
 def getmaskingstatus(mycpv, settings=None, portdb=None):
        if settings is None:
@@ -135,7 +143,7 @@ def _getmaskingstatus(mycpv, settings, portdb):
                                break
                        elif gp=="~"+myarch and myarch in pgroups:
                                kmask="~"+myarch
-                               kmask_hint = "unstable keyword"
+                               kmask_hint = _UnmaskHint("unstable keyword", kmask)
                                break
 
        try:
@@ -170,6 +178,6 @@ def _getmaskingstatus(mycpv, settings, portdb):
        # if they're not masked for any other reason.
        if kmask and (not installed or not rValue):
                rValue.append(_MaskReason("KEYWORDS",
-                       kmask + " keyword", hint=kmask_hint))
+                       kmask + " keyword", unmask_hint=kmask_hint))
 
        return rValue