summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-02-13 03:13:34 -0800
committerZac Medico <zmedico@gentoo.org>2011-02-13 03:13:34 -0800
commitd7afc73681967c64a641d9769dae23886b908164 (patch)
tree980adac7f7d80fb55fb5170941af896c4ec1d365 /pym
parent5655b4dcfe5e9dae5e9d6352d791c3d04953baf7 (diff)
downloadportage-d7afc73681967c64a641d9769dae23886b908164.tar.gz
portage-d7afc73681967c64a641d9769dae23886b908164.tar.bz2
portage-d7afc73681967c64a641d9769dae23886b908164.zip
depgraph: tweak depth calculation for virtuals
Recursively traversed virtual dependencies, and their direct dependencies, are considered to have the same depth as direct dependencies.
Diffstat (limited to 'pym')
-rw-r--r--pym/_emerge/depgraph.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 72fc1ae59..1dba229e4 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -1350,8 +1350,10 @@ class depgraph(object):
# none visible, so use highest
mypriority.satisfied = inst_pkgs[0]
+ # Dependencies of virtuals are considered to have the
+ # same depth as the virtual itself.
if not self._add_dep(Dependency(atom=atom,
- blocker=atom.blocker, child=child, depth=virt_pkg.depth,
+ blocker=atom.blocker, child=child, depth=virt_dep.depth,
parent=virt_pkg, priority=mypriority, root=dep_root),
allow_unsatisfied=allow_unsatisfied):
return 0
@@ -2184,6 +2186,13 @@ class depgraph(object):
if parent is None:
selected_atoms = mycheck[1]
else:
+ # Recursively traversed virtual dependencies, and their
+ # direct dependencies, are considered to have the same
+ # depth as direct dependencies.
+ if parent.depth is None:
+ virt_depth = None
+ else:
+ virt_depth = parent.depth + 1
chosen_atom_ids = frozenset(id(atom) for atom in mycheck[1])
selected_atoms = OrderedDict()
node_stack = [(parent, None, None)]
@@ -2202,9 +2211,10 @@ class depgraph(object):
else:
# virtuals only have runtime deps
node_priority = self._priority(runtime=True)
+
k = Dependency(atom=parent_atom,
blocker=parent_atom.blocker, child=node,
- depth=node.depth, parent=node_parent,
+ depth=virt_depth, parent=node_parent,
priority=node_priority, root=node.root)
child_atoms = []
@@ -2225,7 +2235,6 @@ class depgraph(object):
# record this as an unsatisfied dependency
# when necessary.
continue
- child_node.depth = node.depth + 1
node_stack.append((child_node, node, child_atom))
return selected_atoms