diff options
author | Zac Medico <zmedico@gentoo.org> | 2011-02-11 22:09:30 -0800 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2011-02-11 22:09:30 -0800 |
commit | 0582c0fefb8549cbfe945aa588a0646871346730 (patch) | |
tree | f89f7088e8de188a47d3c97a119443cd20f4060e | |
parent | 5b16e0d800f34dc90cdd8c505172ad16b97f0af4 (diff) | |
download | portage-0582c0fefb8549cbfe945aa588a0646871346730.tar.gz portage-0582c0fefb8549cbfe945aa588a0646871346730.tar.bz2 portage-0582c0fefb8549cbfe945aa588a0646871346730.zip |
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.
-rw-r--r-- | pym/_emerge/depgraph.py | 28 |
1 files 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( |