Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/_emerge/
Date: Sun, 27 Nov 2011 20:54:08
Message-Id: ee441f2c5358656f2f404f65f8e4d4972ac6daf8.zmedico@gentoo
1 commit: ee441f2c5358656f2f404f65f8e4d4972ac6daf8
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Sun Nov 27 20:52:04 2011 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Sun Nov 27 20:52:04 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ee441f2c
7
8 _get_dep_chain: fix KeyError, bug #392059
9
10 This fixes a regression since commit
11 57cc4e3e8991e7c4394d1dff7698aa62ed2a286b, which make a faulty
12 assumption that the digraph contained all of the edges contained in
13 parent_atoms.
14
15 ---
16 pym/_emerge/depgraph.py | 35 ++++++++++++++++++++++-------------
17 1 files changed, 22 insertions(+), 13 deletions(-)
18
19 diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
20 index 484206e..3bda894 100644
21 --- a/pym/_emerge/depgraph.py
22 +++ b/pym/_emerge/depgraph.py
23 @@ -2743,6 +2743,7 @@ class depgraph(object):
24 node = start_node
25 child = None
26 all_parents = self._dynamic_config._parent_atoms
27 + graph = self._dynamic_config.digraph
28
29 if target_atom is not None and isinstance(node, Package):
30 affecting_use = set()
31 @@ -2801,8 +2802,12 @@ class depgraph(object):
32 while node is not None:
33 traversed_nodes.add(node)
34
35 - if isinstance(node, DependencyArg):
36 - if self._dynamic_config.digraph.parent_nodes(node):
37 + if node not in graph:
38 + # The parent is not in the graph due to backtracking.
39 + break
40 +
41 + elif isinstance(node, DependencyArg):
42 + if graph.parent_nodes(node):
43 node_type = "set"
44 else:
45 node_type = "argument"
46 @@ -2815,13 +2820,21 @@ class depgraph(object):
47 break
48
49 dep_strings = set()
50 - for priority in self._dynamic_config.digraph.nodes[node][0][child]:
51 - if priority.buildtime:
52 - dep_strings.add(node.metadata["DEPEND"])
53 - if priority.runtime:
54 - dep_strings.add(node.metadata["RDEPEND"])
55 - if priority.runtime_post:
56 - dep_strings.add(node.metadata["PDEPEND"])
57 + priorities = graph.nodes[node][0].get(child)
58 + if priorities is None:
59 + # This edge comes from _parent_atoms and was not added to
60 + # the graph, and _parent_atoms does not contain priorities.
61 + dep_strings.add(node.metadata["DEPEND"])
62 + dep_strings.add(node.metadata["RDEPEND"])
63 + dep_strings.add(node.metadata["PDEPEND"])
64 + else:
65 + for priority in priorities:
66 + if priority.buildtime:
67 + dep_strings.add(node.metadata["DEPEND"])
68 + if priority.runtime:
69 + dep_strings.add(node.metadata["RDEPEND"])
70 + if priority.runtime_post:
71 + dep_strings.add(node.metadata["PDEPEND"])
72
73 affecting_use = set()
74 for dep_str in dep_strings:
75 @@ -2848,10 +2861,6 @@ class depgraph(object):
76
77 dep_chain.append((pkg_name, node.type_name))
78
79 - if node not in self._dynamic_config.digraph:
80 - # The parent is not in the graph due to backtracking.
81 - break
82 -
83 # When traversing to parents, prefer arguments over packages
84 # since arguments are root nodes. Never traverse the same
85 # package twice, in order to prevent an infinite loop.