--autounmask: Treat missing keywords as masks
authorSebastian Luther <SebastianLuther@gmx.de>
Sun, 15 May 2011 19:05:19 +0000 (12:05 -0700)
committerZac Medico <zmedico@gentoo.org>
Sun, 15 May 2011 19:05:19 +0000 (12:05 -0700)
pym/_emerge/depgraph.py
pym/portage/package/ebuild/getmaskingstatus.py
pym/portage/tests/resolver/test_autounmask.py

index d095ce1898ea24814d6893a37d5d00d71880395d..80e35c4b57ef71aade5718450ed6e2120f174b67 100644 (file)
@@ -3285,6 +3285,9 @@ class depgraph(object):
                                        if only_use_changes and allow_unmasks:
                                                continue
 
+                                       if pkg is not None:
+                                               break
+
                                        pkg, existing = \
                                                self._wrapped_select_pkg_highest_available_imp(
                                                        root, atom, onlydeps=onlydeps,
@@ -3321,6 +3324,7 @@ class depgraph(object):
                mreasons = _get_masking_status(pkg, pkgsettings, root_config, use=self._pkg_use_enabled(pkg))
 
                masked_by_unstable_keywords = False
+               masked_by_missing_keywords = False
                missing_licenses = None
                masked_by_something_else = False
                masked_by_p_mask = False
@@ -3332,6 +3336,8 @@ class depgraph(object):
                                masked_by_something_else = True
                        elif hint.key == "unstable keyword":
                                masked_by_unstable_keywords = True
+                               if hint.value == "**":
+                                       masked_by_missing_keywords = True
                        elif hint.key == "p_mask":
                                masked_by_p_mask = True
                        elif hint.key == "license":
@@ -3345,6 +3351,7 @@ class depgraph(object):
                if pkg in self._dynamic_config._needed_unstable_keywords:
                        #If the package is already keyworded, remove the mask.
                        masked_by_unstable_keywords = False
+                       masked_by_missing_keywords = False
 
                if pkg in self._dynamic_config._needed_p_mask_changes:
                        #If the package is already keyworded, remove the mask.
@@ -3358,7 +3365,9 @@ class depgraph(object):
                        #Package has already been unmasked.
                        return True
 
+               #We treat missing keywords in the same way as masks.
                if (masked_by_unstable_keywords and not allow_unstable_keywords) or \
+                       (masked_by_missing_keywords and not allow_unmasks) or \
                        (masked_by_p_mask and not allow_unmasks) or \
                        (missing_licenses and not allow_license_changes):
                        #We are not allowed to do the needed changes.
index e46f7886db5e8cce6438fe311a6bdf2ff557dac3..4eb162587d35cfc6d0b8f5b56e50abcfba5e1b7a 100644 (file)
@@ -149,6 +149,9 @@ def _getmaskingstatus(mycpv, settings, portdb, myrepo=None):
                                kmask_hint = _UnmaskHint("unstable keyword", kmask)
                                break
 
+       if kmask == "missing":
+               kmask_hint = _UnmaskHint("unstable keyword", "**")
+
        try:
                missing_licenses = settings._getMissingLicenses(mycpv, metadata)
                if missing_licenses:
index 62b1522338c733301fde78e22abd73d3e90e1b23..0689a37437f98684fe4c7388b18b0a4a935a9d8f 100644 (file)
@@ -32,6 +32,9 @@ class AutounmaskTestCase(TestCase):
                        #ebuilds to test mask and keyword changes
                        "app-text/A-1": {},
                        "app-text/B-1": { "KEYWORDS": "~x86" },
+                       "app-text/C-1": { "KEYWORDS": "" },
+                       "app-text/D-1": { "KEYWORDS": "~x86" },
+                       "app-text/D-2": { "KEYWORDS": "" },
 
                        #ebuilds for mixed test for || dep handling
                        "sci-libs/K-1": { "DEPEND": " || ( sci-libs/L[bar] || ( sci-libs/M sci-libs/P ) )", "EAPI": 2},
@@ -222,6 +225,19 @@ class AutounmaskTestCase(TestCase):
                                        mergelist = ["app-text/B-1"],
                                        unstable_keywords = ["app-text/B-1"],
                                        needed_p_mask_changes = ["app-text/B-1"]),
+                               ResolverPlaygroundTestCase(
+                                       ["app-text/C"],
+                                       options = {"--autounmask": True},
+                                       success = False,
+                                       mergelist = ["app-text/C-1"],
+                                       unstable_keywords = ["app-text/C-1"],
+                                       needed_p_mask_changes = ["app-text/C-1"]),
+                               ResolverPlaygroundTestCase(
+                                       ["app-text/D"],
+                                       options = {"--autounmask": True},
+                                       success = False,
+                                       mergelist = ["app-text/D-1"],
+                                       unstable_keywords = ["app-text/D-1"])
                        )
 
                profile = {
@@ -237,6 +253,7 @@ class AutounmaskTestCase(TestCase):
                                (
                                        "app-text/A",
                                        "app-text/B",
+                                       "app-text/C",
                                ),
                }