From 5386d738b118736a929876e9d1fca11dce588c0b Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 17 Feb 2008 23:51:42 +0000 Subject: Fix the --depclean/--prune code to use visible() for visibility checks instead of the old portdbapi hack. svn path=/main/trunk/; revision=9350 --- pym/_emerge/__init__.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'pym/_emerge/__init__.py') 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): -- cgit v1.2.3-1-g7c22