From e9d6a559afab38ac687f17bb261a4ddde62a3247 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 2 Feb 2009 01:03:47 +0000 Subject: Fix logic inside depgraph._serialize_tasks() to avoid the circular runtime 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. svn path=/main/trunk/; revision=12568 --- pym/_emerge/__init__.py | 60 ++++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'pym/_emerge/__init__.py') diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index 615b47848..fb04b304f 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -6898,37 +6898,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) -- cgit v1.2.3-1-g7c22