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:
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
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 \