summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-09-14 13:35:01 +0000
committerZac Medico <zmedico@gentoo.org>2009-09-14 13:35:01 +0000
commit7efefdd21c9064190336770944f65a2cb38d02d7 (patch)
treec866eac04b5ee06f49000a00480ac08db347379e
parentdcf62def3baf7c82ec6fad81cb7dc501f8f81566 (diff)
downloadportage-7efefdd21c9064190336770944f65a2cb38d02d7.tar.gz
portage-7efefdd21c9064190336770944f65a2cb38d02d7.tar.bz2
portage-7efefdd21c9064190336770944f65a2cb38d02d7.zip
Add support in depgraph._add_pkg_dep_string() for adding indirect virtual
deps to the graph. This takes advantage of circular dependency avoidance that's done by dep_zapdeps, while avoiding the dependency graph distortion reported in bug #283795. svn path=/main/trunk/; revision=14272
-rw-r--r--pym/_emerge/depgraph.py42
1 files changed, 36 insertions, 6 deletions
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 0acec529a..a50921877 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -1147,11 +1147,6 @@ class depgraph(object):
vardb = self._frozen_config.roots[dep_root].trees["vartree"].dbapi
- # TODO: Write code to add selected indirect virtual deps to
- # the graph. This will take advantage of circular dependency
- # avoidance that's done by dep_zapdeps. For now, only handle
- # direct deps here, since we don't want to distort the
- # dependency graph by mixing indirect deps.
for atom in selected_atoms[pkg]:
try:
@@ -1174,6 +1169,38 @@ class depgraph(object):
if not pkg.installed:
return 0
+ selected_atoms.pop(pkg)
+
+ # Add selected indirect virtual deps to the graph. This
+ # takes advantage of circular dependency avoidance that's done
+ # by dep_zapdeps. We preserve actual parent/child relationships
+ # here in order to avoid distorting the dependency graph like
+ # <=portage-2.1.6.x did.
+ for virt_pkg, atoms in selected_atoms.iteritems():
+
+ # Just assume depth + 1 here for now, though it's not entirely
+ # accurate since multilple levels of indirect virtual deps may
+ # have been traversed. The _add_pkg call will reset the depth to
+ # 0 if this package happens to match an argument.
+ virt_pkg.depth = depth + 1
+ if not self._add_pkg(virt_pkg,
+ Dependency(atom=Atom('=' + virt_pkg.cpv),
+ depth=depth, parent=pkg, priority=dep_priority.copy(),
+ root=dep_root)):
+ return 0
+
+ for atom in atoms:
+ # This is a GLEP 37 virtual, so its deps are all runtime.
+ mypriority = self._priority(runtime=True)
+ if not atom.blocker and vardb.match(atom):
+ mypriority.satisfied = True
+
+ if not self._add_dep(Dependency(atom=atom,
+ blocker=atom.blocker, depth=virt_pkg.depth,
+ parent=virt_pkg, priority=mypriority, root=dep_root),
+ allow_unsatisfied=allow_unsatisfied):
+ return 0
+
if debug:
print "Exiting...", pkg
@@ -1878,8 +1905,11 @@ class depgraph(object):
if node == parent.cpv:
pkg = parent
else:
+ virt_atom = Atom('=' + node)
+ if virt_atom not in chosen_atoms:
+ continue
pkg, existing_node = self._select_package(
- root, Atom('=' + node))
+ root, virt_atom)
if pkg is None:
raise AssertionError(node)
selected_atoms[pkg] = [atom for atom in \