From a891ec595a09ff14366b7ca13b24a340ed44f10b Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 18 Feb 2007 20:45:14 +0000 Subject: [PATCH] For bug #167450, optimize merge order by delaying the merge of root nodes. svn path=/main/trunk/; revision=5996 --- pym/emerge/__init__.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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 -- 2.26.2