summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-02-17 23:51:42 +0000
committerZac Medico <zmedico@gentoo.org>2008-02-17 23:51:42 +0000
commit5386d738b118736a929876e9d1fca11dce588c0b (patch)
treec78a1041acf6323e5777047bf2cb0d7ea56431a7 /pym
parentb30da3bb2d12197b7bdd06ec7066aa1a1064a85c (diff)
downloadportage-5386d738b118736a929876e9d1fca11dce588c0b.tar.gz
portage-5386d738b118736a929876e9d1fca11dce588c0b.tar.bz2
portage-5386d738b118736a929876e9d1fca11dce588c0b.zip
Fix the --depclean/--prune code to use visible() for visibility checks
instead of the old portdbapi hack. svn path=/main/trunk/; revision=9350
Diffstat (limited to 'pym')
-rw-r--r--pym/_emerge/__init__.py25
1 files changed, 13 insertions, 12 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index c2ef805f5..e31ea27ee 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -6416,7 +6416,7 @@ def action_depclean(settings, trees, ldpath_mtimes,
unresolveable = {}
aux_keys = ["DEPEND", "RDEPEND", "PDEPEND"]
- metadata_keys = ["PROVIDE", "SLOT", "USE"]
+ metadata_keys = depgraph._mydbapi_keys
graph = digraph()
with_bdeps = myopts.get("--with-bdeps", "y") == "y"
@@ -6449,17 +6449,18 @@ def action_depclean(settings, trees, ldpath_mtimes,
filtered_pkgs.append(pkg)
pkgs = filtered_pkgs
if len(pkgs) > 1:
- # Prune all but the best matching slot, since that's all that a
- # deep world update would pull in. Don't prune if this atom comes
- # directly from world though, since world atoms are greedy when
- # they don't specify a slot.
- visible_in_portdb = [cpv for cpv in pkgs if portdb.match("="+cpv)]
- if visible_in_portdb:
- # For consistency with the update algorithm, keep the highest
- # visible version and prune any versions that are either masked
- # or no longer exist in the portage tree.
- pkgs = visible_in_portdb
- pkgs = [portage.best(pkgs)]
+ # For consistency with the update algorithm, keep the highest
+ # visible version and prune any versions that are old or masked.
+ for cpv in reversed(pkgs):
+ metadata = dict(izip(metadata_keys,
+ vardb.aux_get(cpv, metadata_keys)))
+ if visible(settings, cpv, metadata,
+ built=True, installed=True):
+ pkgs = [cpv]
+ break
+ if len(pkgs) > 1:
+ # They're all masked, so just keep the highest version.
+ pkgs = [pkgs[-1]]
for pkg in pkgs:
graph.add(pkg, parent, priority=priority)
if fakedb.cpv_exists(pkg):