aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-11-27 20:52:04 (GMT)
committerZac Medico <zmedico@gentoo.org>2011-11-27 20:52:04 (GMT)
commitee441f2c5358656f2f404f65f8e4d4972ac6daf8 (patch)
treee1a2425dec78ad361f846fe3e67bf67c803aa574
parentconfig: fix make.defaults inherit of make.globals (diff)
downloadportage-ee441f2c5358656f2f404f65f8e4d4972ac6daf8.zip
portage-ee441f2c5358656f2f404f65f8e4d4972ac6daf8.tar.gz
portage-ee441f2c5358656f2f404f65f8e4d4972ac6daf8.tar.bz2
_get_dep_chain: fix KeyError, bug #392059
This fixes a regression since commit 57cc4e3e8991e7c4394d1dff7698aa62ed2a286b, which make a faulty assumption that the digraph contained all of the edges contained in parent_atoms.
-rw-r--r--pym/_emerge/depgraph.py35
1 files changed, 22 insertions, 13 deletions
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 484206e..3bda894 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -2743,6 +2743,7 @@ class depgraph(object):
node = start_node
child = None
all_parents = self._dynamic_config._parent_atoms
+ graph = self._dynamic_config.digraph
if target_atom is not None and isinstance(node, Package):
affecting_use = set()
@@ -2801,8 +2802,12 @@ class depgraph(object):
while node is not None:
traversed_nodes.add(node)
- if isinstance(node, DependencyArg):
- if self._dynamic_config.digraph.parent_nodes(node):
+ if node not in graph:
+ # The parent is not in the graph due to backtracking.
+ break
+
+ elif isinstance(node, DependencyArg):
+ if graph.parent_nodes(node):
node_type = "set"
else:
node_type = "argument"
@@ -2815,13 +2820,21 @@ class depgraph(object):
break
dep_strings = set()
- for priority in self._dynamic_config.digraph.nodes[node][0][child]:
- if priority.buildtime:
- dep_strings.add(node.metadata["DEPEND"])
- if priority.runtime:
- dep_strings.add(node.metadata["RDEPEND"])
- if priority.runtime_post:
- dep_strings.add(node.metadata["PDEPEND"])
+ priorities = graph.nodes[node][0].get(child)
+ if priorities is None:
+ # This edge comes from _parent_atoms and was not added to
+ # the graph, and _parent_atoms does not contain priorities.
+ dep_strings.add(node.metadata["DEPEND"])
+ dep_strings.add(node.metadata["RDEPEND"])
+ dep_strings.add(node.metadata["PDEPEND"])
+ else:
+ for priority in priorities:
+ if priority.buildtime:
+ dep_strings.add(node.metadata["DEPEND"])
+ if priority.runtime:
+ dep_strings.add(node.metadata["RDEPEND"])
+ if priority.runtime_post:
+ dep_strings.add(node.metadata["PDEPEND"])
affecting_use = set()
for dep_str in dep_strings:
@@ -2848,10 +2861,6 @@ class depgraph(object):
dep_chain.append((pkg_name, node.type_name))
- if node not in self._dynamic_config.digraph:
- # The parent is not in the graph due to backtracking.
- break
-
# When traversing to parents, prefer arguments over packages
# since arguments are root nodes. Never traverse the same
# package twice, in order to prevent an infinite loop.