From 4f66159887fc4e3ec8bd87ae0f08ba249f98631b Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 30 May 2011 19:16:43 -0700 Subject: [PATCH] dep_zapdeps: use digraph for preference selection This is required in order for dep_zapdeps to work as intended for solving cases of bug #264434 in which there is an installed package that may need to be uninstalled in order to resolve blockers. It fixes a failure to resolve blockers when attempting to replace media-video/ffmpeg with media-video/libav (symptom is similar to bug #339164, but with new-style virtual instead of old-style PROVIDE virtual). --- pym/_emerge/depgraph.py | 3 +++ pym/portage/dep/dep_check.py | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index de75eb131..d05b5642a 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -450,6 +450,8 @@ class _dynamic_depgraph_config(object): # have already been made. self._graph_trees[myroot]["porttree"] = graph_tree self._graph_trees[myroot]["vartree"] = graph_tree + self._graph_trees[myroot]["graph_db"] = graph_tree.dbapi + self._graph_trees[myroot]["graph"] = self.digraph def filtered_tree(): pass filtered_tree.dbapi = _dep_check_composite_db(depgraph, myroot) @@ -473,6 +475,7 @@ class _dynamic_depgraph_config(object): # unresolvable direct circular dependencies can be detected and # avoided when possible. self._filtered_trees[myroot]["graph_db"] = graph_tree.dbapi + self._filtered_trees[myroot]["graph"] = self.digraph self._filtered_trees[myroot]["vartree"] = \ depgraph._frozen_config.trees[myroot]["vartree"] diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py index 53fce128e..01d502149 100644 --- a/pym/portage/dep/dep_check.py +++ b/pym/portage/dep/dep_check.py @@ -317,6 +317,7 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None): parent = trees[myroot].get("parent") priority = trees[myroot].get("priority") graph_db = trees[myroot].get("graph_db") + graph = trees[myroot].get("graph") vardb = None if "vartree" in trees[myroot]: vardb = trees[myroot]["vartree"].dbapi @@ -417,8 +418,14 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None): all_in_graph = True for slot_atom in slot_map: # New-style virtuals have zero cost to install. - if not graph_db.match(slot_atom) and \ - not slot_atom.startswith("virtual/"): + if slot_atom.startswith("virtual/"): + continue + # We check if the matched package has actually been + # added to the digraph, in order to distinguish between + # those packages and installed packages that may need + # to be uninstalled in order to resolve blockers. + graph_matches = graph_db.match_pkgs(slot_atom) + if not graph_matches or graph_matches[-1] not in graph: all_in_graph = False break circular_atom = None -- 2.26.2