get_dep_chain: fix unsatisfied_dependency logic
authorZac Medico <zmedico@gentoo.org>
Mon, 14 Feb 2011 04:57:57 +0000 (20:57 -0800)
committerZac Medico <zmedico@gentoo.org>
Mon, 14 Feb 2011 05:04:08 +0000 (21:04 -0800)
Always prefer parents for which the parent atom is unsatisfied by the
child node. This seems to be the intention of the code, though it may
not have behaved correctly due to continuation of the parent loop.

pym/_emerge/depgraph.py

index 1b76f5323e4d19a8e9ee64061206d6d8be2620d7..160299b31b59e6d42163bfdb9b33668242294abf 100644 (file)
@@ -2377,6 +2377,7 @@ class depgraph(object):
                        selected_parent = None
                        parent_arg = None
                        parent_merge = None
+                       parent_unsatisfied = None
 
                        for parent in self._dynamic_config.digraph.parent_nodes(node):
                                if parent in traversed_nodes:
@@ -2395,12 +2396,14 @@ class depgraph(object):
                                                        if parent is ppkg:
                                                                atom_set = InternalPackageSet(initial_atoms=(atom,))
                                                                if not atom_set.findAtomForPackage(start_node):
-                                                                       selected_parent = parent
+                                                                       parent_unsatisfied = parent
                                                                break
                                        else:
                                                selected_parent = parent
 
-                       if parent_merge is not None:
+                       if parent_unsatisfied is not None:
+                               selected_parent = parent_unsatisfied
+                       elif parent_merge is not None:
                                # Prefer parent in the merge list (bug #354747).
                                selected_parent = parent_merge
                        elif parent_arg is not None: