diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-11-23 07:46:59 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-11-23 07:46:59 +0000 |
commit | 23c7f9f25a3dc787bf8444a5b84474b51d5876f5 (patch) | |
tree | 49ce2319f170ad76ba3718b1551e1e117fe49bcd | |
parent | fa3d711519eb2ab6e4205ea351d54ef908171297 (diff) | |
download | portage-23c7f9f25a3dc787bf8444a5b84474b51d5876f5.tar.gz portage-23c7f9f25a3dc787bf8444a5b84474b51d5876f5.tar.bz2 portage-23c7f9f25a3dc787bf8444a5b84474b51d5876f5.zip |
Fix the code from bug #245358 so that it's guaranteed to traverse all the
way to a root node, even when circular deps are encountered.
svn path=/main/trunk/; revision=12051
-rw-r--r-- | pym/_emerge/__init__.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index 1dd0575d8..ceae0395b 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -5411,17 +5411,19 @@ class depgraph(object): traversed_nodes.add(node) msg.append('(dependency required by "%s" [%s])' % \ (colorize('INFORM', str(node.cpv)), node.type_name)) - parent = None + # 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. + selected_parent = None for parent in self.digraph.parent_nodes(node): - if parent in traversed_nodes: - parent = None - continue if isinstance(parent, DependencyArg): msg.append('(dependency required by "%s" [argument])' % \ (colorize('INFORM', str(parent)))) - parent = None + selected_parent = None break - node = parent + if parent not in traversed_nodes: + selected_parent = parent + node = selected_parent for line in msg: print line |