When selecting leaf nodes, if there is a mix of merge and uninstall
authorZac Medico <zmedico@gentoo.org>
Sat, 10 May 2008 08:35:41 +0000 (08:35 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 10 May 2008 08:35:41 +0000 (08:35 -0000)
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. (trunk r10279)

svn path=/main/branches/2.1.2/; revision=10280

bin/emerge

index 6cefe9bcb5220dc83c9dfcb39cd810e6b995bb14..0ab37b6c5b3e1f04660d75a2948f715e705587af 100755 (executable)
@@ -3864,8 +3864,18 @@ class depgraph(object):
                                        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.
-                                               selected_nodes = nodes
+                                               # 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
+                                               else:
+                                                       selected_nodes = nodes
                                        else:
                                                # For optimal merge order:
                                                #  * Only pop one node.