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 r10515 - main/branches/2.1.2/bin
Date: Sat, 31 May 2008 02:08:26 +0000
Author: zmedico
Date: 2008-05-31 02:08:25 +0000 (Sat, 31 May 2008)
New Revision: 10515

Modified:
   main/branches/2.1.2/bin/emerge
Log:
Optimize the new --skipfirst code so that in only has to build
a new depgraph one time when there are unsatisfied deps. This
works by recursively traversing the digraph to remove the parent
packages whose deps become unsatisfied when their dependencies are
pruned from the mergelist. (trunk r10512:10514)


Modified: main/branches/2.1.2/bin/emerge
===================================================================
--- main/branches/2.1.2/bin/emerge	2008-05-31 02:06:01 UTC (rev 10514)
+++ main/branches/2.1.2/bin/emerge	2008-05-31 02:08:25 UTC (rev 10515)
@@ -8314,19 +8314,49 @@
 				except depgraph.UnsatisfiedResumeDep, e:
 					if "--skipfirst" not in myopts:
 						raise
-					unsatisfied_parents = set(dep.parent for dep in e.value)
-					pruned_mergelist = []
-					for task in mergelist:
-						if isinstance(task, list) and \
-							tuple(task) in unsatisfied_parents:
+
+					graph = mydepgraph.digraph
+					unsatisfied_parents = dict((dep.parent, dep.parent) \
+						for dep in e.value)
+					traversed_nodes = set()
+					unsatisfied_stack = list(unsatisfied_parents)
+					while unsatisfied_stack:
+						pkg = unsatisfied_stack.pop()
+						if pkg in traversed_nodes:
 							continue
-						pruned_mergelist.append(task)
+						traversed_nodes.add(pkg)
+
+						# If this package was pulled in by a parent
+						# package scheduled for merge, removing this
+						# package may cause the the parent package's
+						# dependency to become unsatisfied.
+						for parent_node in graph.parent_nodes(pkg):
+							if not isinstance(parent_node, Package) \
+								or parent_node.operation != "merge":
+								continue
+							unsatisfied = \
+								graph.child_nodes(parent_node,
+								ignore_priority=DepPriority.SOFT)
+							if pkg in unsatisfied:
+								unsatisfied_parents[parent_node] = parent_node
+								unsatisfied_stack.append(parent_node)
+
+					pruned_mergelist = [x for x in mergelist \
+						if isinstance(x, list) and \
+						tuple(x) not in unsatisfied_parents]
+
+					# It shouldn't happen, but if the size of mergelist
+					# does not decrease for some reason then the loop
+					# will be infinite. Therefore, if that case ever
+					# occurs for some reason, raise the exception to
+					# break out of the loop.
 					if not pruned_mergelist or \
 						len(pruned_mergelist) == len(mergelist):
 						raise
 					mergelist[:] = pruned_mergelist
 					dropped_tasks.update(unsatisfied_parents)
-					del e, unsatisfied_parents
+					del e, graph, traversed_nodes, \
+						unsatisfied_parents, unsatisfied_stack
 					continue
 				else:
 					break

-- 
gentoo-commits@g.o mailing list


Navigation:
Lists: gentoo-commits: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
portage r10514 - main/trunk/pym/_emerge
Next by thread:
gentoo-x86 commit in sys-libs/gpm: ChangeLog gpm-1.20.4.ebuild
Previous by date:
portage r10514 - main/trunk/pym/_emerge
Next by date:
gentoo-x86 commit in sys-libs/gpm: ChangeLog gpm-1.20.4.ebuild


Updated Mar 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.