depclean: account for more masks
authorZac Medico <zmedico@gentoo.org>
Sun, 2 Jan 2011 09:52:02 +0000 (01:52 -0800)
committerZac Medico <zmedico@gentoo.org>
Sun, 2 Jan 2011 09:52:02 +0000 (01:52 -0800)
Account for packages with masks (like KEYWORDS masks) that are usually
ignored in visibility checks for installed packages, in order to
handle cases like bug #350285.

pym/_emerge/depgraph.py

index 6d04e781186b22f447bce2e987f814ddd045acc8..736a40447291c6ae842260289c13df54a0f19282 100644 (file)
@@ -3240,6 +3240,20 @@ class depgraph(object):
                matches = vardb.match_pkgs(atom)
                if not matches:
                        return None, None
+               if len(matches) > 1:
+                       unmasked = [pkg for pkg in matches if \
+                               self._pkg_visibility_check(pkg)]
+                       if unmasked:
+                               if len(unmasked) == 1:
+                                       matches = unmasked
+                               else:
+                                       # Account for packages with masks (like KEYWORDS masks)
+                                       # that are usually ignored in visibility checks for
+                                       # installed packages, in order to handle cases like
+                                       # bug #350285.
+                                       unmasked = [pkg for pkg in matches if not pkg.masks]
+                                       if unmasked:
+                                               matches = unmasked
                pkg = matches[-1] # highest match
                in_graph = self._dynamic_config._slot_pkg_map[root].get(pkg.slot_atom)
                return pkg, in_graph