From adde8a45e2f82adcc12cb146ccc65774d5783bf2 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 11 Jun 2011 02:05:51 -0700 Subject: [PATCH] serialize_tasks: minimize runtime cycles more --- pym/_emerge/depgraph.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 5dda22246..854fa63fb 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -5015,6 +5015,7 @@ class depgraph(object): # this tends to produce a more optimal merge order. # Ignoring all medium_soft deps serves this purpose. ignore_priority = priority_range.ignore_medium_soft + smallest_cycle = None for node in nodes: if not mygraph.parent_nodes(node): continue @@ -5037,9 +5038,11 @@ class depgraph(object): selected_nodes = None break if selected_nodes: - break - else: - selected_nodes = None + if smallest_cycle is None or \ + len(selected_nodes) < len(smallest_cycle): + smallest_cycle = selected_nodes + + selected_nodes = smallest_cycle if prefer_asap and asap_nodes and not selected_nodes: # We failed to find any asap nodes to merge, so ignore -- 2.26.2