From 0582c0fefb8549cbfe945aa588a0646871346730 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 11 Feb 2011 22:09:30 -0800 Subject: [PATCH] depgraph: don't distort edges for virtuals In _add_pkg_dep_string(), _add_pkg() was called with generated Dependency instances that created fake/distorted edges in the graph for new-style virtuals (similar to those that were fixed in commit 5b16e0d800f34dc90cdd8c505172ad16b97f0af4). Now there won't be any such distorted edges. --- pym/_emerge/depgraph.py | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 91ec2509d..fb54f50a2 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -1277,21 +1277,31 @@ class depgraph(object): # by dep_zapdeps. We preserve actual parent/child relationships # here in order to avoid distorting the dependency graph like # <=portage-2.1.6.x did. - for virt_pkg, atoms in selected_atoms.items(): + while selected_atoms: + + # Since _select_atoms currently doesn't return parent + # info for recursively traversed virtuals, the parent + # is not known here. However, this package may have + # already been added to graph above, so we add packages + # with parents first. This way, parents are already + # recorded before a given package is added, which allows + # us to avoid triggering a slot conflict before the + # parent is known. + for virt_pkg, atoms in selected_atoms.items(): + try: + if self._dynamic_config.digraph.parent_nodes(virt_pkg): + break + except KeyError: + pass + + selected_atoms.pop(virt_pkg) if debug: writemsg_level("Candidates: %s: %s\n" % \ (virt_pkg.cpv, [str(x) for x in atoms]), noiselevel=-1, level=logging.DEBUG) - # Just assume depth + 1 here for now, though it's not entirely - # accurate since multilple levels of indirect virtual deps may - # have been traversed. The _add_pkg call will reset the depth to - # 0 if this package happens to match an argument. - if not self._add_pkg(virt_pkg, - Dependency(atom=Atom('=' + virt_pkg.cpv), - depth=(depth + 1), parent=pkg, priority=dep_priority.copy(), - root=dep_root)): + if not self._add_pkg(virt_pkg, None): return 0 for atom, child in self._minimize_children( -- 2.26.2