Gentoo Archives: gentoo-commits

From: "Fabian Groffen (grobian)" <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r13744 - in main/branches/prefix/pym: _emerge portage
Date: Tue, 30 Jun 2009 09:24:11
Message-Id: E1MLZZQ-0003EN-RZ@stork.gentoo.org
1 Author: grobian
2 Date: 2009-06-30 09:24:08 +0000 (Tue, 30 Jun 2009)
3 New Revision: 13744
4
5 Modified:
6 main/branches/prefix/pym/_emerge/depgraph.py
7 main/branches/prefix/pym/portage/__init__.py
8 Log:
9 Merged from trunk -r13733:13743
10
11 | 13735 | Move code from bug #258773 to dep_zapdeps, since the parent |
12 | zmedico | always needs to be passed in for atom validation in order to |
13 | | solve bug #275821. |
14
15 | 13736 | Bug #275821 - Make emerge reject !!atom blockers for EAPI 0 |
16 | zmedico | and 1. |
17
18 | 13737 | Bug #275796 - Prefer packages selected for install over |
19 | zmedico | installed packages. This helps automatically solve cases |
20 | | such as the upgrade to the new bluez package which requires |
21 | | uninstallation of the older bluez-libs and bluez-utils |
22 | | packages. Thanks to Sebastian Mingramm (few) |
23 | | <s.mingramm@×××.de> for this patch. |
24
25 | 13738 | Use a finally blocker to ensure _expand_new_virtuals |
26 | zmedico | properly resets eapi state when an exception is raised. |
27
28 | 13739 | Fix virtual blocker code inside _expand_new_virtuals to |
29 | zmedico | correctly handle !!atom blockers. |
30
31 | 13740 | Remove the upgrade selection code inside dep_zapdeps (from |
32 | zmedico | bug #171840 and bug #159360) since the code in |
33 | | depgraph._dep_check_composite_db._visible() from bug #253904 |
34 | | now masks choices that do not match the highest available |
35 | | version in the slot. This means that such undesirable |
36 | | choices automatically go into the dep_zapdeps "other" |
37 | | category. |
38
39 | 13741 | In _expand_new_virtuals, don't expand old-style virtuals |
40 | zmedico | when there is a new-style match. |
41
42 | 13742 | Bug #82488 - In _expand_new_virtuals(), check PROVIDE before |
43 | zmedico | expanding old-style virtuals. |
44
45 | 13743 | Bug #275901 - Make emerge bail out for USE deps in EAPI 0 |
46 | zmedico | and 1. |
47
48
49 Modified: main/branches/prefix/pym/_emerge/depgraph.py
50 ===================================================================
51 --- main/branches/prefix/pym/_emerge/depgraph.py 2009-06-30 09:15:52 UTC (rev 13743)
52 +++ main/branches/prefix/pym/_emerge/depgraph.py 2009-06-30 09:24:08 UTC (rev 13744)
53 @@ -1595,18 +1595,12 @@
54 pkgsettings = self.pkgsettings[root]
55 if trees is None:
56 trees = self._filtered_trees
57 - if not getattr(priority, "buildtime", False):
58 - # The parent should only be passed to dep_check() for buildtime
59 - # dependencies since that's the only case when it's appropriate
60 - # to trigger the circular dependency avoidance code which uses it.
61 - # It's important not to trigger the same circular dependency
62 - # avoidance code for runtime dependencies since it's not needed
63 - # and it can promote an incorrect package choice.
64 - parent = None
65 if True:
66 try:
67 if parent is not None:
68 trees[root]["parent"] = parent
69 + if priority is not None:
70 + trees[root]["priority"] = priority
71 if not strict:
72 portage.dep._dep_check_strict = False
73 mycheck = portage.dep_check(depstring, None,
74 @@ -1615,6 +1609,8 @@
75 finally:
76 if parent is not None:
77 trees[root].pop("parent")
78 + if priority is not None:
79 + trees[root].pop("priority")
80 portage.dep._dep_check_strict = True
81 if not mycheck[0]:
82 raise portage.exception.InvalidDependString(mycheck[1])
83
84 Modified: main/branches/prefix/pym/portage/__init__.py
85 ===================================================================
86 --- main/branches/prefix/pym/portage/__init__.py 2009-06-30 09:15:52 UTC (rev 13743)
87 +++ main/branches/prefix/pym/portage/__init__.py 2009-06-30 09:24:08 UTC (rev 13744)
88 @@ -6901,7 +6901,12 @@
89 # According to GLEP 37, RDEPEND is the only dependency type that is valid
90 # for new-style virtuals. Repoman should enforce this.
91 dep_keys = ["RDEPEND", "DEPEND", "PDEPEND"]
92 - portdb = trees[myroot]["porttree"].dbapi
93 + mytrees = trees[myroot]
94 + portdb = mytrees["porttree"].dbapi
95 + parent = mytrees.get("parent")
96 + eapi = mytrees.get("eapi")
97 + if eapi is None and parent is not None:
98 + eapi = parent.metadata["EAPI"]
99 repoman = not mysettings.local_config
100 if kwargs["use_binaries"]:
101 portdb = trees[myroot]["bintree"].dbapi
102 @@ -6924,6 +6929,15 @@
103 if portage.dep._dep_check_strict:
104 raise portage.exception.ParseError(
105 "invalid atom: '%s'" % x)
106 + else:
107 + if x.blocker and x.blocker.overlap.forbid and \
108 + eapi in ("0", "1") and portage.dep._dep_check_strict:
109 + raise portage.exception.ParseError(
110 + "invalid atom: '%s'" % (x,))
111 + if x.use and eapi in ("0", "1") and \
112 + portage.dep._dep_check_strict:
113 + raise portage.exception.ParseError(
114 + "invalid atom: '%s'" % (x,))
115
116 if repoman and x.use and x.use.conditional:
117 evaluated_atom = portage.dep.remove_slot(x)
118 @@ -6956,7 +6970,8 @@
119 continue
120 match_atom = x
121 if isblocker:
122 - match_atom = x[1:]
123 + match_atom = x.lstrip("!")
124 + isblocker = x[:-len(match_atom)]
125 pkgs = []
126 matches = portdb.match(match_atom)
127 # Use descending order to prefer higher versions.
128 @@ -6973,13 +6988,8 @@
129 # dependency that needs to be satisfied.
130 newsplit.append(x)
131 continue
132 - if not pkgs and len(mychoices) == 1:
133 - newsplit.append(portage.dep.Atom(x.replace(mykey, mychoices[0])))
134 - continue
135 - if isblocker:
136 - a = []
137 - else:
138 - a = ['||']
139 +
140 + a = []
141 for y in pkgs:
142 cpv, pv_split, db = y
143 depstring = " ".join(db.aux_get(cpv, dep_keys))
144 @@ -6993,8 +7003,22 @@
145 if edebug:
146 print "Virtual Parent: ", y[0]
147 print "Virtual Depstring:", depstring
148 - mycheck = dep_check(depstring, mydbapi, mysettings, myroot=myroot,
149 - trees=trees, **pkg_kwargs)
150 +
151 + # Set EAPI used for validation in dep_check() recursion.
152 + virtual_eapi, = db.aux_get(cpv, ["EAPI"])
153 + prev_eapi = mytrees.get("eapi")
154 + mytrees["eapi"] = virtual_eapi
155 +
156 + try:
157 + mycheck = dep_check(depstring, mydbapi, mysettings,
158 + myroot=myroot, trees=trees, **pkg_kwargs)
159 + finally:
160 + # Restore previous EAPI after recursion.
161 + if prev_eapi is not None:
162 + mytrees["eapi"] = prev_eapi
163 + else:
164 + del mytrees["eapi"]
165 +
166 if not mycheck[0]:
167 raise portage.exception.ParseError(
168 "%s: %s '%s'" % (y[0], mycheck[1], depstring))
169 @@ -7004,19 +7028,37 @@
170 if len(virtual_atoms) == 1:
171 # It wouldn't make sense to block all the components of a
172 # compound virtual, so only a single atom block is allowed.
173 - a.append(portage.dep.Atom("!" + virtual_atoms[0]))
174 + a.append(portage.dep.Atom(isblocker + virtual_atoms[0]))
175 else:
176 # pull in the new-style virtual
177 mycheck[1].append(portage.dep.Atom("="+y[0]))
178 a.append(mycheck[1])
179 # Plain old-style virtuals. New-style virtuals are preferred.
180 - for y in mychoices:
181 - a.append(portage.dep.Atom(x.replace(mykey, y, 1)))
182 - if isblocker and not a:
183 - # Probably a compound virtual. Pass the atom through unprocessed.
184 + if not pkgs:
185 + if repoman:
186 + # TODO: Add PROVIDE check for repoman.
187 + for y in mychoices:
188 + a.append(portage.dep.Atom(x.replace(mykey, y, 1)))
189 + else:
190 + for y in mychoices:
191 + new_atom = portage.dep.Atom(x.replace(mykey, y, 1))
192 + matches = portdb.match(new_atom)
193 + # portdb is an instance of depgraph._dep_check_composite_db, so
194 + # USE conditionals are already evaluated.
195 + if matches and mykey in \
196 + portdb.aux_get(matches[-1], ['PROVIDE'])[0].split():
197 + a.append(new_atom)
198 +
199 + if not a:
200 newsplit.append(x)
201 - continue
202 - newsplit.append(a)
203 + elif len(a) == 1:
204 + newsplit.append(a[0])
205 + else:
206 + if isblocker:
207 + newsplit.extend(a)
208 + else:
209 + newsplit.append(['||'] + a)
210 +
211 return newsplit
212
213 def dep_eval(deplist):
214 @@ -7075,14 +7117,15 @@
215 # c) contains masked installed packages
216 # d) is the first item
217
218 - preferred = []
219 - preferred_not_installed = []
220 + preferred_installed = []
221 + preferred_in_graph = []
222 preferred_any_slot = []
223 - possible_upgrades = []
224 + preferred_non_installed = []
225 other = []
226
227 # Alias the trees we'll be checking availability against
228 parent = trees[myroot].get("parent")
229 + priority = trees[myroot].get("priority")
230 graph_db = trees[myroot].get("graph_db")
231 vardb = None
232 if "vartree" in trees[myroot]:
233 @@ -7092,15 +7135,15 @@
234 else:
235 mydbapi = trees[myroot]["porttree"].dbapi
236
237 - # Sort the deps into preferred (installed) and other
238 - # with values of [[required_atom], availablility]
239 + # Sort the deps into installed, not installed but already
240 + # in the graph and other, not installed and not in the graph
241 + # and other, with values of [[required_atom], availablility]
242 for dep, satisfied in izip(deps, satisfieds):
243 if isinstance(dep, list):
244 atoms = dep_zapdeps(dep, satisfied, myroot,
245 use_binaries=use_binaries, trees=trees)
246 else:
247 atoms = [dep]
248 -
249 if not vardb:
250 # called by repoman
251 other.append((atoms, None, False))
252 @@ -7125,8 +7168,8 @@
253 this_choice = (atoms, versions, all_available)
254 if all_available:
255 # The "all installed" criterion is not version or slot specific.
256 - # If any version of a package is installed then we assume that it
257 - # is preferred over other possible packages choices.
258 + # If any version of a package is already in the graph then we
259 + # assume that it is preferred over other possible packages choices.
260 all_installed = True
261 for atom in set([dep_getkey(atom) for atom in atoms \
262 if atom[:1] != "!"]):
263 @@ -7145,7 +7188,7 @@
264 break
265 if all_installed:
266 if all_installed_slots:
267 - preferred.append(this_choice)
268 + preferred_installed.append(this_choice)
269 else:
270 preferred_any_slot.append(this_choice)
271 elif graph_db is None:
272 @@ -7159,12 +7202,14 @@
273 all_in_graph = False
274 break
275 if all_in_graph:
276 - if parent is None:
277 - preferred_not_installed.append(this_choice)
278 - else:
279 + if parent is None or priority is None:
280 + preferred_in_graph.append(this_choice)
281 + elif priority.buildtime:
282 # Check if the atom would result in a direct circular
283 # dependency and try to avoid that if it seems likely
284 - # to be unresolvable.
285 + # to be unresolvable. This is only relevant for
286 + # buildtime deps that aren't already satisfied by an
287 + # installed package.
288 cpv_slot_list = [parent]
289 circular_atom = None
290 for atom in atoms:
291 @@ -7180,60 +7225,17 @@
292 circular_atom = atom
293 break
294 if circular_atom is None:
295 - preferred_not_installed.append(this_choice)
296 + preferred_in_graph.append(this_choice)
297 else:
298 other.append(this_choice)
299 else:
300 - possible_upgrades.append(this_choice)
301 + preferred_non_installed.append(this_choice)
302 else:
303 other.append(this_choice)
304
305 - # Compare the "all_installed" choices against the "all_available" choices
306 - # for possible missed upgrades. The main purpose of this code is to find
307 - # upgrades of new-style virtuals since _expand_new_virtuals() expands them
308 - # into || ( highest version ... lowest version ). We want to prefer the
309 - # highest all_available version of the new-style virtual when there is a
310 - # lower all_installed version.
311 - preferred.extend(preferred_not_installed)
312 - preferred.extend(preferred_any_slot)
313 - preferred.extend(possible_upgrades)
314 - possible_upgrades = preferred[1:]
315 - for possible_upgrade in possible_upgrades:
316 - atoms, versions, all_available = possible_upgrade
317 - myslots = set(versions)
318 - for other_choice in preferred:
319 - if possible_upgrade is other_choice:
320 - # possible_upgrade will not be promoted, so move on
321 - break
322 - o_atoms, o_versions, o_all_available = other_choice
323 - intersecting_slots = myslots.intersection(o_versions)
324 - if not intersecting_slots:
325 - continue
326 - has_upgrade = False
327 - has_downgrade = False
328 - for myslot in intersecting_slots:
329 - myversion = versions[myslot]
330 - o_version = o_versions[myslot]
331 - difference = pkgcmp(catpkgsplit(myversion)[1:],
332 - catpkgsplit(o_version)[1:])
333 - if difference:
334 - if difference > 0:
335 - has_upgrade = True
336 - else:
337 - has_downgrade = True
338 - break
339 - if has_upgrade and not has_downgrade:
340 - preferred.remove(possible_upgrade)
341 - o_index = preferred.index(other_choice)
342 - preferred.insert(o_index, possible_upgrade)
343 - break
344 + preferred = preferred_in_graph + preferred_installed + \
345 + preferred_any_slot + preferred_non_installed + other
346
347 - # preferred now contains a) and c) from the order above with
348 - # the masked flag differentiating the two. other contains b)
349 - # and d) so adding other to preferred will give us a suitable
350 - # list to iterate over.
351 - preferred.extend(other)
352 -
353 for allow_masked in (False, True):
354 for atoms, versions, all_available in preferred:
355 if all_available or allow_masked: