summaryrefslogtreecommitdiffstats
path: root/pym/_emerge/depgraph.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-02-12 23:36:07 -0800
committerZac Medico <zmedico@gentoo.org>2011-02-13 20:26:00 -0800
commit38d668d8734de42e6c27affe16dd0e2a21af35d3 (patch)
tree72b0b86b0e116d4729a2aaf998338f1d802d0084 /pym/_emerge/depgraph.py
parente76062cf65fb2cee414035f45acef66661c9f71d (diff)
downloadportage-38d668d8734de42e6c27affe16dd0e2a21af35d3.tar.gz
portage-38d668d8734de42e6c27affe16dd0e2a21af35d3.tar.bz2
portage-38d668d8734de42e6c27affe16dd0e2a21af35d3.zip
depgraph: avoid atom hash collisions in dep_check
Atoms are stored in the graph as (atom, id(atom)) tuples since each atom is considered to be a unique entity. For example, atoms that appear identical may behave differently in USE matching, depending on their unevaluated form. Also, specially generated virtual atoms may appear identical while having different _orig_atom attributes.
Diffstat (limited to 'pym/_emerge/depgraph.py')
-rw-r--r--pym/_emerge/depgraph.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 58dd451b3..8f1e00a3f 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -2160,7 +2160,7 @@ class depgraph(object):
if parent is None:
selected_atoms = mycheck[1]
else:
- chosen_atoms = frozenset(mycheck[1])
+ chosen_atom_ids = frozenset(id(atom) for atom in mycheck[1])
selected_atoms = OrderedDict()
node_stack = [(parent, None, None)]
traversed_nodes = set()
@@ -2183,13 +2183,14 @@ class depgraph(object):
depth=node.depth, parent=node_parent,
priority=node_priority, root=node.root)
- child_atoms = atom_graph.child_nodes(node)
- selected_atoms[k] = [atom for atom in \
- child_atoms if atom in chosen_atoms]
- for child_atom in child_atoms:
- if child_atom not in chosen_atoms:
+ child_atoms = []
+ selected_atoms[k] = child_atoms
+ for atom_node in atom_graph.child_nodes(node):
+ child_atom = atom_node[0]
+ if id(child_atom) not in chosen_atom_ids:
continue
- for child_node in atom_graph.child_nodes(child_atom):
+ child_atoms.append(child_atom)
+ for child_node in atom_graph.child_nodes(atom_node):
if child_node in traversed_nodes:
continue
if not portage.match_from_list(