summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-09-14 22:09:04 -0700
committerZac Medico <zmedico@gentoo.org>2011-09-14 22:09:04 -0700
commit70e7107bfb01225c0aac74ce32f66b1c3b0d4d2d (patch)
tree69d341ddb56c348814dcb239ef5a89af84d08c30
parenta5e7c15b03a9c6982f28ad2460261c98fe35889b (diff)
downloadportage-70e7107bfb01225c0aac74ce32f66b1c3b0d4d2d.tar.gz
portage-70e7107bfb01225c0aac74ce32f66b1c3b0d4d2d.tar.bz2
portage-70e7107bfb01225c0aac74ce32f66b1c3b0d4d2d.zip
Fix multislot handling for depclean (bug #382823)
-rw-r--r--pym/_emerge/depgraph.py18
-rw-r--r--pym/portage/tests/resolver/test_multislot.py16
2 files changed, 29 insertions, 5 deletions
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 1e311e8f7..f25a22dea 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -3263,11 +3263,20 @@ class depgraph(object):
# satisfied rather than forcing a rebuild.
installed = pkg_type == 'installed'
if installed and not cpv_list and atom.slot:
+
+ if "remove" in self._dynamic_config.myparams:
+ # We need to search the portdbapi, which is not in our
+ # normal dbs list, in order to find the real SLOT.
+ portdb = self._frozen_config.trees[root_config.root]["porttree"].dbapi
+ db_keys = list(portdb._aux_cache_keys)
+ dbs = [(portdb, "ebuild", False, False, db_keys)]
+ else:
+ dbs = self._dynamic_config._filtered_trees[root_config.root]["dbs"]
+
for cpv in db.match(atom.cp):
slot_available = False
for other_db, other_type, other_built, \
- other_installed, other_keys in \
- self._dynamic_config._filtered_trees[root_config.root]["dbs"]:
+ other_installed, other_keys in dbs:
try:
if atom.slot == \
other_db.aux_get(cpv, ["SLOT"])[0]:
@@ -4064,11 +4073,12 @@ class depgraph(object):
"""
Select packages that are installed.
"""
- vardb = self._dynamic_config._graph_trees[root]["vartree"].dbapi
- matches = vardb.match_pkgs(atom)
+ matches = list(self._iter_match_pkgs(self._frozen_config.roots[root],
+ "installed", atom))
if not matches:
return None, None
if len(matches) > 1:
+ matches.reverse() # ascending order
unmasked = [pkg for pkg in matches if \
self._pkg_visibility_check(pkg)]
if unmasked:
diff --git a/pym/portage/tests/resolver/test_multislot.py b/pym/portage/tests/resolver/test_multislot.py
index 8615419b5..1331edf25 100644
--- a/pym/portage/tests/resolver/test_multislot.py
+++ b/pym/portage/tests/resolver/test_multislot.py
@@ -14,12 +14,18 @@ class MultSlotTestCase(TestCase):
ebuilds = {
"sys-devel/gcc-4.4.4": { "SLOT": "4.4" },
+ "dev-util/nvidia-cuda-toolkit-4.0" : { "RDEPEND": "sys-devel/gcc:4.4"},
}
installed = {
"sys-devel/gcc-4.4.4": { "SLOT": "i686-pc-linux-gnu-4.4.4" },
+ "dev-util/nvidia-cuda-toolkit-4.0" : { "RDEPEND": "sys-devel/gcc:4.4"},
}
+ world = (
+ "dev-util/nvidia-cuda-toolkit",
+ )
+
options = {'--update' : True, '--deep' : True, '--selective' : True}
test_cases = (
@@ -28,9 +34,17 @@ class MultSlotTestCase(TestCase):
options = options,
mergelist = [],
success = True),
+
+ # depclean test for bug #382823
+ ResolverPlaygroundTestCase(
+ [],
+ options = {"--depclean": True},
+ success = True,
+ cleanlist = []),
)
- playground = ResolverPlayground(ebuilds=ebuilds, installed=installed)
+ playground = ResolverPlayground(ebuilds=ebuilds, installed=installed,
+ world=world)
try:
for test_case in test_cases: