Fix logic inside depgraph._serialize_tasks() to avoid the circular runtime
authorZac Medico <zmedico@gentoo.org>
Wed, 11 Mar 2009 03:32:05 +0000 (03:32 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 11 Mar 2009 03:32:05 +0000 (03:32 -0000)
deps path in some cases when it's not appropriate. This solves a case that
was reported, in which the perl was merged before libperl due do perl and
lots of it's deps being selected all at once. In this case, so many packages
were selected at once that the cmp_circular_bias() sort did not order them
very well (though it normally works fine with a smaller number of packages).
Thanks to Daniel Robbins for reporting this issue and helping me reproduce
it. (trunk r12568)

svn path=/main/branches/2.1.6/; revision=12849

pym/_emerge/__init__.py

index a0eb540cad862a9b5ec104692b3729b62a82db87..26388a7f9e544383e87e9ed630aa99293f3caec8 100644 (file)
@@ -6882,37 +6882,37 @@ class depgraph(object):
                                for ignore_priority in ignore_priority_soft_range:
                                        nodes = get_nodes(ignore_priority=ignore_priority)
                                        if nodes:
-                                               break
-                               if nodes:
-                                       if ignore_priority is None and not tree_mode:
-                                               # Greedily pop all of these nodes since no relationship
-                                               # has been ignored.  This optimization destroys --tree
-                                               # output, so it's disabled in reversed mode. If there
-                                               # is a mix of merge and uninstall nodes, save the
-                                               # uninstall nodes from later since sometimes a merge
-                                               # node will render an install node unnecessary, and
-                                               # we want to avoid doing a separate uninstall task in
-                                               # that case.
-                                               merge_nodes = [node for node in nodes \
-                                                       if node.operation == "merge"]
-                                               if merge_nodes:
-                                                       selected_nodes = merge_nodes
+                                               if ignore_priority is None and not tree_mode:
+                                                       # Greedily pop all of these nodes since no
+                                                       # relationship has been ignored. This optimization
+                                                       # destroys --tree output, so it's disabled in tree
+                                                       # mode. If there is a mix of merge and uninstall
+                                                       # nodes, save the uninstall nodes for later since
+                                                       # sometimes a merge node will render an install
+                                                       # node unnecessary, and we want to avoid doing a
+                                                       # separate uninstall task in that case.
+                                                       merge_nodes = [node for node in nodes \
+                                                               if node.operation == "merge"]
+                                                       if merge_nodes:
+                                                               selected_nodes = merge_nodes
+                                                       else:
+                                                               selected_nodes = nodes
                                                else:
-                                                       selected_nodes = nodes
-                                       else:
-                                               # For optimal merge order:
-                                               #  * Only pop one node.
-                                               #  * Removing a root node (node without a parent)
-                                               #    will not produce a leaf node, so avoid it.
-                                               for node in nodes:
-                                                       if mygraph.parent_nodes(node):
-                                                               # found a non-root node
-                                                               selected_nodes = [node]
-                                                               break
-                                               if not selected_nodes and \
-                                                       (accept_root_node or ignore_priority is None):
-                                                       # settle for a root node
-                                                       selected_nodes = [nodes[0]]
+                                                       # For optimal merge order:
+                                                       #  * Only pop one node.
+                                                       #  * Removing a root node (node without a parent)
+                                                       #    will not produce a leaf node, so avoid it.
+                                                       for node in nodes:
+                                                               if mygraph.parent_nodes(node):
+                                                                       # found a non-root node
+                                                                       selected_nodes = [node]
+                                                                       break
+                                                       if not selected_nodes and \
+                                                               (accept_root_node or ignore_priority is None):
+                                                               # settle for a root node
+                                                               selected_nodes = [nodes[0]]
+                                               if selected_nodes:
+                                                       break
 
                        if not selected_nodes:
                                nodes = get_nodes(ignore_priority=DepPriority.MEDIUM)