1 |
Author: grobian |
2 |
Date: 2008-10-04 09:59:25 +0000 (Sat, 04 Oct 2008) |
3 |
New Revision: 11620 |
4 |
|
5 |
Modified: |
6 |
main/branches/prefix/pym/_emerge/__init__.py |
7 |
Log: |
8 |
Merged from trunk 11616:11618 |
9 |
|
10 |
| 11617 | Make depgraph._add_pkg() take a Dependency instance. This | |
11 |
| zmedico | provides access to the atom which pulled in the package, | |
12 |
| | which may be needed in order to verify that a different | |
13 |
| | package that's been added to the graph is capable of | |
14 |
| | satisfying the atom. | |
15 |
|
16 |
| 11618 | Fix depgraph._add_pkg() to ensure that the existing package | |
17 |
| zmedico | in the graph matches the required atom in cases when a | |
18 |
| | different package has been passed in. This solves a problem | |
19 |
| | with silently unsatisfied USE deps that was reported by | |
20 |
| | Jorge Manuel B. S. Vicetto <jmbsvicetto@g.o>. Now the | |
21 |
| | unsatisfied dependency will result in a "slot conflict" | |
22 |
| | rather than be silently ignored. | |
23 |
|
24 |
|
25 |
Modified: main/branches/prefix/pym/_emerge/__init__.py |
26 |
=================================================================== |
27 |
--- main/branches/prefix/pym/_emerge/__init__.py 2008-10-04 09:57:18 UTC (rev 11619) |
28 |
+++ main/branches/prefix/pym/_emerge/__init__.py 2008-10-04 09:59:25 UTC (rev 11620) |
29 |
@@ -4458,12 +4458,20 @@ |
30 |
self._ignored_deps.append(dep) |
31 |
return 1 |
32 |
|
33 |
- if not self._add_pkg(dep_pkg, dep.parent, |
34 |
- priority=dep.priority, depth=dep.depth): |
35 |
+ if not self._add_pkg(dep_pkg, dep): |
36 |
return 0 |
37 |
return 1 |
38 |
|
39 |
- def _add_pkg(self, pkg, myparent, priority=None, depth=0): |
40 |
+ def _add_pkg(self, pkg, dep): |
41 |
+ myparent = None |
42 |
+ priority = None |
43 |
+ depth = 0 |
44 |
+ if dep is None: |
45 |
+ dep = Dependency() |
46 |
+ else: |
47 |
+ myparent = dep.parent |
48 |
+ priority = dep.priority |
49 |
+ depth = dep.depth |
50 |
if priority is None: |
51 |
priority = DepPriority() |
52 |
""" |
53 |
@@ -4513,7 +4521,16 @@ |
54 |
existing_node = self._slot_pkg_map[pkg.root].get(pkg.slot_atom) |
55 |
slot_collision = False |
56 |
if existing_node: |
57 |
- if pkg.cpv == existing_node.cpv: |
58 |
+ existing_node_matches = pkg.cpv == existing_node.cpv |
59 |
+ if existing_node_matches and \ |
60 |
+ pkg != existing_node and \ |
61 |
+ dep.atom is not None: |
62 |
+ # Use package set for matching since it will match via |
63 |
+ # PROVIDE when necessary, while match_from_list does not. |
64 |
+ atom_set = InternalPackageSet(initial_atoms=[dep.atom]) |
65 |
+ if not atom_set.findAtomForPackage(existing_node): |
66 |
+ existing_node_matches = False |
67 |
+ if existing_node_matches: |
68 |
# The existing node can be reused. |
69 |
if args: |
70 |
for arg in args: |
71 |
@@ -5056,6 +5073,8 @@ |
72 |
arg = args.pop() |
73 |
for atom in arg.set: |
74 |
self.spinner.update() |
75 |
+ dep = Dependency(atom=atom, onlydeps=onlydeps, |
76 |
+ root=myroot, parent=arg) |
77 |
atom_cp = portage.dep_getkey(atom) |
78 |
try: |
79 |
pprovided = pprovideddict.get(portage.dep_getkey(atom)) |
80 |
@@ -5064,7 +5083,7 @@ |
81 |
self._pprovided_args.append((arg, atom)) |
82 |
continue |
83 |
if isinstance(arg, PackageArg): |
84 |
- if not self._add_pkg(arg.package, arg) or \ |
85 |
+ if not self._add_pkg(arg.package, dep) or \ |
86 |
not self._create_graph(): |
87 |
sys.stderr.write(("\n\n!!! Problem resolving " + \ |
88 |
"dependencies for %s\n") % arg.arg) |
89 |
@@ -5107,14 +5126,10 @@ |
90 |
arg.name in ("system", "world")): |
91 |
return 0, myfavorites |
92 |
|
93 |
- dep = Dependency(atom=atom, onlydeps=onlydeps, |
94 |
- root=myroot, parent=arg) |
95 |
- |
96 |
# Add the selected package to the graph as soon as possible |
97 |
# so that later dep_check() calls can use it as feedback |
98 |
# for making more consistent atom selections. |
99 |
- if not self._add_pkg(pkg, dep.parent, |
100 |
- priority=dep.priority, depth=dep.depth): |
101 |
+ if not self._add_pkg(pkg, dep): |
102 |
if isinstance(arg, SetArg): |
103 |
sys.stderr.write(("\n\n!!! Problem resolving " + \ |
104 |
"dependencies for %s from %s\n") % \ |
105 |
@@ -5727,8 +5742,7 @@ |
106 |
# will be appropriately reported as a slot collision |
107 |
# (possibly solvable via backtracking). |
108 |
pkg = matches[-1] # highest match |
109 |
- if not self._add_pkg(pkg, dep.parent, |
110 |
- priority=dep.priority, depth=dep.depth): |
111 |
+ if not self._add_pkg(pkg, dep): |
112 |
return 0 |
113 |
if not self._create_graph(allow_unsatisfied=True): |
114 |
return 0 |
115 |
@@ -7777,7 +7791,8 @@ |
116 |
arg.root_config.root, atom) |
117 |
if existing_node is None and \ |
118 |
pkg is not None: |
119 |
- if not self._add_pkg(pkg, arg): |
120 |
+ if not self._add_pkg(pkg, Dependency(atom=atom, |
121 |
+ root=pkg.root, parent=arg)): |
122 |
return False |
123 |
|
124 |
# Allow unsatisfied deps here to avoid showing a masking |
125 |
@@ -12491,8 +12506,9 @@ |
126 |
for consumer_dblink in set(chain(*consumers.values())): |
127 |
consumer_pkg = vardb.get(("installed", myroot, |
128 |
consumer_dblink.mycpv, "nomerge")) |
129 |
- resolver._add_pkg(pkg, consumer_pkg, |
130 |
- priority=UnmergeDepPriority(runtime=True)) |
131 |
+ resolver._add_pkg(pkg, Dependency(parent=consumer_pkg, |
132 |
+ priority=UnmergeDepPriority(runtime=True), |
133 |
+ root=pkg.root)) |
134 |
|
135 |
writemsg_level("\nCalculating dependencies ") |
136 |
success = resolver._complete_graph() |