Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r9873 - main/trunk/pym/_emerge
Date: Sun, 13 Apr 2008 19:57:29
Message-Id: E1Jl8KM-0001e4-N2@stork.gentoo.org
1 Author: zmedico
2 Date: 2008-04-13 19:57:25 +0000 (Sun, 13 Apr 2008)
3 New Revision: 9873
4
5 Modified:
6 main/trunk/pym/_emerge/__init__.py
7 Log:
8 Improve lookahead for new-style virtuals:
9
10 * Substitue the graph tree for the vartree in dep_check() since we
11 want atom selections to be consistent with package selections
12 have already been made.
13 * Add the selected package to the graph as soon as possible
14 so that later dep_check() calls can use it as feedback
15 for making more consistent atom selections.
16 * Expand all slots of new-style virtuals inside _dep_check_composite_db
17 so that lookahead examines a matched slots.
18
19 This solves some cases of bug #1343, and extends the fix for bug
20 #141118 to work in cases when a virtual is not yet installed but
21 it has been pulled into the graph.
22
23
24 Modified: main/trunk/pym/_emerge/__init__.py
25 ===================================================================
26 --- main/trunk/pym/_emerge/__init__.py 2008-04-13 19:17:34 UTC (rev 9872)
27 +++ main/trunk/pym/_emerge/__init__.py 2008-04-13 19:57:25 UTC (rev 9873)
28 @@ -1603,7 +1603,11 @@
29 self._graph_trees[myroot]["vartree"] = self.trees[myroot]["vartree"]
30 del vardb, fakedb
31 self._filtered_trees[myroot] = {}
32 - self._filtered_trees[myroot]["vartree"] = self.trees[myroot]["vartree"]
33 + # Substitute the graph tree for the vartree in dep_check() since we
34 + # want atom selections to be consistent with package selections
35 + # have already been made.
36 + self._filtered_trees[myroot]["vartree"] = \
37 + self._graph_trees[myroot]["porttree"]
38 def filtered_tree():
39 pass
40 filtered_tree.dbapi = self._dep_check_composite_db(self, myroot)
41 @@ -2432,8 +2436,17 @@
42 arg.name in ("system", "world")):
43 return 0, myfavorites
44
45 - self._dep_stack.append(
46 - Dependency(atom=atom, onlydeps=onlydeps, root=myroot, parent=arg))
47 + dep = Dependency(atom=atom, onlydeps=onlydeps,
48 + root=myroot, parent=arg)
49 + self._dep_stack.append(dep)
50 +
51 + # Add the selected package to the graph as soon as possible
52 + # so that later dep_check() calls can use it as feedback
53 + # for making more consistent atom selections.
54 + if not self._add_pkg(pkg, dep.parent,
55 + priority=dep.priority, depth=dep.depth):
56 + return 0, myfavorites
57 +
58 if not self._create_graph():
59 if isinstance(arg, SetArg):
60 sys.stderr.write(("\n\n!!! Problem resolving " + \
61 @@ -4359,12 +4372,20 @@
62 slots = set()
63 slots.add(pkg.metadata["SLOT"])
64 atom_cp = portage.dep_getkey(atom)
65 - if atom_cp == pkg.cp:
66 - graph_db = self._depgraph.mydbapi[self._root]
67 - for cpv in graph_db.match(atom):
68 - if portage.cpv_getkey(cpv) != pkg.cp:
69 - continue
70 - slots.add(graph_db.aux_get(cpv, ["SLOT"])[0])
71 + if pkg.cp.startswith("virtual/"):
72 + # For new-style virtual lookahead that occurs inside
73 + # dep_check(), examine all slots. This is needed
74 + # so that newer slots will not unnecessarily be pulled in
75 + # when a satisfying lower slot is already installed. For
76 + # example, if virtual/jdk-1.4 is satisfied via kaffe then
77 + # there's no need to pull in a newer slot to satisfy a
78 + # virtual/jdk dependency.
79 + for db, pkg_type, built, installed, db_keys in \
80 + self._depgraph._filtered_trees[self._root]["dbs"]:
81 + for cpv in db.match(atom):
82 + if portage.cpv_getkey(cpv) != pkg.cp:
83 + continue
84 + slots.add(db.aux_get(cpv, ["SLOT"])[0])
85 ret = []
86 if self._visible(pkg):
87 self._cpv_pkg_map[pkg.cpv] = pkg
88
89 --
90 gentoo-commits@l.g.o mailing list