From: Zac Medico Date: Sun, 18 Feb 2007 20:45:14 +0000 (-0000) Subject: For bug #167450, optimize merge order by delaying the merge of root nodes. X-Git-Tag: v2.2_pre1~1684 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a891ec595a09ff14366b7ca13b24a340ed44f10b;p=portage.git For bug #167450, optimize merge order by delaying the merge of root nodes. svn path=/main/trunk/; revision=5996 --- diff --git a/pym/emerge/__init__.py b/pym/emerge/__init__.py index 96bad6761..6d3993266 100644 --- a/pym/emerge/__init__.py +++ b/pym/emerge/__init__.py @@ -2025,8 +2025,18 @@ class depgraph: # output, so it's disabled in reversed mode. selected_nodes = nodes else: - # Only pop one node for optimal merge order. - 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: + # settle for a root node + selected_nodes = [nodes[0]] else: """Recursively gather a group of nodes that RDEPEND on eachother. This ensures that they are merged as a group