summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-09-14 12:51:31 +0000
committerZac Medico <zmedico@gentoo.org>2009-09-14 12:51:31 +0000
commitdcf62def3baf7c82ec6fad81cb7dc501f8f81566 (patch)
tree41cf3ee255c7289c17279fc9dda7d17502acd67c
parente091f7fbc06a8ada27465e4b37ae6d586ac4ab30 (diff)
downloadportage-dcf62def3baf7c82ec6fad81cb7dc501f8f81566.tar.gz
portage-dcf62def3baf7c82ec6fad81cb7dc501f8f81566.tar.bz2
portage-dcf62def3baf7c82ec6fad81cb7dc501f8f81566.zip
Make depgraph._select_atoms() return a dict, in order to separate selected
direct deps from indirect virtual deps. svn path=/main/trunk/; revision=14271
-rw-r--r--pym/_emerge/depgraph.py47
1 files changed, 30 insertions, 17 deletions
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index f76954fa8..0acec529a 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -12,6 +12,7 @@ from itertools import chain, izip
import portage
from portage import os
from portage import digraph
+from portage.dep import Atom
from portage.output import bold, blue, colorize, create_color_func, darkblue, \
darkgreen, green, nc_len, red, teal, turquoise, yellow
bad = create_color_func("BAD")
@@ -1146,7 +1147,12 @@ class depgraph(object):
vardb = self._frozen_config.roots[dep_root].trees["vartree"].dbapi
- for atom in selected_atoms:
+ # 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:
atom = portage.dep.Atom(atom)
@@ -1780,12 +1786,14 @@ class depgraph(object):
for pkg in greedy_pkgs + [highest_pkg]:
dep_str = " ".join(pkg.metadata[k] for k in blocker_dep_keys)
try:
- atoms = self._select_atoms(
+ selected_atoms = self._select_atoms(
pkg.root, dep_str, pkg.use.enabled,
parent=pkg, strict=True)
except portage.exception.InvalidDependString:
continue
- blocker_atoms = (x for x in atoms if x.blocker)
+ blocker_atoms = []
+ for atoms in selected_atoms.itervalues():
+ blocker_atoms.extend(x for x in atoms if x.blocker)
blockers[pkg] = InternalPackageSet(initial_atoms=blocker_atoms)
if highest_pkg not in blockers:
@@ -1862,17 +1870,21 @@ class depgraph(object):
if parent is None:
selected_atoms = mycheck[1]
else:
- if parent.cpv in atom_graph:
- # 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 return
- # direct deps here, since we don't want to distort the
- # dependency graph by mixing indirect deps.
- direct_deps = set(atom_graph.child_nodes(parent.cpv))
- selected_atoms = [atom for atom in mycheck[1] \
- if atom in direct_deps]
- else:
- selected_atoms = []
+ chosen_atoms = frozenset(mycheck[1])
+ selected_atoms = {parent : []}
+ for node in atom_graph:
+ if isinstance(node, Atom):
+ continue
+ if node == parent.cpv:
+ pkg = parent
+ else:
+ pkg, existing_node = self._select_package(
+ root, Atom('=' + node))
+ if pkg is None:
+ raise AssertionError(node)
+ selected_atoms[pkg] = [atom for atom in \
+ atom_graph.child_nodes(node) if atom in chosen_atoms]
+
return selected_atoms
def _show_unsatisfied_dep(self, root, atom, myparent=None, arg=None):
@@ -3027,9 +3039,10 @@ class depgraph(object):
"'%svar/db/pkg/%s/RDEPEND': %s\n" % \
(running_root, running_portage.cpv, e), noiselevel=-1)
del e
- portage_rdepend = []
- runtime_deps.update(atom for atom in portage_rdepend \
- if not atom.startswith("!"))
+ portage_rdepend = {running_portage : []}
+ for atoms in portage_rdepend.itervalues():
+ runtime_deps.update(atom for atom in atoms \
+ if not atom.blocker)
def gather_deps(ignore_priority, mergeable_nodes,
selected_nodes, node):