Gentoo Logo
Gentoo Spaceship




Note: Due to technical difficulties, the Archives are currently not up to date. GMANE provides an alternative service for most mailing lists.
c.f. bug 424647
List Archive: gentoo-commits
Navigation:
Lists: gentoo-commits: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: gentoo-commits@g.o
From: "Zac Medico (zmedico)" <zmedico@g.o>
Subject: portage r12965 - main/branches/2.1.6/pym/_emerge
Date: Wed, 11 Mar 2009 06:19:04 +0000
Author: zmedico
Date: 2009-03-11 06:19:03 +0000 (Wed, 11 Mar 2009)
New Revision: 12965

Modified:
   main/branches/2.1.6/pym/_emerge/__init__.py
Log:
Inside depgraph._merge_order_bias(), promote deep system runtime deps toward
the front of the merge list. This should help optimize merge order to account
for implicit system dependencies. (trunk r12710)

Modified: main/branches/2.1.6/pym/_emerge/__init__.py
===================================================================
--- main/branches/2.1.6/pym/_emerge/__init__.py	2009-03-11 06:18:50 UTC (rev 12964)
+++ main/branches/2.1.6/pym/_emerge/__init__.py	2009-03-11 06:19:03 UTC (rev 12965)
@@ -1104,6 +1104,38 @@
 	DepPrioritySatisfiedRange._ignore_runtime
 )
 
+def _find_deep_system_runtime_deps(graph):
+	deep_system_deps = set()
+	node_stack = []
+	for node in graph:
+		if not isinstance(node, Package) or \
+			node.operation == 'uninstall':
+			continue
+		if node.root_config.sets['system'].findAtomForPackage(node):
+			node_stack.append(node)
+
+	def ignore_priority(priority):
+		"""
+		Ignore non-runtime priorities.
+		"""
+		if isinstance(priority, DepPriority) and \
+			(priority.runtime or priority.runtime_post):
+			return False
+		return True
+
+	while node_stack:
+		node = node_stack.pop()
+		if node in deep_system_deps:
+			continue
+		deep_system_deps.add(node)
+		for child in graph.child_nodes(node, ignore_priority=ignore_priority):
+			if not isinstance(child, Package) or \
+				child.operation == 'uninstall':
+				continue
+			node_stack.append(child)
+
+	return deep_system_deps
+
 class FakeVartree(portage.vartree):
 	"""This is implements an in-memory copy of a vartree instance that provides
 	all the interfaces required for use by the depgraph.  The vardb is locked
@@ -6766,13 +6798,37 @@
 		return acceptable
 
 	def _merge_order_bias(self, mygraph):
-		"""Order nodes from highest to lowest overall reference count for
-		optimal leaf node selection."""
+		"""
+		For optimal leaf node selection, promote deep system runtime deps and
+		order nodes from highest to lowest overall reference count.
+		"""
+
 		node_info = {}
 		for node in mygraph.order:
 			node_info[node] = len(mygraph.parent_nodes(node))
+		deep_system_deps = (_find_deep_system_runtime_deps(mygraph))
+
 		def cmp_merge_preference(node1, node2):
+
+			if node1.operation == 'uninstall':
+				if node2.operation == 'uninstall':
+					return 0
+				return 1
+
+			if node2.operation == 'uninstall':
+				if node1.operation == 'uninstall':
+					return 0
+				return -1
+
+			node1_sys = node1 in deep_system_deps
+			node2_sys = node2 in deep_system_deps
+			if node1_sys != node2_sys:
+				if node1_sys:
+					return -1
+				return 1
+
 			return node_info[node2] - node_info[node1]
+
 		mygraph.order.sort(key=cmp_sort_key(cmp_merge_preference))
 
 	def altlist(self, reversed=False):
@@ -10132,38 +10188,10 @@
 		merged, these packages go to merge_wait_queue, to be merged when no
 		other packages are building.
 		"""
-		graph = self._digraph
 		deep_system_deps = self._deep_system_deps
 		deep_system_deps.clear()
-		node_stack = []
-		for node in graph.order:
-			if not isinstance(node, Package) or \
-				node.operation == "uninstall":
-				continue
-			system_set = node.root_config.sets["system"]
-			if system_set.findAtomForPackage(node):
-				node_stack.append(node)
-
-		def ignore_priority(priority):
-			"""
-			Ignore non-runtime priorities.
-			"""
-			if isinstance(priority, DepPriority) and \
-				(priority.runtime or priority.runtime_post):
-				return False
-			return True
-
-		while node_stack:
-			node = node_stack.pop()
-			if node in deep_system_deps:
-				continue
-			deep_system_deps.add(node)
-			for child in graph.child_nodes(node, ignore_priority=ignore_priority):
-				if not isinstance(child, Package) or \
-					child.operation == "uninstall":
-					continue
-				node_stack.append(child)
-
+		deep_system_deps.update(
+			_find_deep_system_runtime_deps(self._digraph))
 		deep_system_deps.difference_update([pkg for pkg in \
 			deep_system_deps if pkg.operation != "merge"])
 



Navigation:
Lists: gentoo-commits: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
portage r12964 - main/branches/2.1.6/pym/_emerge
Next by thread:
portage r12966 - main/branches/2.1.6/pym/_emerge
Previous by date:
portage r12964 - main/branches/2.1.6/pym/_emerge
Next by date:
portage r12966 - main/branches/2.1.6/pym/_emerge


Updated May 31, 2012

Summary: Archive of the gentoo-commits mailing list.

Donate to support our development efforts.

Copyright 2001-2013 Gentoo Foundation, Inc. Questions, Comments? Contact us.