summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-04-13 19:57:25 +0000
committerZac Medico <zmedico@gentoo.org>2008-04-13 19:57:25 +0000
commit90526349c485329fc40daf9b8a144a94646b4e06 (patch)
treed3ae285cf6abf0194fd847e1308be9d22358b8d2
parent1008e73d6eaac9496ebbb17a75a13389390e323e (diff)
downloadportage-90526349c485329fc40daf9b8a144a94646b4e06.tar.gz
portage-90526349c485329fc40daf9b8a144a94646b4e06.tar.bz2
portage-90526349c485329fc40daf9b8a144a94646b4e06.zip
Improve lookahead for new-style virtuals:
* Substitue the graph tree for the vartree in dep_check() since we want atom selections to be consistent with package selections have already been made. * Add the selected package to the graph as soon as possible so that later dep_check() calls can use it as feedback for making more consistent atom selections. * Expand all slots of new-style virtuals inside _dep_check_composite_db so that lookahead examines a matched slots. This solves some cases of bug #1343, and extends the fix for bug #141118 to work in cases when a virtual is not yet installed but it has been pulled into the graph. svn path=/main/trunk/; revision=9873
-rw-r--r--pym/_emerge/__init__.py39
1 files changed, 30 insertions, 9 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index f29bdc9a1..13dfa8985 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -1603,7 +1603,11 @@ class depgraph(object):
self._graph_trees[myroot]["vartree"] = self.trees[myroot]["vartree"]
del vardb, fakedb
self._filtered_trees[myroot] = {}
- self._filtered_trees[myroot]["vartree"] = self.trees[myroot]["vartree"]
+ # Substitute the graph tree for the vartree in dep_check() since we
+ # want atom selections to be consistent with package selections
+ # have already been made.
+ self._filtered_trees[myroot]["vartree"] = \
+ self._graph_trees[myroot]["porttree"]
def filtered_tree():
pass
filtered_tree.dbapi = self._dep_check_composite_db(self, myroot)
@@ -2432,8 +2436,17 @@ class depgraph(object):
arg.name in ("system", "world")):
return 0, myfavorites
- self._dep_stack.append(
- Dependency(atom=atom, onlydeps=onlydeps, root=myroot, parent=arg))
+ dep = Dependency(atom=atom, onlydeps=onlydeps,
+ root=myroot, parent=arg)
+ self._dep_stack.append(dep)
+
+ # Add the selected package to the graph as soon as possible
+ # so that later dep_check() calls can use it as feedback
+ # for making more consistent atom selections.
+ if not self._add_pkg(pkg, dep.parent,
+ priority=dep.priority, depth=dep.depth):
+ return 0, myfavorites
+
if not self._create_graph():
if isinstance(arg, SetArg):
sys.stderr.write(("\n\n!!! Problem resolving " + \
@@ -4359,12 +4372,20 @@ class depgraph(object):
slots = set()
slots.add(pkg.metadata["SLOT"])
atom_cp = portage.dep_getkey(atom)
- if atom_cp == pkg.cp:
- graph_db = self._depgraph.mydbapi[self._root]
- for cpv in graph_db.match(atom):
- if portage.cpv_getkey(cpv) != pkg.cp:
- continue
- slots.add(graph_db.aux_get(cpv, ["SLOT"])[0])
+ if pkg.cp.startswith("virtual/"):
+ # For new-style virtual lookahead that occurs inside
+ # dep_check(), examine all slots. This is needed
+ # so that newer slots will not unnecessarily be pulled in
+ # when a satisfying lower slot is already installed. For
+ # example, if virtual/jdk-1.4 is satisfied via kaffe then
+ # there's no need to pull in a newer slot to satisfy a
+ # virtual/jdk dependency.
+ for db, pkg_type, built, installed, db_keys in \
+ self._depgraph._filtered_trees[self._root]["dbs"]:
+ for cpv in db.match(atom):
+ if portage.cpv_getkey(cpv) != pkg.cp:
+ continue
+ slots.add(db.aux_get(cpv, ["SLOT"])[0])
ret = []
if self._visible(pkg):
self._cpv_pkg_map[pkg.cpv] = pkg