summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-11-22 06:12:43 +0000
committerZac Medico <zmedico@gentoo.org>2007-11-22 06:12:43 +0000
commit51a02214703d0f338611c5f9ce214405e0e58fbb (patch)
treedc5eb09488d959b4d173d62986576e6709ef766a
parent279fe44cdc3123d8f048d7c1f2e1cc77b6a45656 (diff)
downloadportage-51a02214703d0f338611c5f9ce214405e0e58fbb.tar.gz
portage-51a02214703d0f338611c5f9ce214405e0e58fbb.tar.bz2
portage-51a02214703d0f338611c5f9ce214405e0e58fbb.zip
In depgraph.altlist(), measure the bias of circular
RDEPEND <-> PDEPEND relationships and use it to optimize merge order. svn path=/main/trunk/; revision=8593
-rw-r--r--pym/_emerge/__init__.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index 50cca0513..8223b2a76 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -2830,6 +2830,21 @@ class depgraph(object):
if not removed_something:
break
self._merge_order_bias(mygraph)
+ def cmp_circular_bias(n1, n2):
+ """
+ RDEPEND is stronger than PDEPEND and this function
+ measures such a strength bias within a circular
+ dependency relationship.
+ """
+ n1_n2_medium = n2 in mygraph.child_nodes(n1,
+ ignore_priority=DepPriority.MEDIUM_SOFT)
+ n2_n1_medium = n1 in mygraph.child_nodes(n2,
+ ignore_priority=DepPriority.MEDIUM_SOFT)
+ if n1_n2_medium == n2_n1_medium:
+ return 0
+ elif n1_n2_medium:
+ return 1
+ return -1
myblockers = self.blocker_digraph.copy()
retlist=[]
circular_blocks = False
@@ -2997,6 +3012,11 @@ class depgraph(object):
continue
asap_nodes.append(child)
+ if selected_nodes and len(selected_nodes) > 1:
+ if not isinstance(selected_nodes, list):
+ selected_nodes = list(selected_nodes)
+ selected_nodes.sort(cmp_circular_bias)
+
if not selected_nodes:
if not myblockers.is_empty():
"""A blocker couldn't be circumnavigated while keeping all