1 |
Author: zmedico |
2 |
Date: 2009-06-30 22:06:20 +0000 (Tue, 30 Jun 2009) |
3 |
New Revision: 13747 |
4 |
|
5 |
Modified: |
6 |
main/trunk/pym/_emerge/depgraph.py |
7 |
Log: |
8 |
Bug #275217 - Part 4 - Move all member variables of _emerge.depgraph into |
9 |
frozen_config or dynamic_config. Thanks to Sebastian Mingramm (few) |
10 |
<s.mingramm@×××.de> for this patch. |
11 |
|
12 |
|
13 |
Modified: main/trunk/pym/_emerge/depgraph.py |
14 |
=================================================================== |
15 |
--- main/trunk/pym/_emerge/depgraph.py 2009-06-30 21:46:22 UTC (rev 13746) |
16 |
+++ main/trunk/pym/_emerge/depgraph.py 2009-06-30 22:06:20 UTC (rev 13747) |
17 |
@@ -52,17 +52,12 @@ |
18 |
from _emerge.UnmergeDepPriority import UnmergeDepPriority |
19 |
from _emerge.visible import visible |
20 |
|
21 |
-class depgraph(object): |
22 |
+class _frozen_depgraph_config(object): |
23 |
|
24 |
- pkg_tree_map = RootConfig.pkg_tree_map |
25 |
- |
26 |
- _dep_keys = ["DEPEND", "RDEPEND", "PDEPEND"] |
27 |
- |
28 |
- def __init__(self, settings, trees, myopts, myparams, spinner): |
29 |
+ def __init__(self, settings, trees, myopts, spinner, dynamic_config, depgraph): |
30 |
self.settings = settings |
31 |
self.target_root = settings["ROOT"] |
32 |
self.myopts = myopts |
33 |
- self.myparams = myparams |
34 |
self.edebug = 0 |
35 |
if settings.get("PORTAGE_DEBUG", "") == "1": |
36 |
self.edebug = 1 |
37 |
@@ -71,22 +66,12 @@ |
38 |
self._opts_no_restart = frozenset(["--buildpkgonly", |
39 |
"--fetchonly", "--fetch-all-uri", "--pretend"]) |
40 |
self.pkgsettings = {} |
41 |
- # Maps slot atom to package for each Package added to the graph. |
42 |
- self._slot_pkg_map = {} |
43 |
- # Maps nodes to the reasons they were selected for reinstallation. |
44 |
- self._reinstall_nodes = {} |
45 |
- self.mydbapi = {} |
46 |
self.trees = {} |
47 |
self._trees_orig = trees |
48 |
self.roots = {} |
49 |
- # Contains a filtered view of preferred packages that are selected |
50 |
- # from available repositories. |
51 |
- self._filtered_trees = {} |
52 |
# Contains installed packages and new packages that have been added |
53 |
# to the graph. |
54 |
self._graph_trees = {} |
55 |
- # All Package instances |
56 |
- self._pkg_cache = {} |
57 |
for myroot in trees: |
58 |
self.trees[myroot] = {} |
59 |
# Create a RootConfig instance that references |
60 |
@@ -99,10 +84,10 @@ |
61 |
self.trees[myroot][tree] = trees[myroot][tree] |
62 |
self.trees[myroot]["vartree"] = \ |
63 |
FakeVartree(trees[myroot]["root_config"], |
64 |
- pkg_cache=self._pkg_cache) |
65 |
+ pkg_cache=dynamic_config._pkg_cache) |
66 |
self.pkgsettings[myroot] = portage.config( |
67 |
clone=self.trees[myroot]["vartree"].settings) |
68 |
- self._slot_pkg_map[myroot] = {} |
69 |
+ dynamic_config._slot_pkg_map[myroot] = {} |
70 |
vardb = self.trees[myroot]["vartree"].dbapi |
71 |
preload_installed_pkgs = "--nodeps" not in self.myopts and \ |
72 |
"--buildpkgonly" not in self.myopts |
73 |
@@ -123,12 +108,12 @@ |
74 |
trees[myroot]["vartree"].dbapi._clear_cache() |
75 |
gc.collect() |
76 |
|
77 |
- self.mydbapi[myroot] = fakedb |
78 |
+ dynamic_config.mydbapi[myroot] = fakedb |
79 |
def graph_tree(): |
80 |
pass |
81 |
graph_tree.dbapi = fakedb |
82 |
self._graph_trees[myroot] = {} |
83 |
- self._filtered_trees[myroot] = {} |
84 |
+ dynamic_config._filtered_trees[myroot] = {} |
85 |
# Substitute the graph tree for the vartree in dep_check() since we |
86 |
# want atom selections to be consistent with package selections |
87 |
# have already been made. |
88 |
@@ -136,8 +121,8 @@ |
89 |
self._graph_trees[myroot]["vartree"] = graph_tree |
90 |
def filtered_tree(): |
91 |
pass |
92 |
- filtered_tree.dbapi = self._dep_check_composite_db(self, myroot) |
93 |
- self._filtered_trees[myroot]["porttree"] = filtered_tree |
94 |
+ filtered_tree.dbapi = _dep_check_composite_db(depgraph, myroot) |
95 |
+ dynamic_config._filtered_trees[myroot]["porttree"] = filtered_tree |
96 |
|
97 |
# Passing in graph_tree as the vartree here could lead to better |
98 |
# atom selections in some cases by causing atoms for packages that |
99 |
@@ -155,8 +140,8 @@ |
100 |
# the parent package into self._select_atoms() calls so that |
101 |
# unresolvable direct circular dependencies can be detected and |
102 |
# avoided when possible. |
103 |
- self._filtered_trees[myroot]["graph_db"] = graph_tree.dbapi |
104 |
- self._filtered_trees[myroot]["vartree"] = self.trees[myroot]["vartree"] |
105 |
+ dynamic_config._filtered_trees[myroot]["graph_db"] = graph_tree.dbapi |
106 |
+ dynamic_config._filtered_trees[myroot]["vartree"] = self.trees[myroot]["vartree"] |
107 |
|
108 |
dbs = [] |
109 |
portdb = self.trees[myroot]["porttree"].dbapi |
110 |
@@ -171,16 +156,32 @@ |
111 |
dbs.append((bindb, "binary", True, False, db_keys)) |
112 |
db_keys = list(trees[myroot]["vartree"].dbapi._aux_cache_keys) |
113 |
dbs.append((vardb, "installed", True, True, db_keys)) |
114 |
- self._filtered_trees[myroot]["dbs"] = dbs |
115 |
+ dynamic_config._filtered_trees[myroot]["dbs"] = dbs |
116 |
if "--usepkg" in self.myopts: |
117 |
self.trees[myroot]["bintree"].populate( |
118 |
"--getbinpkg" in self.myopts, |
119 |
"--getbinpkgonly" in self.myopts) |
120 |
del trees |
121 |
|
122 |
+ self._required_set_names = set(["system", "world"]) |
123 |
+ |
124 |
+class _dynamic_depgraph_config(object): |
125 |
+ |
126 |
+ def __init__(self, myparams): |
127 |
+ self.myparams = myparams |
128 |
+ # Maps slot atom to package for each Package added to the graph. |
129 |
+ self._slot_pkg_map = {} |
130 |
+ # Maps nodes to the reasons they were selected for reinstallation. |
131 |
+ self._reinstall_nodes = {} |
132 |
+ self.mydbapi = {} |
133 |
+ # Contains a filtered view of preferred packages that are selected |
134 |
+ # from available repositories. |
135 |
+ self._filtered_trees = {} |
136 |
+ # All Package instances |
137 |
+ self._pkg_cache = {} |
138 |
#contains the args created by select_files |
139 |
self._initial_arg_list = [] |
140 |
- self.digraph=portage.digraph() |
141 |
+ self.digraph = portage.digraph() |
142 |
# contains all sets added to the graph |
143 |
self._sets = {} |
144 |
# contains atoms given as arguments |
145 |
@@ -225,10 +226,22 @@ |
146 |
self._unsatisfied_deps = [] |
147 |
self._initially_unsatisfied_deps = [] |
148 |
self._ignored_deps = [] |
149 |
- self._required_set_names = set(["system", "world"]) |
150 |
+ self._highest_pkg_cache = {} |
151 |
+ |
152 |
+ |
153 |
+class depgraph(object): |
154 |
+ |
155 |
+ pkg_tree_map = RootConfig.pkg_tree_map |
156 |
+ |
157 |
+ _dep_keys = ["DEPEND", "RDEPEND", "PDEPEND"] |
158 |
+ |
159 |
+ def __init__(self, settings, trees, myopts, myparams, spinner): |
160 |
+ self._dynamic_config = _dynamic_depgraph_config(myparams) |
161 |
+ self._frozen_config = _frozen_depgraph_config(settings, trees, \ |
162 |
+ myopts, spinner, self._dynamic_config, self) |
163 |
+ |
164 |
self._select_atoms = self._select_atoms_highest_available |
165 |
self._select_package = self._select_pkg_highest_available |
166 |
- self._highest_pkg_cache = {} |
167 |
|
168 |
def _show_slot_collision_notice(self): |
169 |
"""Show an informational message advising the user to mask one of the |
170 |
@@ -238,7 +251,7 @@ |
171 |
cases. |
172 |
""" |
173 |
|
174 |
- if not self._slot_collision_info: |
175 |
+ if not self._dynamic_config._slot_collision_info: |
176 |
return |
177 |
|
178 |
self._show_merge_list() |
179 |
@@ -254,21 +267,21 @@ |
180 |
explanation_columns = 70 |
181 |
explanations = 0 |
182 |
for (slot_atom, root), slot_nodes \ |
183 |
- in self._slot_collision_info.iteritems(): |
184 |
+ in self._dynamic_config._slot_collision_info.iteritems(): |
185 |
msg.append(str(slot_atom)) |
186 |
msg.append("\n\n") |
187 |
|
188 |
for node in slot_nodes: |
189 |
msg.append(indent) |
190 |
msg.append(str(node)) |
191 |
- parent_atoms = self._parent_atoms.get(node) |
192 |
+ parent_atoms = self._dynamic_config._parent_atoms.get(node) |
193 |
if parent_atoms: |
194 |
pruned_list = set() |
195 |
# Prefer conflict atoms over others. |
196 |
for parent_atom in parent_atoms: |
197 |
if len(pruned_list) >= max_parents: |
198 |
break |
199 |
- if parent_atom in self._slot_conflict_parent_atoms: |
200 |
+ if parent_atom in self._dynamic_config._slot_conflict_parent_atoms: |
201 |
pruned_list.add(parent_atom) |
202 |
|
203 |
# If this package was pulled in by conflict atoms then |
204 |
@@ -290,7 +303,7 @@ |
205 |
parent, atom = parent_atom |
206 |
if isinstance(parent, Package) and \ |
207 |
(parent.slot_atom, parent.root) \ |
208 |
- in self._slot_collision_info: |
209 |
+ in self._dynamic_config._slot_collision_info: |
210 |
pruned_list.add(parent_atom) |
211 |
for parent_atom in parent_atoms: |
212 |
if len(pruned_list) >= max_parents: |
213 |
@@ -329,9 +342,9 @@ |
214 |
sys.stderr.write("".join(msg)) |
215 |
sys.stderr.flush() |
216 |
|
217 |
- explanations_for_all = explanations == len(self._slot_collision_info) |
218 |
+ explanations_for_all = explanations == len(self._dynamic_config._slot_collision_info) |
219 |
|
220 |
- if explanations_for_all or "--quiet" in self.myopts: |
221 |
+ if explanations_for_all or "--quiet" in self._frozen_config.myopts: |
222 |
return |
223 |
|
224 |
msg = [] |
225 |
@@ -385,12 +398,12 @@ |
226 |
# conflicts between two packages. |
227 |
return None |
228 |
|
229 |
- all_conflict_atoms = self._slot_conflict_parent_atoms |
230 |
+ all_conflict_atoms = self._dynamic_config._slot_conflict_parent_atoms |
231 |
matched_node = None |
232 |
matched_atoms = None |
233 |
unmatched_node = None |
234 |
for node in slot_nodes: |
235 |
- parent_atoms = self._parent_atoms.get(node) |
236 |
+ parent_atoms = self._dynamic_config._parent_atoms.get(node) |
237 |
if not parent_atoms: |
238 |
# Normally, there are always parent atoms. If there are |
239 |
# none then something unexpected is happening and there's |
240 |
@@ -456,20 +469,20 @@ |
241 |
packages that have been pulled into a given slot. |
242 |
""" |
243 |
for (slot_atom, root), slot_nodes \ |
244 |
- in self._slot_collision_info.iteritems(): |
245 |
+ in self._dynamic_config._slot_collision_info.iteritems(): |
246 |
|
247 |
all_parent_atoms = set() |
248 |
for pkg in slot_nodes: |
249 |
- parent_atoms = self._parent_atoms.get(pkg) |
250 |
+ parent_atoms = self._dynamic_config._parent_atoms.get(pkg) |
251 |
if not parent_atoms: |
252 |
continue |
253 |
all_parent_atoms.update(parent_atoms) |
254 |
|
255 |
for pkg in slot_nodes: |
256 |
- parent_atoms = self._parent_atoms.get(pkg) |
257 |
+ parent_atoms = self._dynamic_config._parent_atoms.get(pkg) |
258 |
if parent_atoms is None: |
259 |
parent_atoms = set() |
260 |
- self._parent_atoms[pkg] = parent_atoms |
261 |
+ self._dynamic_config._parent_atoms[pkg] = parent_atoms |
262 |
for parent_atom in all_parent_atoms: |
263 |
if parent_atom in parent_atoms: |
264 |
continue |
265 |
@@ -481,20 +494,20 @@ |
266 |
if atom_set.findAtomForPackage(pkg): |
267 |
parent_atoms.add(parent_atom) |
268 |
else: |
269 |
- self._slot_conflict_parent_atoms.add(parent_atom) |
270 |
+ self._dynamic_config._slot_conflict_parent_atoms.add(parent_atom) |
271 |
|
272 |
def _reinstall_for_flags(self, forced_flags, |
273 |
orig_use, orig_iuse, cur_use, cur_iuse): |
274 |
"""Return a set of flags that trigger reinstallation, or None if there |
275 |
are no such flags.""" |
276 |
- if "--newuse" in self.myopts: |
277 |
+ if "--newuse" in self._frozen_config.myopts: |
278 |
flags = set(orig_iuse.symmetric_difference( |
279 |
cur_iuse).difference(forced_flags)) |
280 |
flags.update(orig_iuse.intersection(orig_use).symmetric_difference( |
281 |
cur_iuse.intersection(cur_use))) |
282 |
if flags: |
283 |
return flags |
284 |
- elif "changed-use" == self.myopts.get("--reinstall"): |
285 |
+ elif "changed-use" == self._frozen_config.myopts.get("--reinstall"): |
286 |
flags = orig_iuse.intersection(orig_use).symmetric_difference( |
287 |
cur_iuse.intersection(cur_use)) |
288 |
if flags: |
289 |
@@ -502,10 +515,10 @@ |
290 |
return None |
291 |
|
292 |
def _create_graph(self, allow_unsatisfied=False): |
293 |
- dep_stack = self._dep_stack |
294 |
- dep_disjunctive_stack = self._dep_disjunctive_stack |
295 |
+ dep_stack = self._dynamic_config._dep_stack |
296 |
+ dep_disjunctive_stack = self._dynamic_config._dep_disjunctive_stack |
297 |
while dep_stack or dep_disjunctive_stack: |
298 |
- self.spinner.update() |
299 |
+ self._frozen_config.spinner.update() |
300 |
while dep_stack: |
301 |
dep = dep_stack.pop() |
302 |
if isinstance(dep, Package): |
303 |
@@ -521,16 +534,16 @@ |
304 |
return 1 |
305 |
|
306 |
def _add_dep(self, dep, allow_unsatisfied=False): |
307 |
- debug = "--debug" in self.myopts |
308 |
- buildpkgonly = "--buildpkgonly" in self.myopts |
309 |
- nodeps = "--nodeps" in self.myopts |
310 |
- empty = "empty" in self.myparams |
311 |
- deep = "deep" in self.myparams |
312 |
- update = "--update" in self.myopts and dep.depth <= 1 |
313 |
+ debug = "--debug" in self._frozen_config.myopts |
314 |
+ buildpkgonly = "--buildpkgonly" in self._frozen_config.myopts |
315 |
+ nodeps = "--nodeps" in self._frozen_config.myopts |
316 |
+ empty = "empty" in self._dynamic_config.myparams |
317 |
+ deep = "deep" in self._dynamic_config.myparams |
318 |
+ update = "--update" in self._frozen_config.myopts and dep.depth <= 1 |
319 |
if dep.blocker: |
320 |
if not buildpkgonly and \ |
321 |
not nodeps and \ |
322 |
- dep.parent not in self._slot_collision_nodes: |
323 |
+ dep.parent not in self._dynamic_config._slot_collision_nodes: |
324 |
if dep.parent.onlydeps: |
325 |
# It's safe to ignore blockers if the |
326 |
# parent is an --onlydeps node. |
327 |
@@ -540,7 +553,7 @@ |
328 |
blocker = Blocker(atom=dep.atom, |
329 |
eapi=dep.parent.metadata["EAPI"], |
330 |
root=dep.parent.root) |
331 |
- self._blocker_parents.add(blocker, dep.parent) |
332 |
+ self._dynamic_config._blocker_parents.add(blocker, dep.parent) |
333 |
return 1 |
334 |
dep_pkg, existing_node = self._select_package(dep.root, dep.atom, |
335 |
onlydeps=dep.onlydeps) |
336 |
@@ -550,9 +563,9 @@ |
337 |
# pulled in by --with-bdeps=y. |
338 |
return 1 |
339 |
if allow_unsatisfied: |
340 |
- self._unsatisfied_deps.append(dep) |
341 |
+ self._dynamic_config._unsatisfied_deps.append(dep) |
342 |
return 1 |
343 |
- self._unsatisfied_deps_for_display.append( |
344 |
+ self._dynamic_config._unsatisfied_deps_for_display.append( |
345 |
((dep.root, dep.atom), {"myparent":dep.parent})) |
346 |
return 0 |
347 |
# In some cases, dep_check will return deps that shouldn't |
348 |
@@ -564,7 +577,7 @@ |
349 |
not dep_pkg.installed and \ |
350 |
not (existing_node or empty or deep or update): |
351 |
myarg = None |
352 |
- if dep.root == self.target_root: |
353 |
+ if dep.root == self._frozen_config.target_root: |
354 |
try: |
355 |
myarg = self._iter_atoms_for_pkg(dep_pkg).next() |
356 |
except StopIteration: |
357 |
@@ -575,7 +588,7 @@ |
358 |
# should have been masked. |
359 |
raise |
360 |
if not myarg: |
361 |
- self._ignored_deps.append(dep) |
362 |
+ self._dynamic_config._ignored_deps.append(dep) |
363 |
return 1 |
364 |
|
365 |
if not self._add_pkg(dep_pkg, dep): |
366 |
@@ -607,11 +620,11 @@ |
367 |
""" |
368 |
# Ensure that the dependencies of the same package |
369 |
# are never processed more than once. |
370 |
- previously_added = pkg in self.digraph |
371 |
+ previously_added = pkg in self._dynamic_config.digraph |
372 |
|
373 |
# select the correct /var database that we'll be checking against |
374 |
- vardbapi = self.trees[pkg.root]["vartree"].dbapi |
375 |
- pkgsettings = self.pkgsettings[pkg.root] |
376 |
+ vardbapi = self._frozen_config.trees[pkg.root]["vartree"].dbapi |
377 |
+ pkgsettings = self._frozen_config.pkgsettings[pkg.root] |
378 |
|
379 |
arg_atoms = None |
380 |
if True: |
381 |
@@ -626,7 +639,7 @@ |
382 |
|
383 |
if not pkg.onlydeps: |
384 |
if not pkg.installed and \ |
385 |
- "empty" not in self.myparams and \ |
386 |
+ "empty" not in self._dynamic_config.myparams and \ |
387 |
vardbapi.match(pkg.slot_atom): |
388 |
# Increase the priority of dependencies on packages that |
389 |
# are being rebuilt. This optimizes merge order so that |
390 |
@@ -638,7 +651,7 @@ |
391 |
# are being merged in that case. |
392 |
priority.rebuild = True |
393 |
|
394 |
- existing_node = self._slot_pkg_map[pkg.root].get(pkg.slot_atom) |
395 |
+ existing_node = self._dynamic_config._slot_pkg_map[pkg.root].get(pkg.slot_atom) |
396 |
slot_collision = False |
397 |
if existing_node: |
398 |
existing_node_matches = pkg.cpv == existing_node.cpv |
399 |
@@ -655,7 +668,7 @@ |
400 |
if arg_atoms: |
401 |
for parent_atom in arg_atoms: |
402 |
parent, atom = parent_atom |
403 |
- self.digraph.add(existing_node, parent, |
404 |
+ self._dynamic_config.digraph.add(existing_node, parent, |
405 |
priority=priority) |
406 |
self._add_parent_atom(existing_node, parent_atom) |
407 |
# If a direct circular dependency is not an unsatisfied |
408 |
@@ -664,7 +677,7 @@ |
409 |
# way. |
410 |
if existing_node != myparent or \ |
411 |
(priority.buildtime and not priority.satisfied): |
412 |
- self.digraph.addnode(existing_node, myparent, |
413 |
+ self._dynamic_config.digraph.addnode(existing_node, myparent, |
414 |
priority=priority) |
415 |
if dep.atom is not None and dep.parent is not None: |
416 |
self._add_parent_atom(existing_node, |
417 |
@@ -684,16 +697,16 @@ |
418 |
# only being partially added to the graph. It must not be |
419 |
# allowed to interfere with the other nodes that have been |
420 |
# added. Do not overwrite data for existing nodes in |
421 |
- # self.mydbapi since that data will be used for blocker |
422 |
+ # self._dynamic_config.mydbapi since that data will be used for blocker |
423 |
# validation. |
424 |
# Even though the graph is now invalid, continue to process |
425 |
# dependencies so that things like --fetchonly can still |
426 |
# function despite collisions. |
427 |
pass |
428 |
elif not previously_added: |
429 |
- self._slot_pkg_map[pkg.root][pkg.slot_atom] = pkg |
430 |
- self.mydbapi[pkg.root].cpv_inject(pkg) |
431 |
- self._filtered_trees[pkg.root]["porttree"].dbapi._clear_cache() |
432 |
+ self._dynamic_config._slot_pkg_map[pkg.root][pkg.slot_atom] = pkg |
433 |
+ self._dynamic_config.mydbapi[pkg.root].cpv_inject(pkg) |
434 |
+ self._dynamic_config._filtered_trees[pkg.root]["porttree"].dbapi._clear_cache() |
435 |
|
436 |
if not pkg.installed: |
437 |
# Allow this package to satisfy old-style virtuals in case it |
438 |
@@ -702,7 +715,7 @@ |
439 |
try: |
440 |
pkgsettings.setinst(pkg.cpv, pkg.metadata) |
441 |
# For consistency, also update the global virtuals. |
442 |
- settings = self.roots[pkg.root].settings |
443 |
+ settings = self._frozen_config.roots[pkg.root].settings |
444 |
settings.unlock() |
445 |
settings.setinst(pkg.cpv, pkg.metadata) |
446 |
settings.lock() |
447 |
@@ -713,19 +726,19 @@ |
448 |
return 0 |
449 |
|
450 |
if arg_atoms: |
451 |
- self._set_nodes.add(pkg) |
452 |
+ self._dynamic_config._set_nodes.add(pkg) |
453 |
|
454 |
# Do this even when addme is False (--onlydeps) so that the |
455 |
# parent/child relationship is always known in case |
456 |
# self._show_slot_collision_notice() needs to be called later. |
457 |
- self.digraph.add(pkg, myparent, priority=priority) |
458 |
+ self._dynamic_config.digraph.add(pkg, myparent, priority=priority) |
459 |
if dep.atom is not None and dep.parent is not None: |
460 |
self._add_parent_atom(pkg, (dep.parent, dep.atom)) |
461 |
|
462 |
if arg_atoms: |
463 |
for parent_atom in arg_atoms: |
464 |
parent, atom = parent_atom |
465 |
- self.digraph.add(pkg, parent, priority=priority) |
466 |
+ self._dynamic_config.digraph.add(pkg, parent, priority=priority) |
467 |
self._add_parent_atom(pkg, parent_atom) |
468 |
|
469 |
""" This section determines whether we go deeper into dependencies or not. |
470 |
@@ -734,14 +747,14 @@ |
471 |
emerge --deep <pkgspec>; we need to recursively check dependencies of pkgspec |
472 |
If we are in --nodeps (no recursion) mode, we obviously only check 1 level of dependencies. |
473 |
""" |
474 |
- dep_stack = self._dep_stack |
475 |
- if "recurse" not in self.myparams: |
476 |
+ dep_stack = self._dynamic_config._dep_stack |
477 |
+ if "recurse" not in self._dynamic_config.myparams: |
478 |
return 1 |
479 |
elif pkg.installed and \ |
480 |
- "deep" not in self.myparams: |
481 |
- dep_stack = self._ignored_deps |
482 |
+ "deep" not in self._dynamic_config.myparams: |
483 |
+ dep_stack = self._dynamic_config._ignored_deps |
484 |
|
485 |
- self.spinner.update() |
486 |
+ self._frozen_config.spinner.update() |
487 |
|
488 |
if arg_atoms: |
489 |
depth = 0 |
490 |
@@ -751,20 +764,20 @@ |
491 |
return 1 |
492 |
|
493 |
def _add_parent_atom(self, pkg, parent_atom): |
494 |
- parent_atoms = self._parent_atoms.get(pkg) |
495 |
+ parent_atoms = self._dynamic_config._parent_atoms.get(pkg) |
496 |
if parent_atoms is None: |
497 |
parent_atoms = set() |
498 |
- self._parent_atoms[pkg] = parent_atoms |
499 |
+ self._dynamic_config._parent_atoms[pkg] = parent_atoms |
500 |
parent_atoms.add(parent_atom) |
501 |
|
502 |
def _add_slot_conflict(self, pkg): |
503 |
- self._slot_collision_nodes.add(pkg) |
504 |
+ self._dynamic_config._slot_collision_nodes.add(pkg) |
505 |
slot_key = (pkg.slot_atom, pkg.root) |
506 |
- slot_nodes = self._slot_collision_info.get(slot_key) |
507 |
+ slot_nodes = self._dynamic_config._slot_collision_info.get(slot_key) |
508 |
if slot_nodes is None: |
509 |
slot_nodes = set() |
510 |
- slot_nodes.add(self._slot_pkg_map[pkg.root][pkg.slot_atom]) |
511 |
- self._slot_collision_info[slot_key] = slot_nodes |
512 |
+ slot_nodes.add(self._dynamic_config._slot_pkg_map[pkg.root][pkg.slot_atom]) |
513 |
+ self._dynamic_config._slot_collision_info[slot_key] = slot_nodes |
514 |
slot_nodes.add(pkg) |
515 |
|
516 |
def _add_pkg_deps(self, pkg, allow_unsatisfied=False): |
517 |
@@ -776,7 +789,7 @@ |
518 |
myuse = pkg.use.enabled |
519 |
jbigkey = pkg |
520 |
depth = pkg.depth + 1 |
521 |
- removal_action = "remove" in self.myparams |
522 |
+ removal_action = "remove" in self._dynamic_config.myparams |
523 |
|
524 |
edepend={} |
525 |
depkeys = ["DEPEND","RDEPEND","PDEPEND"] |
526 |
@@ -784,15 +797,15 @@ |
527 |
edepend[k] = metadata[k] |
528 |
|
529 |
if not pkg.built and \ |
530 |
- "--buildpkgonly" in self.myopts and \ |
531 |
- "deep" not in self.myparams and \ |
532 |
- "empty" not in self.myparams: |
533 |
+ "--buildpkgonly" in self._frozen_config.myopts and \ |
534 |
+ "deep" not in self._dynamic_config.myparams and \ |
535 |
+ "empty" not in self._dynamic_config.myparams: |
536 |
edepend["RDEPEND"] = "" |
537 |
edepend["PDEPEND"] = "" |
538 |
bdeps_optional = False |
539 |
|
540 |
if pkg.built and not removal_action: |
541 |
- if self.myopts.get("--with-bdeps", "n") == "y": |
542 |
+ if self._frozen_config.myopts.get("--with-bdeps", "n") == "y": |
543 |
# Pull in build time deps as requested, but marked them as |
544 |
# "optional" since they are not strictly required. This allows |
545 |
# more freedom in the merge order calculation for solving |
546 |
@@ -805,11 +818,11 @@ |
547 |
# built packages do not have build time dependencies. |
548 |
edepend["DEPEND"] = "" |
549 |
|
550 |
- if removal_action and self.myopts.get("--with-bdeps", "y") == "n": |
551 |
+ if removal_action and self._frozen_config.myopts.get("--with-bdeps", "y") == "n": |
552 |
edepend["DEPEND"] = "" |
553 |
|
554 |
bdeps_root = "/" |
555 |
- root_deps = self.myopts.get("--root-deps") |
556 |
+ root_deps = self._frozen_config.myopts.get("--root-deps") |
557 |
if root_deps is not None: |
558 |
if root_deps is True: |
559 |
bdeps_root = myroot |
560 |
@@ -824,7 +837,7 @@ |
561 |
(myroot, edepend["PDEPEND"], self._priority(runtime_post=True)) |
562 |
) |
563 |
|
564 |
- debug = "--debug" in self.myopts |
565 |
+ debug = "--debug" in self._frozen_config.myopts |
566 |
strict = mytype != "installed" |
567 |
try: |
568 |
if not strict: |
569 |
@@ -878,7 +891,7 @@ |
570 |
"!!! This binary package cannot be installed: '%s'\n" % \ |
571 |
mykey, noiselevel=-1) |
572 |
elif mytype == "ebuild": |
573 |
- portdb = self.roots[myroot].trees["porttree"].dbapi |
574 |
+ portdb = self._frozen_config.roots[myroot].trees["porttree"].dbapi |
575 |
myebuild, mylocation = portdb.findname2(mykey) |
576 |
portage.writemsg("!!! This ebuild cannot be installed: " + \ |
577 |
"'%s'\n" % myebuild, noiselevel=-1) |
578 |
@@ -892,7 +905,7 @@ |
579 |
def _add_pkg_dep_string(self, pkg, dep_root, dep_priority, dep_string, |
580 |
allow_unsatisfied): |
581 |
depth = pkg.depth + 1 |
582 |
- debug = "--debug" in self.myopts |
583 |
+ debug = "--debug" in self._frozen_config.myopts |
584 |
strict = pkg.type_name != "installed" |
585 |
|
586 |
if debug: |
587 |
@@ -915,7 +928,7 @@ |
588 |
if debug: |
589 |
print "Candidates:", selected_atoms |
590 |
|
591 |
- vardb = self.roots[dep_root].trees["vartree"].dbapi |
592 |
+ vardb = self._frozen_config.roots[dep_root].trees["vartree"].dbapi |
593 |
|
594 |
for atom in selected_atoms: |
595 |
try: |
596 |
@@ -946,7 +959,7 @@ |
597 |
|
598 |
def _queue_disjunctive_deps(self, pkg, dep_root, dep_priority, dep_struct): |
599 |
""" |
600 |
- Queue disjunctive (virtual and ||) deps in self._dep_disjunctive_stack. |
601 |
+ Queue disjunctive (virtual and ||) deps in self._dynamic_config._dep_disjunctive_stack. |
602 |
Yields non-disjunctive deps. Raises InvalidDependString when |
603 |
necessary. |
604 |
""" |
605 |
@@ -980,16 +993,16 @@ |
606 |
i += 1 |
607 |
|
608 |
def _queue_disjunction(self, pkg, dep_root, dep_priority, dep_struct): |
609 |
- self._dep_disjunctive_stack.append( |
610 |
+ self._dynamic_config._dep_disjunctive_stack.append( |
611 |
(pkg, dep_root, dep_priority, dep_struct)) |
612 |
|
613 |
def _pop_disjunction(self, allow_unsatisfied): |
614 |
""" |
615 |
- Pop one disjunctive dep from self._dep_disjunctive_stack, and use it to |
616 |
- populate self._dep_stack. |
617 |
+ Pop one disjunctive dep from self._dynamic_config._dep_disjunctive_stack, and use it to |
618 |
+ populate self._dynamic_config._dep_stack. |
619 |
""" |
620 |
pkg, dep_root, dep_priority, dep_struct = \ |
621 |
- self._dep_disjunctive_stack.pop() |
622 |
+ self._dynamic_config._dep_disjunctive_stack.pop() |
623 |
dep_string = portage.dep.paren_enclose(dep_struct) |
624 |
if not self._add_pkg_dep_string( |
625 |
pkg, dep_root, dep_priority, dep_string, allow_unsatisfied): |
626 |
@@ -997,7 +1010,7 @@ |
627 |
return 1 |
628 |
|
629 |
def _priority(self, **kwargs): |
630 |
- if "remove" in self.myparams: |
631 |
+ if "remove" in self._dynamic_config.myparams: |
632 |
priority_constructor = UnmergeDepPriority |
633 |
else: |
634 |
priority_constructor = DepPriority |
635 |
@@ -1016,7 +1029,7 @@ |
636 |
atom_without_category, "null")) |
637 |
cat, atom_pn = portage.catsplit(null_cp) |
638 |
|
639 |
- dbs = self._filtered_trees[root_config.root]["dbs"] |
640 |
+ dbs = self._dynamic_config._filtered_trees[root_config.root]["dbs"] |
641 |
categories = set() |
642 |
for db, pkg_type, built, installed, db_keys in dbs: |
643 |
for cat in db.categories: |
644 |
@@ -1032,7 +1045,7 @@ |
645 |
def _have_new_virt(self, root, atom_cp): |
646 |
ret = False |
647 |
for db, pkg_type, built, installed, db_keys in \ |
648 |
- self._filtered_trees[root]["dbs"]: |
649 |
+ self._dynamic_config._filtered_trees[root]["dbs"]: |
650 |
if db.cp_list(atom_cp): |
651 |
ret = True |
652 |
break |
653 |
@@ -1040,11 +1053,11 @@ |
654 |
|
655 |
def _iter_atoms_for_pkg(self, pkg): |
656 |
# TODO: add multiple $ROOT support |
657 |
- if pkg.root != self.target_root: |
658 |
+ if pkg.root != self._frozen_config.target_root: |
659 |
return |
660 |
- atom_arg_map = self._atom_arg_map |
661 |
- root_config = self.roots[pkg.root] |
662 |
- for atom in self._set_atoms.iterAtomsForPackage(pkg): |
663 |
+ atom_arg_map = self._dynamic_config._atom_arg_map |
664 |
+ root_config = self._frozen_config.roots[pkg.root] |
665 |
+ for atom in self._dynamic_config._set_atoms.iterAtomsForPackage(pkg): |
666 |
atom_cp = portage.dep_getkey(atom) |
667 |
if atom_cp != pkg.cp and \ |
668 |
self._have_new_virt(pkg.root, atom_cp): |
669 |
@@ -1072,22 +1085,22 @@ |
670 |
|
671 |
def select_files(self, myfiles): |
672 |
"""Given a list of .tbz2s, .ebuilds sets, and deps, populate |
673 |
- self._initial_arg_list and call self._resolve to create the |
674 |
+ self._dynamic_config._initial_arg_list and call self._resolve to create the |
675 |
appropriate depgraph and return a favorite list.""" |
676 |
- debug = "--debug" in self.myopts |
677 |
- root_config = self.roots[self.target_root] |
678 |
+ debug = "--debug" in self._frozen_config.myopts |
679 |
+ root_config = self._frozen_config.roots[self._frozen_config.target_root] |
680 |
sets = root_config.sets |
681 |
getSetAtoms = root_config.setconfig.getSetAtoms |
682 |
myfavorites=[] |
683 |
- myroot = self.target_root |
684 |
- dbs = self._filtered_trees[myroot]["dbs"] |
685 |
- vardb = self.trees[myroot]["vartree"].dbapi |
686 |
- real_vardb = self._trees_orig[myroot]["vartree"].dbapi |
687 |
- portdb = self.trees[myroot]["porttree"].dbapi |
688 |
- bindb = self.trees[myroot]["bintree"].dbapi |
689 |
- pkgsettings = self.pkgsettings[myroot] |
690 |
+ myroot = self._frozen_config.target_root |
691 |
+ dbs = self._dynamic_config._filtered_trees[myroot]["dbs"] |
692 |
+ vardb = self._frozen_config.trees[myroot]["vartree"].dbapi |
693 |
+ real_vardb = self._frozen_config._trees_orig[myroot]["vartree"].dbapi |
694 |
+ portdb = self._frozen_config.trees[myroot]["porttree"].dbapi |
695 |
+ bindb = self._frozen_config.trees[myroot]["bintree"].dbapi |
696 |
+ pkgsettings = self._frozen_config.pkgsettings[myroot] |
697 |
args = [] |
698 |
- onlydeps = "--onlydeps" in self.myopts |
699 |
+ onlydeps = "--onlydeps" in self._frozen_config.myopts |
700 |
lookup_owners = [] |
701 |
for x in myfiles: |
702 |
ext = os.path.splitext(x)[1] |
703 |
@@ -1106,7 +1119,7 @@ |
704 |
mytbz2=portage.xpak.tbz2(x) |
705 |
mykey=mytbz2.getelements("CATEGORY")[0]+"/"+os.path.splitext(os.path.basename(x))[0] |
706 |
if os.path.realpath(x) != \ |
707 |
- os.path.realpath(self.trees[myroot]["bintree"].getname(mykey)): |
708 |
+ os.path.realpath(self._frozen_config.trees[myroot]["bintree"].getname(mykey)): |
709 |
print colorize("BAD", "\n*** You need to adjust PKGDIR to emerge this package.\n") |
710 |
return 0, myfavorites |
711 |
db_keys = list(bindb._aux_cache_keys) |
712 |
@@ -1114,7 +1127,7 @@ |
713 |
pkg = Package(type_name="binary", root_config=root_config, |
714 |
cpv=mykey, built=True, metadata=metadata, |
715 |
onlydeps=onlydeps) |
716 |
- self._pkg_cache[pkg] = pkg |
717 |
+ self._dynamic_config._pkg_cache[pkg] = pkg |
718 |
args.append(PackageArg(arg=x, package=pkg, |
719 |
root_config=root_config)) |
720 |
elif ext==".ebuild": |
721 |
@@ -1142,7 +1155,7 @@ |
722 |
print colorize("BAD", "\n*** You are emerging a masked package. It is MUCH better to use") |
723 |
print colorize("BAD", "*** /etc/portage/package.* to accomplish this. See portage(5) man") |
724 |
print colorize("BAD", "*** page for details.") |
725 |
- countdown(int(self.settings["EMERGE_WARNING_DELAY"]), |
726 |
+ countdown(int(self._frozen_config.settings["EMERGE_WARNING_DELAY"]), |
727 |
"Continuing...") |
728 |
else: |
729 |
raise portage.exception.PackageNotFound( |
730 |
@@ -1151,7 +1164,7 @@ |
731 |
metadata = izip(db_keys, portdb.aux_get(mykey, db_keys)) |
732 |
pkg = Package(type_name="ebuild", root_config=root_config, |
733 |
cpv=mykey, metadata=metadata, onlydeps=onlydeps) |
734 |
- self._pkg_cache[pkg] = pkg |
735 |
+ self._dynamic_config._pkg_cache[pkg] = pkg |
736 |
args.append(PackageArg(arg=x, package=pkg, |
737 |
root_config=root_config)) |
738 |
elif x.startswith(os.path.sep): |
739 |
@@ -1169,14 +1182,14 @@ |
740 |
s = x[len(SETPREFIX):] |
741 |
if s not in sets: |
742 |
raise portage.exception.PackageSetNotFound(s) |
743 |
- if s in self._sets: |
744 |
+ if s in self._dynamic_config._sets: |
745 |
continue |
746 |
# Recursively expand sets so that containment tests in |
747 |
# self._get_parent_sets() properly match atoms in nested |
748 |
# sets (like if world contains system). |
749 |
expanded_set = InternalPackageSet( |
750 |
initial_atoms=getSetAtoms(s)) |
751 |
- self._sets[s] = expanded_set |
752 |
+ self._dynamic_config._sets[s] = expanded_set |
753 |
args.append(SetArg(arg=x, set=expanded_set, |
754 |
root_config=root_config)) |
755 |
continue |
756 |
@@ -1221,7 +1234,7 @@ |
757 |
print |
758 |
print |
759 |
ambiguous_package_name(x, expanded_atoms, root_config, |
760 |
- self.spinner, self.myopts) |
761 |
+ self._frozen_config.spinner, self._frozen_config.myopts) |
762 |
return False, myfavorites |
763 |
if expanded_atoms: |
764 |
atom = expanded_atoms[0] |
765 |
@@ -1273,7 +1286,7 @@ |
766 |
args.append(AtomArg(arg=atom, atom=atom, |
767 |
root_config=root_config)) |
768 |
|
769 |
- if "--update" in self.myopts: |
770 |
+ if "--update" in self._frozen_config.myopts: |
771 |
# In some cases, the greedy slots behavior can pull in a slot that |
772 |
# the user would want to uninstall due to it being blocked by a |
773 |
# newer version in a different slot. Therefore, it's necessary to |
774 |
@@ -1332,22 +1345,22 @@ |
775 |
# Order needs to be preserved since a feature of --nodeps |
776 |
# is to allow the user to force a specific merge order. |
777 |
args.reverse() |
778 |
- self._initial_arg_list = args[:] |
779 |
+ self._dynamic_config._initial_arg_list = args[:] |
780 |
|
781 |
return self._resolve(myfavorites) |
782 |
|
783 |
def _resolve(self, myfavorites): |
784 |
- """Given self._initial_arg_list, pull in the root nodes, |
785 |
+ """Given self._dynamic_config._initial_arg_list, pull in the root nodes, |
786 |
call self._creategraph to process theier deps and return |
787 |
a favorite list.""" |
788 |
- debug = "--debug" in self.myopts |
789 |
- onlydeps = "--onlydeps" in self.myopts |
790 |
- myroot = self.target_root |
791 |
- pkgsettings = self.pkgsettings[myroot] |
792 |
+ debug = "--debug" in self._frozen_config.myopts |
793 |
+ onlydeps = "--onlydeps" in self._frozen_config.myopts |
794 |
+ myroot = self._frozen_config.target_root |
795 |
+ pkgsettings = self._frozen_config.pkgsettings[myroot] |
796 |
pprovideddict = pkgsettings.pprovideddict |
797 |
- for arg in self._initial_arg_list: |
798 |
+ for arg in self._dynamic_config._initial_arg_list: |
799 |
for atom in arg.set: |
800 |
- self.spinner.update() |
801 |
+ self._frozen_config.spinner.update() |
802 |
dep = Dependency(atom=atom, onlydeps=onlydeps, |
803 |
root=myroot, parent=arg) |
804 |
atom_cp = portage.dep_getkey(atom) |
805 |
@@ -1355,7 +1368,7 @@ |
806 |
pprovided = pprovideddict.get(portage.dep_getkey(atom)) |
807 |
if pprovided and portage.match_from_list(atom, pprovided): |
808 |
# A provided package has been specified on the command line. |
809 |
- self._pprovided_args.append((arg, atom)) |
810 |
+ self._dynamic_config._pprovided_args.append((arg, atom)) |
811 |
continue |
812 |
if isinstance(arg, PackageArg): |
813 |
if not self._add_pkg(arg.package, dep) or \ |
814 |
@@ -1372,10 +1385,10 @@ |
815 |
if not pkg: |
816 |
if not (isinstance(arg, SetArg) and \ |
817 |
arg.name in ("system", "world")): |
818 |
- self._unsatisfied_deps_for_display.append( |
819 |
+ self._dynamic_config._unsatisfied_deps_for_display.append( |
820 |
((myroot, atom), {})) |
821 |
return 0, myfavorites |
822 |
- self._missing_args.append((arg, atom)) |
823 |
+ self._dynamic_config._missing_args.append((arg, atom)) |
824 |
continue |
825 |
if atom_cp != pkg.cp: |
826 |
# For old-style virtuals, we need to repeat the |
827 |
@@ -1386,10 +1399,10 @@ |
828 |
portage.match_from_list(expanded_atom, pprovided): |
829 |
# A provided package has been |
830 |
# specified on the command line. |
831 |
- self._pprovided_args.append((arg, atom)) |
832 |
+ self._dynamic_config._pprovided_args.append((arg, atom)) |
833 |
continue |
834 |
- if pkg.installed and "selective" not in self.myparams: |
835 |
- self._unsatisfied_deps_for_display.append( |
836 |
+ if pkg.installed and "selective" not in self._dynamic_config.myparams: |
837 |
+ self._dynamic_config._unsatisfied_deps_for_display.append( |
838 |
((myroot, atom), {})) |
839 |
# Previous behavior was to bail out in this case, but |
840 |
# since the dep is satisfied by the installed package, |
841 |
@@ -1441,8 +1454,8 @@ |
842 |
return 0, myfavorites |
843 |
|
844 |
missing=0 |
845 |
- if "--usepkgonly" in self.myopts: |
846 |
- for xs in self.digraph.all_nodes(): |
847 |
+ if "--usepkgonly" in self._frozen_config.myopts: |
848 |
+ for xs in self._dynamic_config.digraph.all_nodes(): |
849 |
if not isinstance(xs, Package): |
850 |
continue |
851 |
if len(xs) >= 4 and xs[0] != "binary" and xs[3] == "merge": |
852 |
@@ -1466,7 +1479,7 @@ |
853 |
The package selection cache is automatically invalidated, since |
854 |
arguments influence package selections. |
855 |
""" |
856 |
- args_set = self._sets["args"] |
857 |
+ args_set = self._dynamic_config._sets["args"] |
858 |
args_set.clear() |
859 |
for arg in args: |
860 |
if not isinstance(arg, (AtomArg, PackageArg)): |
861 |
@@ -1476,9 +1489,9 @@ |
862 |
continue |
863 |
args_set.add(atom) |
864 |
|
865 |
- self._set_atoms.clear() |
866 |
- self._set_atoms.update(chain(*self._sets.itervalues())) |
867 |
- atom_arg_map = self._atom_arg_map |
868 |
+ self._dynamic_config._set_atoms.clear() |
869 |
+ self._dynamic_config._set_atoms.update(chain(*self._dynamic_config._sets.itervalues())) |
870 |
+ atom_arg_map = self._dynamic_config._atom_arg_map |
871 |
atom_arg_map.clear() |
872 |
for arg in args: |
873 |
for atom in arg.set: |
874 |
@@ -1492,8 +1505,8 @@ |
875 |
|
876 |
# Invalidate the package selection cache, since |
877 |
# arguments influence package selections. |
878 |
- self._highest_pkg_cache.clear() |
879 |
- for trees in self._filtered_trees.itervalues(): |
880 |
+ self._dynamic_config._highest_pkg_cache.clear() |
881 |
+ for trees in self._dynamic_config._filtered_trees.itervalues(): |
882 |
trees["porttree"].dbapi._clear_cache() |
883 |
|
884 |
def _greedy_slots(self, root_config, atom, blocker_lookahead=False): |
885 |
@@ -1583,16 +1596,16 @@ |
886 |
added to the graph or those that are installed and have |
887 |
not been scheduled for replacement. |
888 |
""" |
889 |
- kwargs["trees"] = self._graph_trees |
890 |
+ kwargs["trees"] = self._frozen_config._graph_trees |
891 |
return self._select_atoms_highest_available(*pargs, **kwargs) |
892 |
|
893 |
def _select_atoms_highest_available(self, root, depstring, |
894 |
myuse=None, parent=None, strict=True, trees=None, priority=None): |
895 |
"""This will raise InvalidDependString if necessary. If trees is |
896 |
- None then self._filtered_trees is used.""" |
897 |
- pkgsettings = self.pkgsettings[root] |
898 |
+ None then self._dynamic_config._filtered_trees is used.""" |
899 |
+ pkgsettings = self._frozen_config.pkgsettings[root] |
900 |
if trees is None: |
901 |
- trees = self._filtered_trees |
902 |
+ trees = self._dynamic_config._filtered_trees |
903 |
if True: |
904 |
try: |
905 |
if parent is not None: |
906 |
@@ -1634,11 +1647,11 @@ |
907 |
masked_pkg_instances = set() |
908 |
missing_licenses = [] |
909 |
have_eapi_mask = False |
910 |
- pkgsettings = self.pkgsettings[root] |
911 |
+ pkgsettings = self._frozen_config.pkgsettings[root] |
912 |
implicit_iuse = pkgsettings._get_implicit_iuse() |
913 |
- root_config = self.roots[root] |
914 |
- portdb = self.roots[root].trees["porttree"].dbapi |
915 |
- dbs = self._filtered_trees[root]["dbs"] |
916 |
+ root_config = self._frozen_config.roots[root] |
917 |
+ portdb = self._frozen_config.roots[root].trees["porttree"].dbapi |
918 |
+ dbs = self._dynamic_config._filtered_trees[root]["dbs"] |
919 |
for db, pkg_type, built, installed, db_keys in dbs: |
920 |
if installed: |
921 |
continue |
922 |
@@ -1755,7 +1768,7 @@ |
923 |
# since arguments are root nodes. Never traverse the same |
924 |
# package twice, in order to prevent an infinite loop. |
925 |
selected_parent = None |
926 |
- for parent in self.digraph.parent_nodes(node): |
927 |
+ for parent in self._dynamic_config.digraph.parent_nodes(node): |
928 |
if isinstance(parent, DependencyArg): |
929 |
msg.append('(dependency required by "%s" [argument])' % \ |
930 |
(colorize('INFORM', str(parent)))) |
931 |
@@ -1796,7 +1809,7 @@ |
932 |
slot_available = False |
933 |
for other_db, other_type, other_built, \ |
934 |
other_installed, other_keys in \ |
935 |
- self._filtered_trees[root_config.root]["dbs"]: |
936 |
+ self._dynamic_config._filtered_trees[root_config.root]["dbs"]: |
937 |
try: |
938 |
if atom.slot == \ |
939 |
other_db.aux_get(cpv, ["SLOT"])[0]: |
940 |
@@ -1842,19 +1855,19 @@ |
941 |
|
942 |
def _select_pkg_highest_available(self, root, atom, onlydeps=False): |
943 |
cache_key = (root, atom, onlydeps) |
944 |
- ret = self._highest_pkg_cache.get(cache_key) |
945 |
+ ret = self._dynamic_config._highest_pkg_cache.get(cache_key) |
946 |
if ret is not None: |
947 |
pkg, existing = ret |
948 |
if pkg and not existing: |
949 |
- existing = self._slot_pkg_map[root].get(pkg.slot_atom) |
950 |
+ existing = self._dynamic_config._slot_pkg_map[root].get(pkg.slot_atom) |
951 |
if existing and existing == pkg: |
952 |
# Update the cache to reflect that the |
953 |
# package has been added to the graph. |
954 |
ret = pkg, pkg |
955 |
- self._highest_pkg_cache[cache_key] = ret |
956 |
+ self._dynamic_config._highest_pkg_cache[cache_key] = ret |
957 |
return ret |
958 |
ret = self._select_pkg_highest_available_imp(root, atom, onlydeps=onlydeps) |
959 |
- self._highest_pkg_cache[cache_key] = ret |
960 |
+ self._dynamic_config._highest_pkg_cache[cache_key] = ret |
961 |
pkg, existing = ret |
962 |
if pkg is not None: |
963 |
settings = pkg.root_config.settings |
964 |
@@ -1864,11 +1877,11 @@ |
965 |
return ret |
966 |
|
967 |
def _select_pkg_highest_available_imp(self, root, atom, onlydeps=False): |
968 |
- root_config = self.roots[root] |
969 |
- pkgsettings = self.pkgsettings[root] |
970 |
- dbs = self._filtered_trees[root]["dbs"] |
971 |
- vardb = self.roots[root].trees["vartree"].dbapi |
972 |
- portdb = self.roots[root].trees["porttree"].dbapi |
973 |
+ root_config = self._frozen_config.roots[root] |
974 |
+ pkgsettings = self._frozen_config.pkgsettings[root] |
975 |
+ dbs = self._dynamic_config._filtered_trees[root]["dbs"] |
976 |
+ vardb = self._frozen_config.roots[root].trees["vartree"].dbapi |
977 |
+ portdb = self._frozen_config.roots[root].trees["porttree"].dbapi |
978 |
# List of acceptable packages, ordered by type preference. |
979 |
matched_packages = [] |
980 |
highest_version = None |
981 |
@@ -1877,12 +1890,12 @@ |
982 |
atom_cp = atom.cp |
983 |
existing_node = None |
984 |
myeb = None |
985 |
- usepkgonly = "--usepkgonly" in self.myopts |
986 |
- empty = "empty" in self.myparams |
987 |
- selective = "selective" in self.myparams |
988 |
+ usepkgonly = "--usepkgonly" in self._frozen_config.myopts |
989 |
+ empty = "empty" in self._dynamic_config.myparams |
990 |
+ selective = "selective" in self._dynamic_config.myparams |
991 |
reinstall = False |
992 |
- noreplace = "--noreplace" in self.myopts |
993 |
- avoid_update = "--avoid-update" in self.myopts |
994 |
+ noreplace = "--noreplace" in self._frozen_config.myopts |
995 |
+ avoid_update = "--avoid-update" in self._frozen_config.myopts |
996 |
# Behavior of the "selective" parameter depends on |
997 |
# whether or not a package matches an argument atom. |
998 |
# If an installed package provides an old-style |
999 |
@@ -1975,7 +1988,7 @@ |
1000 |
# above visibility checks are complete. |
1001 |
|
1002 |
myarg = None |
1003 |
- if root == self.target_root: |
1004 |
+ if root == self._frozen_config.target_root: |
1005 |
try: |
1006 |
myarg = self._iter_atoms_for_pkg(pkg).next() |
1007 |
except StopIteration: |
1008 |
@@ -2004,7 +2017,7 @@ |
1009 |
# will always end with a break statement below |
1010 |
# this point. |
1011 |
if find_existing_node: |
1012 |
- e_pkg = self._slot_pkg_map[root].get(pkg.slot_atom) |
1013 |
+ e_pkg = self._dynamic_config._slot_pkg_map[root].get(pkg.slot_atom) |
1014 |
if not e_pkg: |
1015 |
break |
1016 |
if portage.dep.match_from_list(atom, [e_pkg]): |
1017 |
@@ -2023,8 +2036,8 @@ |
1018 |
# Compare built package to current config and |
1019 |
# reject the built package if necessary. |
1020 |
if built and not installed and \ |
1021 |
- ("--newuse" in self.myopts or \ |
1022 |
- "--reinstall" in self.myopts): |
1023 |
+ ("--newuse" in self._frozen_config.myopts or \ |
1024 |
+ "--reinstall" in self._frozen_config.myopts): |
1025 |
iuses = pkg.iuse.all |
1026 |
old_use = pkg.use.enabled |
1027 |
if myeb: |
1028 |
@@ -2045,8 +2058,8 @@ |
1029 |
# Compare current config to installed package |
1030 |
# and do not reinstall if possible. |
1031 |
if not installed and \ |
1032 |
- ("--newuse" in self.myopts or \ |
1033 |
- "--reinstall" in self.myopts) and \ |
1034 |
+ ("--newuse" in self._frozen_config.myopts or \ |
1035 |
+ "--reinstall" in self._frozen_config.myopts) and \ |
1036 |
cpv in vardb.match(atom): |
1037 |
pkgsettings.setcpv(pkg) |
1038 |
forced_flags = set() |
1039 |
@@ -2067,14 +2080,14 @@ |
1040 |
myeb = pkg |
1041 |
matched_packages.append(pkg) |
1042 |
if reinstall_for_flags: |
1043 |
- self._reinstall_nodes[pkg] = \ |
1044 |
+ self._dynamic_config._reinstall_nodes[pkg] = \ |
1045 |
reinstall_for_flags |
1046 |
break |
1047 |
|
1048 |
if not matched_packages: |
1049 |
return None, None |
1050 |
|
1051 |
- if "--debug" in self.myopts: |
1052 |
+ if "--debug" in self._frozen_config.myopts: |
1053 |
for pkg in matched_packages: |
1054 |
portage.writemsg("%s %s\n" % \ |
1055 |
((pkg.type_name + ":").rjust(10), pkg.cpv), noiselevel=-1) |
1056 |
@@ -2113,12 +2126,12 @@ |
1057 |
those that are installed and have not been scheduled for |
1058 |
replacement. |
1059 |
""" |
1060 |
- graph_db = self._graph_trees[root]["porttree"].dbapi |
1061 |
+ graph_db = self._frozen_config._graph_trees[root]["porttree"].dbapi |
1062 |
matches = graph_db.match_pkgs(atom) |
1063 |
if not matches: |
1064 |
return None, None |
1065 |
pkg = matches[-1] # highest match |
1066 |
- in_graph = self._slot_pkg_map[root].get(pkg.slot_atom) |
1067 |
+ in_graph = self._dynamic_config._slot_pkg_map[root].get(pkg.slot_atom) |
1068 |
return pkg, in_graph |
1069 |
|
1070 |
def _complete_graph(self): |
1071 |
@@ -2133,11 +2146,11 @@ |
1072 |
Since this method can consume enough time to disturb users, it is |
1073 |
currently only enabled by the --complete-graph option. |
1074 |
""" |
1075 |
- if "--buildpkgonly" in self.myopts or \ |
1076 |
- "recurse" not in self.myparams: |
1077 |
+ if "--buildpkgonly" in self._frozen_config.myopts or \ |
1078 |
+ "recurse" not in self._dynamic_config.myparams: |
1079 |
return 1 |
1080 |
|
1081 |
- if "complete" not in self.myparams: |
1082 |
+ if "complete" not in self._dynamic_config.myparams: |
1083 |
# Skip this to avoid consuming enough time to disturb users. |
1084 |
return 1 |
1085 |
|
1086 |
@@ -2149,22 +2162,22 @@ |
1087 |
# accounted for. |
1088 |
self._select_atoms = self._select_atoms_from_graph |
1089 |
self._select_package = self._select_pkg_from_graph |
1090 |
- already_deep = "deep" in self.myparams |
1091 |
+ already_deep = "deep" in self._dynamic_config.myparams |
1092 |
if not already_deep: |
1093 |
- self.myparams.add("deep") |
1094 |
+ self._dynamic_config.myparams.add("deep") |
1095 |
|
1096 |
- for root in self.roots: |
1097 |
- required_set_names = self._required_set_names.copy() |
1098 |
- if root == self.target_root and \ |
1099 |
- (already_deep or "empty" in self.myparams): |
1100 |
- required_set_names.difference_update(self._sets) |
1101 |
- if not required_set_names and not self._ignored_deps: |
1102 |
+ for root in self._frozen_config.roots: |
1103 |
+ required_set_names = self._frozen_config._required_set_names.copy() |
1104 |
+ if root == self._frozen_config.target_root and \ |
1105 |
+ (already_deep or "empty" in self._dynamic_config.myparams): |
1106 |
+ required_set_names.difference_update(self._dynamic_config._sets) |
1107 |
+ if not required_set_names and not self._dynamic_config._ignored_deps: |
1108 |
continue |
1109 |
- root_config = self.roots[root] |
1110 |
+ root_config = self._frozen_config.roots[root] |
1111 |
setconfig = root_config.setconfig |
1112 |
args = [] |
1113 |
# Reuse existing SetArg instances when available. |
1114 |
- for arg in self.digraph.root_nodes(): |
1115 |
+ for arg in self._dynamic_config.digraph.root_nodes(): |
1116 |
if not isinstance(arg, SetArg): |
1117 |
continue |
1118 |
if arg.root_config != root_config: |
1119 |
@@ -2182,22 +2195,22 @@ |
1120 |
vardb = root_config.trees["vartree"].dbapi |
1121 |
for arg in args: |
1122 |
for atom in arg.set: |
1123 |
- self._dep_stack.append( |
1124 |
+ self._dynamic_config._dep_stack.append( |
1125 |
Dependency(atom=atom, root=root, parent=arg)) |
1126 |
- if self._ignored_deps: |
1127 |
- self._dep_stack.extend(self._ignored_deps) |
1128 |
- self._ignored_deps = [] |
1129 |
+ if self._dynamic_config._ignored_deps: |
1130 |
+ self._dynamic_config._dep_stack.extend(self._dynamic_config._ignored_deps) |
1131 |
+ self._dynamic_config._ignored_deps = [] |
1132 |
if not self._create_graph(allow_unsatisfied=True): |
1133 |
return 0 |
1134 |
# Check the unsatisfied deps to see if any initially satisfied deps |
1135 |
# will become unsatisfied due to an upgrade. Initially unsatisfied |
1136 |
# deps are irrelevant since we only want to avoid breaking deps |
1137 |
# that are initially satisfied. |
1138 |
- while self._unsatisfied_deps: |
1139 |
- dep = self._unsatisfied_deps.pop() |
1140 |
+ while self._dynamic_config._unsatisfied_deps: |
1141 |
+ dep = self._dynamic_config._unsatisfied_deps.pop() |
1142 |
matches = vardb.match_pkgs(dep.atom) |
1143 |
if not matches: |
1144 |
- self._initially_unsatisfied_deps.append(dep) |
1145 |
+ self._dynamic_config._initially_unsatisfied_deps.append(dep) |
1146 |
continue |
1147 |
# An scheduled installation broke a deep dependency. |
1148 |
# Add the installed package to the graph so that it |
1149 |
@@ -2221,17 +2234,17 @@ |
1150 |
operation = "merge" |
1151 |
if installed or onlydeps: |
1152 |
operation = "nomerge" |
1153 |
- pkg = self._pkg_cache.get( |
1154 |
+ pkg = self._dynamic_config._pkg_cache.get( |
1155 |
(type_name, root_config.root, cpv, operation)) |
1156 |
if pkg is None and onlydeps and not installed: |
1157 |
# Maybe it already got pulled in as a "merge" node. |
1158 |
- pkg = self.mydbapi[root_config.root].get( |
1159 |
+ pkg = self._dynamic_config.mydbapi[root_config.root].get( |
1160 |
(type_name, root_config.root, cpv, 'merge')) |
1161 |
|
1162 |
if pkg is None: |
1163 |
tree_type = self.pkg_tree_map[type_name] |
1164 |
db = root_config.trees[tree_type].dbapi |
1165 |
- db_keys = list(self._trees_orig[root_config.root][ |
1166 |
+ db_keys = list(self._frozen_config._trees_orig[root_config.root][ |
1167 |
tree_type].dbapi._aux_cache_keys) |
1168 |
try: |
1169 |
metadata = izip(db_keys, db.aux_get(cpv, db_keys)) |
1170 |
@@ -2240,7 +2253,7 @@ |
1171 |
pkg = Package(built=(type_name != "ebuild"), cpv=cpv, |
1172 |
installed=installed, metadata=metadata, |
1173 |
root_config=root_config, type_name=type_name) |
1174 |
- self._pkg_cache[pkg] = pkg |
1175 |
+ self._dynamic_config._pkg_cache[pkg] = pkg |
1176 |
return pkg |
1177 |
|
1178 |
def _validate_blockers(self): |
1179 |
@@ -2249,11 +2262,11 @@ |
1180 |
correct merge order such that mutually blocking packages are never |
1181 |
installed simultaneously.""" |
1182 |
|
1183 |
- if "--buildpkgonly" in self.myopts or \ |
1184 |
- "--nodeps" in self.myopts: |
1185 |
+ if "--buildpkgonly" in self._frozen_config.myopts or \ |
1186 |
+ "--nodeps" in self._frozen_config.myopts: |
1187 |
return True |
1188 |
|
1189 |
- #if "deep" in self.myparams: |
1190 |
+ #if "deep" in self._dynamic_config.myparams: |
1191 |
if True: |
1192 |
# Pull in blockers from all installed packages that haven't already |
1193 |
# been pulled into the depgraph. This is not enabled by default |
1194 |
@@ -2261,18 +2274,18 @@ |
1195 |
# additional dep_check calls that are required. |
1196 |
|
1197 |
dep_keys = ["DEPEND","RDEPEND","PDEPEND"] |
1198 |
- for myroot in self.trees: |
1199 |
- vardb = self.trees[myroot]["vartree"].dbapi |
1200 |
- portdb = self.trees[myroot]["porttree"].dbapi |
1201 |
- pkgsettings = self.pkgsettings[myroot] |
1202 |
- final_db = self.mydbapi[myroot] |
1203 |
+ for myroot in self._frozen_config.trees: |
1204 |
+ vardb = self._frozen_config.trees[myroot]["vartree"].dbapi |
1205 |
+ portdb = self._frozen_config.trees[myroot]["porttree"].dbapi |
1206 |
+ pkgsettings = self._frozen_config.pkgsettings[myroot] |
1207 |
+ final_db = self._dynamic_config.mydbapi[myroot] |
1208 |
|
1209 |
blocker_cache = BlockerCache(myroot, vardb) |
1210 |
stale_cache = set(blocker_cache) |
1211 |
for pkg in vardb: |
1212 |
cpv = pkg.cpv |
1213 |
stale_cache.discard(cpv) |
1214 |
- pkg_in_graph = self.digraph.contains(pkg) |
1215 |
+ pkg_in_graph = self._dynamic_config.digraph.contains(pkg) |
1216 |
|
1217 |
# Check for masked installed packages. Only warn about |
1218 |
# packages that are in the graph in order to avoid warning |
1219 |
@@ -2280,7 +2293,7 @@ |
1220 |
# the merge process or by --depclean. |
1221 |
if pkg in final_db: |
1222 |
if pkg_in_graph and not visible(pkgsettings, pkg): |
1223 |
- self._masked_installed.add(pkg) |
1224 |
+ self._dynamic_config._masked_installed.add(pkg) |
1225 |
|
1226 |
blocker_atoms = None |
1227 |
blockers = None |
1228 |
@@ -2288,12 +2301,12 @@ |
1229 |
blockers = [] |
1230 |
try: |
1231 |
blockers.extend( |
1232 |
- self._blocker_parents.child_nodes(pkg)) |
1233 |
+ self._dynamic_config._blocker_parents.child_nodes(pkg)) |
1234 |
except KeyError: |
1235 |
pass |
1236 |
try: |
1237 |
blockers.extend( |
1238 |
- self._irrelevant_blockers.child_nodes(pkg)) |
1239 |
+ self._dynamic_config._irrelevant_blockers.child_nodes(pkg)) |
1240 |
except KeyError: |
1241 |
pass |
1242 |
if blockers is not None: |
1243 |
@@ -2302,7 +2315,7 @@ |
1244 |
|
1245 |
# If this node has any blockers, create a "nomerge" |
1246 |
# node for it so that they can be enforced. |
1247 |
- self.spinner.update() |
1248 |
+ self._frozen_config.spinner.update() |
1249 |
blocker_data = blocker_cache.get(cpv) |
1250 |
if blocker_data is not None and \ |
1251 |
blocker_data.counter != long(pkg.metadata["COUNTER"]): |
1252 |
@@ -2342,7 +2355,7 @@ |
1253 |
try: |
1254 |
success, atoms = portage.dep_check(depstr, |
1255 |
final_db, pkgsettings, myuse=pkg.use.enabled, |
1256 |
- trees=self._graph_trees, myroot=myroot) |
1257 |
+ trees=self._frozen_config._graph_trees, myroot=myroot) |
1258 |
except Exception, e: |
1259 |
if isinstance(e, SystemExit): |
1260 |
raise |
1261 |
@@ -2378,7 +2391,7 @@ |
1262 |
for atom in blocker_atoms: |
1263 |
blocker = Blocker(atom=portage.dep.Atom(atom), |
1264 |
eapi=pkg.metadata["EAPI"], root=myroot) |
1265 |
- self._blocker_parents.add(blocker, pkg) |
1266 |
+ self._dynamic_config._blocker_parents.add(blocker, pkg) |
1267 |
except portage.exception.InvalidAtom, e: |
1268 |
depstr = " ".join(vardb.aux_get(pkg.cpv, dep_keys)) |
1269 |
show_invalid_depstring_notice( |
1270 |
@@ -2392,18 +2405,18 @@ |
1271 |
# Discard any "uninstall" tasks scheduled by previous calls |
1272 |
# to this method, since those tasks may not make sense given |
1273 |
# the current graph state. |
1274 |
- previous_uninstall_tasks = self._blocker_uninstalls.leaf_nodes() |
1275 |
+ previous_uninstall_tasks = self._dynamic_config._blocker_uninstalls.leaf_nodes() |
1276 |
if previous_uninstall_tasks: |
1277 |
- self._blocker_uninstalls = digraph() |
1278 |
- self.digraph.difference_update(previous_uninstall_tasks) |
1279 |
+ self._dynamic_config._blocker_uninstalls = digraph() |
1280 |
+ self._dynamic_config.digraph.difference_update(previous_uninstall_tasks) |
1281 |
|
1282 |
- for blocker in self._blocker_parents.leaf_nodes(): |
1283 |
- self.spinner.update() |
1284 |
- root_config = self.roots[blocker.root] |
1285 |
+ for blocker in self._dynamic_config._blocker_parents.leaf_nodes(): |
1286 |
+ self._frozen_config.spinner.update() |
1287 |
+ root_config = self._frozen_config.roots[blocker.root] |
1288 |
virtuals = root_config.settings.getvirtuals() |
1289 |
myroot = blocker.root |
1290 |
- initial_db = self.trees[myroot]["vartree"].dbapi |
1291 |
- final_db = self.mydbapi[myroot] |
1292 |
+ initial_db = self._frozen_config.trees[myroot]["vartree"].dbapi |
1293 |
+ final_db = self._dynamic_config.mydbapi[myroot] |
1294 |
|
1295 |
provider_virtual = False |
1296 |
if blocker.cp in virtuals and \ |
1297 |
@@ -2438,15 +2451,15 @@ |
1298 |
blocked_final.add(pkg) |
1299 |
|
1300 |
if not blocked_initial and not blocked_final: |
1301 |
- parent_pkgs = self._blocker_parents.parent_nodes(blocker) |
1302 |
- self._blocker_parents.remove(blocker) |
1303 |
+ parent_pkgs = self._dynamic_config._blocker_parents.parent_nodes(blocker) |
1304 |
+ self._dynamic_config._blocker_parents.remove(blocker) |
1305 |
# Discard any parents that don't have any more blockers. |
1306 |
for pkg in parent_pkgs: |
1307 |
- self._irrelevant_blockers.add(blocker, pkg) |
1308 |
- if not self._blocker_parents.child_nodes(pkg): |
1309 |
- self._blocker_parents.remove(pkg) |
1310 |
+ self._dynamic_config._irrelevant_blockers.add(blocker, pkg) |
1311 |
+ if not self._dynamic_config._blocker_parents.child_nodes(pkg): |
1312 |
+ self._dynamic_config._blocker_parents.remove(pkg) |
1313 |
continue |
1314 |
- for parent in self._blocker_parents.parent_nodes(blocker): |
1315 |
+ for parent in self._dynamic_config._blocker_parents.parent_nodes(blocker): |
1316 |
unresolved_blocks = False |
1317 |
depends_on_order = set() |
1318 |
for pkg in blocked_initial: |
1319 |
@@ -2465,7 +2478,7 @@ |
1320 |
# confuse users if displayed like a normal blocker. |
1321 |
continue |
1322 |
|
1323 |
- self._blocked_pkgs.add(pkg, blocker) |
1324 |
+ self._dynamic_config._blocked_pkgs.add(pkg, blocker) |
1325 |
|
1326 |
if parent.operation == "merge": |
1327 |
# Maybe the blocked package can be replaced or simply |
1328 |
@@ -2490,7 +2503,7 @@ |
1329 |
# merge of either package is triggered. |
1330 |
continue |
1331 |
|
1332 |
- self._blocked_pkgs.add(pkg, blocker) |
1333 |
+ self._dynamic_config._blocked_pkgs.add(pkg, blocker) |
1334 |
|
1335 |
# Maybe the blocking package can be |
1336 |
# unmerged to resolve this block. |
1337 |
@@ -2508,8 +2521,8 @@ |
1338 |
# into the graph. |
1339 |
if not unresolved_blocks and depends_on_order: |
1340 |
for inst_pkg, inst_task in depends_on_order: |
1341 |
- if self.digraph.contains(inst_pkg) and \ |
1342 |
- self.digraph.parent_nodes(inst_pkg): |
1343 |
+ if self._dynamic_config.digraph.contains(inst_pkg) and \ |
1344 |
+ self._dynamic_config.digraph.parent_nodes(inst_pkg): |
1345 |
unresolved_blocks = True |
1346 |
break |
1347 |
|
1348 |
@@ -2521,23 +2534,23 @@ |
1349 |
operation="uninstall", |
1350 |
root_config=inst_pkg.root_config, |
1351 |
type_name=inst_pkg.type_name) |
1352 |
- self._pkg_cache[uninst_task] = uninst_task |
1353 |
+ self._dynamic_config._pkg_cache[uninst_task] = uninst_task |
1354 |
# Enforce correct merge order with a hard dep. |
1355 |
- self.digraph.addnode(uninst_task, inst_task, |
1356 |
+ self._dynamic_config.digraph.addnode(uninst_task, inst_task, |
1357 |
priority=BlockerDepPriority.instance) |
1358 |
# Count references to this blocker so that it can be |
1359 |
# invalidated after nodes referencing it have been |
1360 |
# merged. |
1361 |
- self._blocker_uninstalls.addnode(uninst_task, blocker) |
1362 |
+ self._dynamic_config._blocker_uninstalls.addnode(uninst_task, blocker) |
1363 |
if not unresolved_blocks and not depends_on_order: |
1364 |
- self._irrelevant_blockers.add(blocker, parent) |
1365 |
- self._blocker_parents.remove_edge(blocker, parent) |
1366 |
- if not self._blocker_parents.parent_nodes(blocker): |
1367 |
- self._blocker_parents.remove(blocker) |
1368 |
- if not self._blocker_parents.child_nodes(parent): |
1369 |
- self._blocker_parents.remove(parent) |
1370 |
+ self._dynamic_config._irrelevant_blockers.add(blocker, parent) |
1371 |
+ self._dynamic_config._blocker_parents.remove_edge(blocker, parent) |
1372 |
+ if not self._dynamic_config._blocker_parents.parent_nodes(blocker): |
1373 |
+ self._dynamic_config._blocker_parents.remove(blocker) |
1374 |
+ if not self._dynamic_config._blocker_parents.child_nodes(parent): |
1375 |
+ self._dynamic_config._blocker_parents.remove(parent) |
1376 |
if unresolved_blocks: |
1377 |
- self._unsolvable_blockers.add(blocker, parent) |
1378 |
+ self._dynamic_config._unsolvable_blockers.add(blocker, parent) |
1379 |
|
1380 |
return True |
1381 |
|
1382 |
@@ -2545,7 +2558,7 @@ |
1383 |
acceptable = False |
1384 |
for x in ("--buildpkgonly", "--fetchonly", |
1385 |
"--fetch-all-uri", "--nodeps"): |
1386 |
- if x in self.myopts: |
1387 |
+ if x in self._frozen_config.myopts: |
1388 |
acceptable = True |
1389 |
break |
1390 |
return acceptable |
1391 |
@@ -2586,15 +2599,15 @@ |
1392 |
|
1393 |
def altlist(self, reversed=False): |
1394 |
|
1395 |
- while self._serialized_tasks_cache is None: |
1396 |
+ while self._dynamic_config._serialized_tasks_cache is None: |
1397 |
self._resolve_conflicts() |
1398 |
try: |
1399 |
- self._serialized_tasks_cache, self._scheduler_graph = \ |
1400 |
+ self._dynamic_config._serialized_tasks_cache, self._dynamic_config._scheduler_graph = \ |
1401 |
self._serialize_tasks() |
1402 |
except self._serialize_tasks_retry: |
1403 |
pass |
1404 |
|
1405 |
- retlist = self._serialized_tasks_cache[:] |
1406 |
+ retlist = self._dynamic_config._serialized_tasks_cache[:] |
1407 |
if reversed: |
1408 |
retlist.reverse() |
1409 |
return retlist |
1410 |
@@ -2613,10 +2626,10 @@ |
1411 |
internal Package instances such that this depgraph instance should |
1412 |
not be used to perform any more calculations. |
1413 |
""" |
1414 |
- if self._scheduler_graph is None: |
1415 |
+ if self._dynamic_config._scheduler_graph is None: |
1416 |
self.altlist() |
1417 |
- self.break_refs(self._scheduler_graph.order) |
1418 |
- return self._scheduler_graph |
1419 |
+ self.break_refs(self._dynamic_config._scheduler_graph.order) |
1420 |
+ return self._dynamic_config._scheduler_graph |
1421 |
|
1422 |
def break_refs(self, nodes): |
1423 |
""" |
1424 |
@@ -2634,7 +2647,7 @@ |
1425 |
# original RootConfig instance which references the actual |
1426 |
# vartree. |
1427 |
node.root_config = \ |
1428 |
- self._trees_orig[node.root_config.root]["root_config"] |
1429 |
+ self._frozen_config._trees_orig[node.root_config.root]["root_config"] |
1430 |
|
1431 |
def _resolve_conflicts(self): |
1432 |
if not self._complete_graph(): |
1433 |
@@ -2643,25 +2656,25 @@ |
1434 |
if not self._validate_blockers(): |
1435 |
raise self._unknown_internal_error() |
1436 |
|
1437 |
- if self._slot_collision_info: |
1438 |
+ if self._dynamic_config._slot_collision_info: |
1439 |
self._process_slot_conflicts() |
1440 |
|
1441 |
def _serialize_tasks(self): |
1442 |
|
1443 |
- if "--debug" in self.myopts: |
1444 |
+ if "--debug" in self._frozen_config.myopts: |
1445 |
writemsg("\ndigraph:\n\n", noiselevel=-1) |
1446 |
- self.digraph.debug_print() |
1447 |
+ self._dynamic_config.digraph.debug_print() |
1448 |
writemsg("\n", noiselevel=-1) |
1449 |
|
1450 |
- scheduler_graph = self.digraph.copy() |
1451 |
+ scheduler_graph = self._dynamic_config.digraph.copy() |
1452 |
|
1453 |
- if '--nodeps' in self.myopts: |
1454 |
+ if '--nodeps' in self._frozen_config.myopts: |
1455 |
# Preserve the package order given on the command line. |
1456 |
return ([node for node in scheduler_graph \ |
1457 |
if isinstance(node, Package) \ |
1458 |
and node.operation == 'merge'], scheduler_graph) |
1459 |
|
1460 |
- mygraph=self.digraph.copy() |
1461 |
+ mygraph=self._dynamic_config.digraph.copy() |
1462 |
# Prune "nomerge" root nodes if nothing depends on them, since |
1463 |
# otherwise they slow down merge order calculation. Don't remove |
1464 |
# non-root nodes since they help optimize merge order in some cases |
1465 |
@@ -2673,7 +2686,7 @@ |
1466 |
node.installed or node.onlydeps: |
1467 |
removed_nodes.add(node) |
1468 |
if removed_nodes: |
1469 |
- self.spinner.update() |
1470 |
+ self._frozen_config.spinner.update() |
1471 |
mygraph.difference_update(removed_nodes) |
1472 |
if not removed_nodes: |
1473 |
break |
1474 |
@@ -2694,7 +2707,7 @@ |
1475 |
elif n1_n2_medium: |
1476 |
return 1 |
1477 |
return -1 |
1478 |
- myblocker_uninstalls = self._blocker_uninstalls.copy() |
1479 |
+ myblocker_uninstalls = self._dynamic_config._blocker_uninstalls.copy() |
1480 |
retlist=[] |
1481 |
# Contains uninstall tasks that have been scheduled to |
1482 |
# occur after overlapping blockers have been installed. |
1483 |
@@ -2705,7 +2718,7 @@ |
1484 |
# resolved. |
1485 |
ignored_uninstall_tasks = set() |
1486 |
have_uninstall_task = False |
1487 |
- complete = "complete" in self.myparams |
1488 |
+ complete = "complete" in self._dynamic_config.myparams |
1489 |
asap_nodes = [] |
1490 |
|
1491 |
def get_nodes(**kwargs): |
1492 |
@@ -2719,13 +2732,13 @@ |
1493 |
node in scheduled_uninstalls)] |
1494 |
|
1495 |
# sys-apps/portage needs special treatment if ROOT="/" |
1496 |
- running_root = self._running_root.root |
1497 |
+ running_root = self._frozen_config._running_root.root |
1498 |
from portage.const import PORTAGE_PACKAGE_ATOM |
1499 |
runtime_deps = InternalPackageSet( |
1500 |
initial_atoms=[PORTAGE_PACKAGE_ATOM]) |
1501 |
- running_portage = self.trees[running_root]["vartree"].dbapi.match_pkgs( |
1502 |
+ running_portage = self._frozen_config.trees[running_root]["vartree"].dbapi.match_pkgs( |
1503 |
PORTAGE_PACKAGE_ATOM) |
1504 |
- replacement_portage = self.mydbapi[running_root].match_pkgs( |
1505 |
+ replacement_portage = self._dynamic_config.mydbapi[running_root].match_pkgs( |
1506 |
PORTAGE_PACKAGE_ATOM) |
1507 |
|
1508 |
if running_portage: |
1509 |
@@ -2795,7 +2808,7 @@ |
1510 |
return True |
1511 |
return priority_range.ignore_medium_soft(priority) |
1512 |
|
1513 |
- tree_mode = "--tree" in self.myopts |
1514 |
+ tree_mode = "--tree" in self._frozen_config.myopts |
1515 |
# Tracks whether or not the current iteration should prefer asap_nodes |
1516 |
# if available. This is set to False when the previous iteration |
1517 |
# failed to select any nodes. It is reset whenever nodes are |
1518 |
@@ -2821,7 +2834,7 @@ |
1519 |
# unresolved blockers or circular dependencies. |
1520 |
|
1521 |
while not mygraph.empty(): |
1522 |
- self.spinner.update() |
1523 |
+ self._frozen_config.spinner.update() |
1524 |
selected_nodes = None |
1525 |
ignore_priority = None |
1526 |
if drop_satisfied or (prefer_asap and asap_nodes): |
1527 |
@@ -2858,7 +2871,7 @@ |
1528 |
with_some_uninstalls_excluded = [] |
1529 |
for node in nodes: |
1530 |
if node.operation == "uninstall": |
1531 |
- slot_node = self.mydbapi[node.root |
1532 |
+ slot_node = self._dynamic_config.mydbapi[node.root |
1533 |
].match_pkgs(node.slot_atom) |
1534 |
if slot_node and \ |
1535 |
slot_node[0].operation == "merge": |
1536 |
@@ -2974,11 +2987,11 @@ |
1537 |
# on installation of blocking packages. |
1538 |
continue |
1539 |
|
1540 |
- root_config = self.roots[task.root] |
1541 |
- inst_pkg = self._pkg_cache[ |
1542 |
+ root_config = self._frozen_config.roots[task.root] |
1543 |
+ inst_pkg = self._dynamic_config._pkg_cache[ |
1544 |
("installed", task.root, task.cpv, "nomerge")] |
1545 |
|
1546 |
- if self.digraph.contains(inst_pkg): |
1547 |
+ if self._dynamic_config.digraph.contains(inst_pkg): |
1548 |
continue |
1549 |
|
1550 |
forbid_overlap = False |
1551 |
@@ -3053,7 +3066,7 @@ |
1552 |
# For packages in the world set, go ahead an uninstall |
1553 |
# when necessary, as long as the atom will be satisfied |
1554 |
# in the final state. |
1555 |
- graph_db = self.mydbapi[task.root] |
1556 |
+ graph_db = self._dynamic_config.mydbapi[task.root] |
1557 |
skip = False |
1558 |
try: |
1559 |
for atom in root_config.sets[ |
1560 |
@@ -3066,7 +3079,7 @@ |
1561 |
break |
1562 |
if not satisfied: |
1563 |
skip = True |
1564 |
- self._blocked_world_pkgs[inst_pkg] = atom |
1565 |
+ self._dynamic_config._blocked_world_pkgs[inst_pkg] = atom |
1566 |
break |
1567 |
except portage.exception.InvalidDependString, e: |
1568 |
portage.writemsg("!!! Invalid PROVIDE in " + \ |
1569 |
@@ -3161,7 +3174,7 @@ |
1570 |
continue |
1571 |
|
1572 |
if not selected_nodes: |
1573 |
- self._circular_deps_for_display = mygraph |
1574 |
+ self._dynamic_config._circular_deps_for_display = mygraph |
1575 |
raise self._unknown_internal_error() |
1576 |
|
1577 |
# At this point, we've succeeded in selecting one or more nodes, so |
1578 |
@@ -3185,7 +3198,7 @@ |
1579 |
have_uninstall_task = True |
1580 |
uninst_task = node |
1581 |
else: |
1582 |
- vardb = self.trees[node.root]["vartree"].dbapi |
1583 |
+ vardb = self._frozen_config.trees[node.root]["vartree"].dbapi |
1584 |
previous_cpv = vardb.match(node.slot_atom) |
1585 |
if previous_cpv: |
1586 |
# The package will be replaced by this one, so remove |
1587 |
@@ -3224,7 +3237,7 @@ |
1588 |
root=blocker.root, eapi=blocker.eapi, |
1589 |
satisfied=True)) |
1590 |
|
1591 |
- unsolvable_blockers = set(self._unsolvable_blockers.leaf_nodes()) |
1592 |
+ unsolvable_blockers = set(self._dynamic_config._unsolvable_blockers.leaf_nodes()) |
1593 |
for node in myblocker_uninstalls.root_nodes(): |
1594 |
unsolvable_blockers.add(node) |
1595 |
|
1596 |
@@ -3239,20 +3252,20 @@ |
1597 |
if have_uninstall_task and \ |
1598 |
not complete and \ |
1599 |
not unsolvable_blockers: |
1600 |
- self.myparams.add("complete") |
1601 |
+ self._dynamic_config.myparams.add("complete") |
1602 |
raise self._serialize_tasks_retry("") |
1603 |
|
1604 |
if unsolvable_blockers and \ |
1605 |
not self._accept_blocker_conflicts(): |
1606 |
- self._unsatisfied_blockers_for_display = unsolvable_blockers |
1607 |
- self._serialized_tasks_cache = retlist[:] |
1608 |
- self._scheduler_graph = scheduler_graph |
1609 |
+ self._dynamic_config._unsatisfied_blockers_for_display = unsolvable_blockers |
1610 |
+ self._dynamic_config._serialized_tasks_cache = retlist[:] |
1611 |
+ self._dynamic_config._scheduler_graph = scheduler_graph |
1612 |
raise self._unknown_internal_error() |
1613 |
|
1614 |
- if self._slot_collision_info and \ |
1615 |
+ if self._dynamic_config._slot_collision_info and \ |
1616 |
not self._accept_blocker_conflicts(): |
1617 |
- self._serialized_tasks_cache = retlist[:] |
1618 |
- self._scheduler_graph = scheduler_graph |
1619 |
+ self._dynamic_config._serialized_tasks_cache = retlist[:] |
1620 |
+ self._dynamic_config._scheduler_graph = scheduler_graph |
1621 |
raise self._unknown_internal_error() |
1622 |
|
1623 |
return retlist, scheduler_graph |
1624 |
@@ -3282,9 +3295,9 @@ |
1625 |
display_order.append(node) |
1626 |
tempgraph.remove(node) |
1627 |
display_order.reverse() |
1628 |
- self.myopts.pop("--quiet", None) |
1629 |
- self.myopts.pop("--verbose", None) |
1630 |
- self.myopts["--tree"] = True |
1631 |
+ self._frozen_config.myopts.pop("--quiet", None) |
1632 |
+ self._frozen_config.myopts.pop("--verbose", None) |
1633 |
+ self._frozen_config.myopts["--tree"] = True |
1634 |
portage.writemsg("\n\n", noiselevel=-1) |
1635 |
self.display(display_order) |
1636 |
prefix = colorize("BAD", " * ") |
1637 |
@@ -3300,13 +3313,13 @@ |
1638 |
"optional dependencies.\n", noiselevel=-1) |
1639 |
|
1640 |
def _show_merge_list(self): |
1641 |
- if self._serialized_tasks_cache is not None and \ |
1642 |
- not (self._displayed_list and \ |
1643 |
- (self._displayed_list == self._serialized_tasks_cache or \ |
1644 |
- self._displayed_list == \ |
1645 |
- list(reversed(self._serialized_tasks_cache)))): |
1646 |
- display_list = self._serialized_tasks_cache[:] |
1647 |
- if "--tree" in self.myopts: |
1648 |
+ if self._dynamic_config._serialized_tasks_cache is not None and \ |
1649 |
+ not (self._dynamic_config._displayed_list and \ |
1650 |
+ (self._dynamic_config._displayed_list == self._dynamic_config._serialized_tasks_cache or \ |
1651 |
+ self._dynamic_config._displayed_list == \ |
1652 |
+ list(reversed(self._dynamic_config._serialized_tasks_cache)))): |
1653 |
+ display_list = self._dynamic_config._serialized_tasks_cache[:] |
1654 |
+ if "--tree" in self._frozen_config.myopts: |
1655 |
display_list.reverse() |
1656 |
self.display(display_list) |
1657 |
|
1658 |
@@ -3329,11 +3342,11 @@ |
1659 |
|
1660 |
conflict_pkgs = {} |
1661 |
for blocker in blockers: |
1662 |
- for pkg in chain(self._blocked_pkgs.child_nodes(blocker), \ |
1663 |
- self._blocker_parents.parent_nodes(blocker)): |
1664 |
- parent_atoms = self._parent_atoms.get(pkg) |
1665 |
+ for pkg in chain(self._dynamic_config._blocked_pkgs.child_nodes(blocker), \ |
1666 |
+ self._dynamic_config._blocker_parents.parent_nodes(blocker)): |
1667 |
+ parent_atoms = self._dynamic_config._parent_atoms.get(pkg) |
1668 |
if not parent_atoms: |
1669 |
- atom = self._blocked_world_pkgs.get(pkg) |
1670 |
+ atom = self._dynamic_config._blocked_world_pkgs.get(pkg) |
1671 |
if atom is not None: |
1672 |
parent_atoms = set([("@world", atom)]) |
1673 |
if parent_atoms: |
1674 |
@@ -3403,7 +3416,7 @@ |
1675 |
sys.stderr.write("".join(msg)) |
1676 |
sys.stderr.flush() |
1677 |
|
1678 |
- if "--quiet" not in self.myopts: |
1679 |
+ if "--quiet" not in self._frozen_config.myopts: |
1680 |
show_blocker_docs_link() |
1681 |
|
1682 |
def display(self, mylist, favorites=[], verbosity=None): |
1683 |
@@ -3411,30 +3424,30 @@ |
1684 |
# This is used to prevent display_problems() from |
1685 |
# redundantly displaying this exact same merge list |
1686 |
# again via _show_merge_list(). |
1687 |
- self._displayed_list = mylist |
1688 |
+ self._dynamic_config._displayed_list = mylist |
1689 |
|
1690 |
if verbosity is None: |
1691 |
- verbosity = ("--quiet" in self.myopts and 1 or \ |
1692 |
- "--verbose" in self.myopts and 3 or 2) |
1693 |
+ verbosity = ("--quiet" in self._frozen_config.myopts and 1 or \ |
1694 |
+ "--verbose" in self._frozen_config.myopts and 3 or 2) |
1695 |
favorites_set = InternalPackageSet(favorites) |
1696 |
- oneshot = "--oneshot" in self.myopts or \ |
1697 |
- "--onlydeps" in self.myopts |
1698 |
- columns = "--columns" in self.myopts |
1699 |
+ oneshot = "--oneshot" in self._frozen_config.myopts or \ |
1700 |
+ "--onlydeps" in self._frozen_config.myopts |
1701 |
+ columns = "--columns" in self._frozen_config.myopts |
1702 |
changelogs=[] |
1703 |
p=[] |
1704 |
blockers = [] |
1705 |
|
1706 |
counters = PackageCounters() |
1707 |
|
1708 |
- if verbosity == 1 and "--verbose" not in self.myopts: |
1709 |
+ if verbosity == 1 and "--verbose" not in self._frozen_config.myopts: |
1710 |
def create_use_string(*args): |
1711 |
return "" |
1712 |
else: |
1713 |
def create_use_string(name, cur_iuse, iuse_forced, cur_use, |
1714 |
old_iuse, old_use, |
1715 |
is_new, reinst_flags, |
1716 |
- all_flags=(verbosity == 3 or "--quiet" in self.myopts), |
1717 |
- alphabetical=("--alphabetical" in self.myopts)): |
1718 |
+ all_flags=(verbosity == 3 or "--quiet" in self._frozen_config.myopts), |
1719 |
+ alphabetical=("--alphabetical" in self._frozen_config.myopts)): |
1720 |
enabled = [] |
1721 |
if alphabetical: |
1722 |
disabled = enabled |
1723 |
@@ -3496,11 +3509,11 @@ |
1724 |
ret = '%s="%s" ' % (name, ret) |
1725 |
return ret |
1726 |
|
1727 |
- repo_display = RepoDisplay(self.roots) |
1728 |
+ repo_display = RepoDisplay(self._frozen_config.roots) |
1729 |
|
1730 |
tree_nodes = [] |
1731 |
display_list = [] |
1732 |
- mygraph = self.digraph.copy() |
1733 |
+ mygraph = self._dynamic_config.digraph.copy() |
1734 |
|
1735 |
# If there are any Uninstall instances, add the corresponding |
1736 |
# blockers to the digraph (useful for --tree display). |
1737 |
@@ -3508,15 +3521,15 @@ |
1738 |
executed_uninstalls = set(node for node in mylist \ |
1739 |
if isinstance(node, Package) and node.operation == "unmerge") |
1740 |
|
1741 |
- for uninstall in self._blocker_uninstalls.leaf_nodes(): |
1742 |
+ for uninstall in self._dynamic_config._blocker_uninstalls.leaf_nodes(): |
1743 |
uninstall_parents = \ |
1744 |
- self._blocker_uninstalls.parent_nodes(uninstall) |
1745 |
+ self._dynamic_config._blocker_uninstalls.parent_nodes(uninstall) |
1746 |
if not uninstall_parents: |
1747 |
continue |
1748 |
|
1749 |
# Remove the corresponding "nomerge" node and substitute |
1750 |
# the Uninstall node. |
1751 |
- inst_pkg = self._pkg_cache[ |
1752 |
+ inst_pkg = self._dynamic_config._pkg_cache[ |
1753 |
("installed", uninstall.root, uninstall.cpv, "nomerge")] |
1754 |
try: |
1755 |
mygraph.remove(inst_pkg) |
1756 |
@@ -3524,7 +3537,7 @@ |
1757 |
pass |
1758 |
|
1759 |
try: |
1760 |
- inst_pkg_blockers = self._blocker_parents.child_nodes(inst_pkg) |
1761 |
+ inst_pkg_blockers = self._dynamic_config._blocker_parents.child_nodes(inst_pkg) |
1762 |
except KeyError: |
1763 |
inst_pkg_blockers = [] |
1764 |
|
1765 |
@@ -3540,7 +3553,7 @@ |
1766 |
# Package -> Blocker -> Uninstall edges. |
1767 |
for blocker in uninstall_parents: |
1768 |
mygraph.add(uninstall, blocker) |
1769 |
- for parent in self._blocker_parents.parent_nodes(blocker): |
1770 |
+ for parent in self._dynamic_config._blocker_parents.parent_nodes(blocker): |
1771 |
if parent != inst_pkg: |
1772 |
mygraph.add(blocker, parent) |
1773 |
|
1774 |
@@ -3548,7 +3561,7 @@ |
1775 |
# of an upgrade, display Blocker -> Upgrade edges since the |
1776 |
# corresponding Blocker -> Uninstall edges will not be shown. |
1777 |
upgrade_node = \ |
1778 |
- self._slot_pkg_map[uninstall.root].get(uninstall.slot_atom) |
1779 |
+ self._dynamic_config._slot_pkg_map[uninstall.root].get(uninstall.slot_atom) |
1780 |
if upgrade_node is not None and \ |
1781 |
uninstall not in executed_uninstalls: |
1782 |
for blocker in uninstall_parents: |
1783 |
@@ -3563,7 +3576,7 @@ |
1784 |
unsatisfied_blockers.append(x) |
1785 |
continue |
1786 |
graph_key = x |
1787 |
- if "--tree" in self.myopts: |
1788 |
+ if "--tree" in self._frozen_config.myopts: |
1789 |
depth = len(tree_nodes) |
1790 |
while depth and graph_key not in \ |
1791 |
mygraph.child_nodes(tree_nodes[depth-1]): |
1792 |
@@ -3581,7 +3594,7 @@ |
1793 |
# Do not traverse to parents if this node is an |
1794 |
# an argument or a direct member of a set that has |
1795 |
# been specified as an argument (system or world). |
1796 |
- if current_node not in self._set_nodes: |
1797 |
+ if current_node not in self._dynamic_config._set_nodes: |
1798 |
parent_nodes = mygraph.parent_nodes(current_node) |
1799 |
if parent_nodes: |
1800 |
child_nodes = set(mygraph.child_nodes(current_node)) |
1801 |
@@ -3656,11 +3669,11 @@ |
1802 |
pkg_type = x[0] |
1803 |
myroot = x[1] |
1804 |
pkg_key = x[2] |
1805 |
- portdb = self.trees[myroot]["porttree"].dbapi |
1806 |
- bindb = self.trees[myroot]["bintree"].dbapi |
1807 |
- vardb = self.trees[myroot]["vartree"].dbapi |
1808 |
- vartree = self.trees[myroot]["vartree"] |
1809 |
- pkgsettings = self.pkgsettings[myroot] |
1810 |
+ portdb = self._frozen_config.trees[myroot]["porttree"].dbapi |
1811 |
+ bindb = self._frozen_config.trees[myroot]["bintree"].dbapi |
1812 |
+ vardb = self._frozen_config.trees[myroot]["vartree"].dbapi |
1813 |
+ vartree = self._frozen_config.trees[myroot]["vartree"] |
1814 |
+ pkgsettings = self._frozen_config.pkgsettings[myroot] |
1815 |
|
1816 |
fetch=" " |
1817 |
indent = " " * depth |
1818 |
@@ -3678,13 +3691,13 @@ |
1819 |
counters.blocks_satisfied += 1 |
1820 |
resolved = portage.key_expand( |
1821 |
str(x.atom).lstrip("!"), mydb=vardb, settings=pkgsettings) |
1822 |
- if "--columns" in self.myopts and "--quiet" in self.myopts: |
1823 |
+ if "--columns" in self._frozen_config.myopts and "--quiet" in self._frozen_config.myopts: |
1824 |
addl += " " + colorize(blocker_style, resolved) |
1825 |
else: |
1826 |
addl = "[%s %s] %s%s" % \ |
1827 |
(colorize(blocker_style, "blocks"), |
1828 |
addl, indent, colorize(blocker_style, resolved)) |
1829 |
- block_parents = self._blocker_parents.parent_nodes(x) |
1830 |
+ block_parents = self._dynamic_config._blocker_parents.parent_nodes(x) |
1831 |
block_parents = set([pnode[2] for pnode in block_parents]) |
1832 |
block_parents = ", ".join(block_parents) |
1833 |
if resolved!=x[2]: |
1834 |
@@ -3774,7 +3787,7 @@ |
1835 |
if ordered: |
1836 |
counters.newslot += 1 |
1837 |
|
1838 |
- if "--changelog" in self.myopts: |
1839 |
+ if "--changelog" in self._frozen_config.myopts: |
1840 |
inst_matches = vardb.match(pkg.slot_atom) |
1841 |
if inst_matches: |
1842 |
changelogs.extend(calc_changelog( |
1843 |
@@ -3850,7 +3863,7 @@ |
1844 |
# Prevent USE_EXPAND_HIDDEN flags from being hidden if they |
1845 |
# are the only thing that triggered reinstallation. |
1846 |
reinst_flags_map = {} |
1847 |
- reinstall_for_flags = self._reinstall_nodes.get(pkg) |
1848 |
+ reinstall_for_flags = self._dynamic_config._reinstall_nodes.get(pkg) |
1849 |
reinst_expand_map = None |
1850 |
if reinstall_for_flags: |
1851 |
reinst_flags_map = map_to_use_expand( |
1852 |
@@ -3892,7 +3905,7 @@ |
1853 |
if pkg_type == "ebuild" and pkg_merge: |
1854 |
try: |
1855 |
myfilesdict = portdb.getfetchsizes(pkg_key, |
1856 |
- useflags=pkg_use, debug=self.edebug) |
1857 |
+ useflags=pkg_use, debug=self._frozen_config.edebug) |
1858 |
except portage.exception.InvalidDependString, e: |
1859 |
src_uri = portdb.aux_get(pkg_key, ["SRC_URI"])[0] |
1860 |
show_invalid_depstring_notice(x, src_uri, str(e)) |
1861 |
@@ -3946,14 +3959,14 @@ |
1862 |
xs[2] = "-" + xs[2] |
1863 |
|
1864 |
mywidth = 130 |
1865 |
- if "COLUMNWIDTH" in self.settings: |
1866 |
+ if "COLUMNWIDTH" in self._frozen_config.settings: |
1867 |
try: |
1868 |
- mywidth = int(self.settings["COLUMNWIDTH"]) |
1869 |
+ mywidth = int(self._frozen_config.settings["COLUMNWIDTH"]) |
1870 |
except ValueError, e: |
1871 |
portage.writemsg("!!! %s\n" % str(e), noiselevel=-1) |
1872 |
portage.writemsg( |
1873 |
"!!! Unable to parse COLUMNWIDTH='%s'\n" % \ |
1874 |
- self.settings["COLUMNWIDTH"], noiselevel=-1) |
1875 |
+ self._frozen_config.settings["COLUMNWIDTH"], noiselevel=-1) |
1876 |
del e |
1877 |
oldlp = mywidth - 30 |
1878 |
newlp = oldlp - 30 |
1879 |
@@ -3971,7 +3984,7 @@ |
1880 |
myoldbest = blue("["+", ".join(myoldbest)+"]") |
1881 |
|
1882 |
pkg_cp = xs[0] |
1883 |
- root_config = self.roots[myroot] |
1884 |
+ root_config = self._frozen_config.roots[myroot] |
1885 |
system_set = root_config.sets["system"] |
1886 |
world_set = root_config.sets["world"] |
1887 |
|
1888 |
@@ -3981,7 +3994,7 @@ |
1889 |
pkg_system = system_set.findAtomForPackage(pkg) |
1890 |
pkg_world = world_set.findAtomForPackage(pkg) |
1891 |
if not (oneshot or pkg_world) and \ |
1892 |
- myroot == self.target_root and \ |
1893 |
+ myroot == self._frozen_config.target_root and \ |
1894 |
favorites_set.findAtomForPackage(pkg): |
1895 |
# Maybe it will be added to world now. |
1896 |
if create_world_atom(pkg, favorites_set, root_config): |
1897 |
@@ -4017,8 +4030,8 @@ |
1898 |
if x[1]!="/": |
1899 |
if myoldbest: |
1900 |
myoldbest +=" " |
1901 |
- if "--columns" in self.myopts: |
1902 |
- if "--quiet" in self.myopts: |
1903 |
+ if "--columns" in self._frozen_config.myopts: |
1904 |
+ if "--quiet" in self._frozen_config.myopts: |
1905 |
myprint=addl+" "+indent+pkgprint(pkg_cp) |
1906 |
myprint=myprint+darkblue(" "+xs[1]+xs[2])+" " |
1907 |
myprint=myprint+myoldbest |
1908 |
@@ -4048,8 +4061,8 @@ |
1909 |
myprint += indent + pkgprint(pkg_key) + " " + \ |
1910 |
myoldbest + darkgreen("to " + myroot) |
1911 |
else: |
1912 |
- if "--columns" in self.myopts: |
1913 |
- if "--quiet" in self.myopts: |
1914 |
+ if "--columns" in self._frozen_config.myopts: |
1915 |
+ if "--quiet" in self._frozen_config.myopts: |
1916 |
myprint=addl+" "+indent+pkgprint(pkg_cp) |
1917 |
myprint=myprint+" "+green(xs[1]+xs[2])+" " |
1918 |
myprint=myprint+myoldbest |
1919 |
@@ -4084,14 +4097,14 @@ |
1920 |
continue |
1921 |
p.append((myprint, verboseadd, repoadd)) |
1922 |
|
1923 |
- if "--tree" not in self.myopts and \ |
1924 |
- "--quiet" not in self.myopts and \ |
1925 |
- not self._opts_no_restart.intersection(self.myopts) and \ |
1926 |
- pkg.root == self._running_root.root and \ |
1927 |
+ if "--tree" not in self._frozen_config.myopts and \ |
1928 |
+ "--quiet" not in self._frozen_config.myopts and \ |
1929 |
+ not self._frozen_config._opts_no_restart.intersection(self._frozen_config.myopts) and \ |
1930 |
+ pkg.root == self._frozen_config._running_root.root and \ |
1931 |
portage.match_from_list( |
1932 |
portage.const.PORTAGE_PACKAGE_ATOM, [pkg]) and \ |
1933 |
not vardb.cpv_exists(pkg.cpv) and \ |
1934 |
- "--quiet" not in self.myopts: |
1935 |
+ "--quiet" not in self._frozen_config.myopts: |
1936 |
if mylist_index < len(mylist) - 1: |
1937 |
p.append(colorize("WARN", "*** Portage will stop merging at this point and reload itself,")) |
1938 |
p.append(colorize("WARN", " then resume the merge.")) |
1939 |
@@ -4123,7 +4136,7 @@ |
1940 |
if show_repos: |
1941 |
sys.stdout.write(str(repo_display)) |
1942 |
|
1943 |
- if "--changelog" in self.myopts: |
1944 |
+ if "--changelog" in self._frozen_config.myopts: |
1945 |
print |
1946 |
for revision,text in changelogs: |
1947 |
print bold('*'+revision) |
1948 |
@@ -4164,32 +4177,32 @@ |
1949 |
sys.stderr.flush() |
1950 |
|
1951 |
# This goes to stdout for parsing by programs like autounmask. |
1952 |
- for pargs, kwargs in self._unsatisfied_deps_for_display: |
1953 |
+ for pargs, kwargs in self._dynamic_config._unsatisfied_deps_for_display: |
1954 |
self._show_unsatisfied_dep(*pargs, **kwargs) |
1955 |
|
1956 |
def _display_problems(self): |
1957 |
- if self._circular_deps_for_display is not None: |
1958 |
+ if self._dynamic_config._circular_deps_for_display is not None: |
1959 |
self._show_circular_deps( |
1960 |
- self._circular_deps_for_display) |
1961 |
+ self._dynamic_config._circular_deps_for_display) |
1962 |
|
1963 |
# The user is only notified of a slot conflict if |
1964 |
# there are no unresolvable blocker conflicts. |
1965 |
- if self._unsatisfied_blockers_for_display is not None: |
1966 |
+ if self._dynamic_config._unsatisfied_blockers_for_display is not None: |
1967 |
self._show_unsatisfied_blockers( |
1968 |
- self._unsatisfied_blockers_for_display) |
1969 |
+ self._dynamic_config._unsatisfied_blockers_for_display) |
1970 |
else: |
1971 |
self._show_slot_collision_notice() |
1972 |
|
1973 |
# TODO: Add generic support for "set problem" handlers so that |
1974 |
# the below warnings aren't special cases for world only. |
1975 |
|
1976 |
- if self._missing_args: |
1977 |
+ if self._dynamic_config._missing_args: |
1978 |
world_problems = False |
1979 |
- if "world" in self._sets: |
1980 |
+ if "world" in self._dynamic_config._sets: |
1981 |
# Filter out indirect members of world (from nested sets) |
1982 |
# since only direct members of world are desired here. |
1983 |
- world_set = self.roots[self.target_root].sets["world"] |
1984 |
- for arg, atom in self._missing_args: |
1985 |
+ world_set = self._frozen_config.roots[self._frozen_config.target_root].sets["world"] |
1986 |
+ for arg, atom in self._dynamic_config._missing_args: |
1987 |
if arg.name == "world" and atom in world_set: |
1988 |
world_problems = True |
1989 |
break |
1990 |
@@ -4200,17 +4213,17 @@ |
1991 |
sys.stderr.write("!!! Please run " + \ |
1992 |
green("emaint --check world")+"\n\n") |
1993 |
|
1994 |
- if self._missing_args: |
1995 |
+ if self._dynamic_config._missing_args: |
1996 |
sys.stderr.write("\n" + colorize("BAD", "!!!") + \ |
1997 |
" Ebuilds for the following packages are either all\n") |
1998 |
sys.stderr.write(colorize("BAD", "!!!") + \ |
1999 |
" masked or don't exist:\n") |
2000 |
sys.stderr.write(" ".join(str(atom) for arg, atom in \ |
2001 |
- self._missing_args) + "\n") |
2002 |
+ self._dynamic_config._missing_args) + "\n") |
2003 |
|
2004 |
- if self._pprovided_args: |
2005 |
+ if self._dynamic_config._pprovided_args: |
2006 |
arg_refs = {} |
2007 |
- for arg, atom in self._pprovided_args: |
2008 |
+ for arg, atom in self._dynamic_config._pprovided_args: |
2009 |
if isinstance(arg, SetArg): |
2010 |
parent = arg.name |
2011 |
arg_atom = (atom, atom) |
2012 |
@@ -4222,7 +4235,7 @@ |
2013 |
refs.append(parent) |
2014 |
msg = [] |
2015 |
msg.append(bad("\nWARNING: ")) |
2016 |
- if len(self._pprovided_args) > 1: |
2017 |
+ if len(self._dynamic_config._pprovided_args) > 1: |
2018 |
msg.append("Requested packages will not be " + \ |
2019 |
"merged because they are listed in\n") |
2020 |
else: |
2021 |
@@ -4249,9 +4262,9 @@ |
2022 |
sys.stderr.write("".join(msg)) |
2023 |
|
2024 |
masked_packages = [] |
2025 |
- for pkg in self._masked_installed: |
2026 |
+ for pkg in self._dynamic_config._masked_installed: |
2027 |
root_config = pkg.root_config |
2028 |
- pkgsettings = self.pkgsettings[pkg.root] |
2029 |
+ pkgsettings = self._frozen_config.pkgsettings[pkg.root] |
2030 |
mreasons = get_masking_status(pkg, pkgsettings, root_config) |
2031 |
masked_packages.append((root_config, pkgsettings, |
2032 |
pkg.cpv, pkg.metadata, mreasons)) |
2033 |
@@ -4267,9 +4280,9 @@ |
2034 |
to the world file if necessary.""" |
2035 |
for x in ("--buildpkgonly", "--fetchonly", "--fetch-all-uri", |
2036 |
"--oneshot", "--onlydeps", "--pretend"): |
2037 |
- if x in self.myopts: |
2038 |
+ if x in self._frozen_config.myopts: |
2039 |
return |
2040 |
- root_config = self.roots[self.target_root] |
2041 |
+ root_config = self._frozen_config.roots[self._frozen_config.target_root] |
2042 |
world_set = root_config.sets["world"] |
2043 |
|
2044 |
world_locked = False |
2045 |
@@ -4280,10 +4293,10 @@ |
2046 |
if hasattr(world_set, "load"): |
2047 |
world_set.load() # maybe it's changed on disk |
2048 |
|
2049 |
- args_set = self._sets["args"] |
2050 |
- portdb = self.trees[self.target_root]["porttree"].dbapi |
2051 |
+ args_set = self._dynamic_config._sets["args"] |
2052 |
+ portdb = self._frozen_config.trees[self._frozen_config.target_root]["porttree"].dbapi |
2053 |
added_favorites = set() |
2054 |
- for x in self._set_nodes: |
2055 |
+ for x in self._dynamic_config._set_nodes: |
2056 |
pkg_type, root, pkg_key, pkg_status = x |
2057 |
if pkg_status != "nomerge": |
2058 |
continue |
2059 |
@@ -4301,7 +4314,7 @@ |
2060 |
root, portage.VDB_PATH, pkg_key, "PROVIDE"), noiselevel=-1) |
2061 |
del e |
2062 |
all_added = [] |
2063 |
- for k in self._sets: |
2064 |
+ for k in self._dynamic_config._sets: |
2065 |
if k in ("args", "world") or not root_config.sets[k].world_candidate: |
2066 |
continue |
2067 |
s = SETPREFIX + k |
2068 |
@@ -4333,8 +4346,8 @@ |
2069 |
if not isinstance(mergelist, list): |
2070 |
mergelist = [] |
2071 |
|
2072 |
- fakedb = self.mydbapi |
2073 |
- trees = self.trees |
2074 |
+ fakedb = self._dynamic_config.mydbapi |
2075 |
+ trees = self._frozen_config.trees |
2076 |
serialized_tasks = [] |
2077 |
masked_tasks = [] |
2078 |
for x in mergelist: |
2079 |
@@ -4347,7 +4360,7 @@ |
2080 |
continue |
2081 |
tree_type = self.pkg_tree_map[pkg_type] |
2082 |
mydb = trees[myroot][tree_type].dbapi |
2083 |
- db_keys = list(self._trees_orig[myroot][ |
2084 |
+ db_keys = list(self._frozen_config._trees_orig[myroot][ |
2085 |
tree_type].dbapi._aux_cache_keys) |
2086 |
try: |
2087 |
metadata = izip(db_keys, mydb.aux_get(pkg_key, db_keys)) |
2088 |
@@ -4361,35 +4374,35 @@ |
2089 |
raise portage.exception.PackageNotFound(pkg_key) |
2090 |
installed = action == "uninstall" |
2091 |
built = pkg_type != "ebuild" |
2092 |
- root_config = self.roots[myroot] |
2093 |
+ root_config = self._frozen_config.roots[myroot] |
2094 |
pkg = Package(built=built, cpv=pkg_key, |
2095 |
installed=installed, metadata=metadata, |
2096 |
operation=action, root_config=root_config, |
2097 |
type_name=pkg_type) |
2098 |
- self._pkg_cache[pkg] = pkg |
2099 |
+ self._dynamic_config._pkg_cache[pkg] = pkg |
2100 |
|
2101 |
- root_config = self.roots[pkg.root] |
2102 |
+ root_config = self._frozen_config.roots[pkg.root] |
2103 |
if "merge" == pkg.operation and \ |
2104 |
not visible(root_config.settings, pkg): |
2105 |
if skip_masked: |
2106 |
masked_tasks.append(Dependency(root=pkg.root, parent=pkg)) |
2107 |
else: |
2108 |
- self._unsatisfied_deps_for_display.append( |
2109 |
+ self._dynamic_config._unsatisfied_deps_for_display.append( |
2110 |
((pkg.root, "="+pkg.cpv), {"myparent":None})) |
2111 |
|
2112 |
fakedb[myroot].cpv_inject(pkg) |
2113 |
serialized_tasks.append(pkg) |
2114 |
- self.spinner.update() |
2115 |
+ self._frozen_config.spinner.update() |
2116 |
|
2117 |
- if self._unsatisfied_deps_for_display: |
2118 |
+ if self._dynamic_config._unsatisfied_deps_for_display: |
2119 |
return False |
2120 |
|
2121 |
- if not serialized_tasks or "--nodeps" in self.myopts: |
2122 |
- self._serialized_tasks_cache = serialized_tasks |
2123 |
- self._scheduler_graph = self.digraph |
2124 |
+ if not serialized_tasks or "--nodeps" in self._frozen_config.myopts: |
2125 |
+ self._dynamic_config._serialized_tasks_cache = serialized_tasks |
2126 |
+ self._dynamic_config._scheduler_graph = self._dynamic_config.digraph |
2127 |
else: |
2128 |
self._select_package = self._select_pkg_from_graph |
2129 |
- self.myparams.add("selective") |
2130 |
+ self._dynamic_config.myparams.add("selective") |
2131 |
# Always traverse deep dependencies in order to account for |
2132 |
# potentially unsatisfied dependencies of installed packages. |
2133 |
# This is necessary for correct --keep-going or --resume operation |
2134 |
@@ -4402,10 +4415,10 @@ |
2135 |
# deep depenedencies of a scheduled build, that build needs to |
2136 |
# be cancelled. In order for this type of situation to be |
2137 |
# recognized, deep traversal of dependencies is required. |
2138 |
- self.myparams.add("deep") |
2139 |
+ self._dynamic_config.myparams.add("deep") |
2140 |
|
2141 |
favorites = resume_data.get("favorites") |
2142 |
- args_set = self._sets["args"] |
2143 |
+ args_set = self._dynamic_config._sets["args"] |
2144 |
if isinstance(favorites, list): |
2145 |
args = self._load_favorites(favorites) |
2146 |
else: |
2147 |
@@ -4437,7 +4450,7 @@ |
2148 |
return False |
2149 |
|
2150 |
unsatisfied_deps = [] |
2151 |
- for dep in self._unsatisfied_deps: |
2152 |
+ for dep in self._dynamic_config._unsatisfied_deps: |
2153 |
if not isinstance(dep.parent, Package): |
2154 |
continue |
2155 |
if dep.parent.operation == "merge": |
2156 |
@@ -4449,7 +4462,7 @@ |
2157 |
# which is scheduled to be installed. |
2158 |
unsatisfied_install = False |
2159 |
traversed = set() |
2160 |
- dep_stack = self.digraph.parent_nodes(dep.parent) |
2161 |
+ dep_stack = self._dynamic_config.digraph.parent_nodes(dep.parent) |
2162 |
while dep_stack: |
2163 |
node = dep_stack.pop() |
2164 |
if not isinstance(node, Package): |
2165 |
@@ -4460,7 +4473,7 @@ |
2166 |
if node in traversed: |
2167 |
continue |
2168 |
traversed.add(node) |
2169 |
- dep_stack.extend(self.digraph.parent_nodes(node)) |
2170 |
+ dep_stack.extend(self._dynamic_config.digraph.parent_nodes(node)) |
2171 |
|
2172 |
if unsatisfied_install: |
2173 |
unsatisfied_deps.append(dep) |
2174 |
@@ -4472,7 +4485,7 @@ |
2175 |
# UnsatisfiedResumeDep exception. |
2176 |
raise self.UnsatisfiedResumeDep(self, |
2177 |
masked_tasks + unsatisfied_deps) |
2178 |
- self._serialized_tasks_cache = None |
2179 |
+ self._dynamic_config._serialized_tasks_cache = None |
2180 |
try: |
2181 |
self.altlist() |
2182 |
except self._unknown_internal_error: |
2183 |
@@ -4489,7 +4502,7 @@ |
2184 |
This allows Package instances to be matched with |
2185 |
DependencyArg instances during graph creation. |
2186 |
""" |
2187 |
- root_config = self.roots[self.target_root] |
2188 |
+ root_config = self._frozen_config.roots[self._frozen_config.target_root] |
2189 |
getSetAtoms = root_config.setconfig.getSetAtoms |
2190 |
sets = root_config.sets |
2191 |
args = [] |
2192 |
@@ -4502,14 +4515,14 @@ |
2193 |
s = x[len(SETPREFIX):] |
2194 |
if s not in sets: |
2195 |
continue |
2196 |
- if s in self._sets: |
2197 |
+ if s in self._dynamic_config._sets: |
2198 |
continue |
2199 |
# Recursively expand sets so that containment tests in |
2200 |
# self._get_parent_sets() properly match atoms in nested |
2201 |
# sets (like if world contains system). |
2202 |
expanded_set = InternalPackageSet( |
2203 |
initial_atoms=getSetAtoms(s)) |
2204 |
- self._sets[s] = expanded_set |
2205 |
+ self._dynamic_config._sets[s] = expanded_set |
2206 |
args.append(SetArg(arg=x, set=expanded_set, |
2207 |
root_config=root_config)) |
2208 |
else: |
2209 |
@@ -4551,147 +4564,147 @@ |
2210 |
graph in order to avoid making a potentially unsafe decision. |
2211 |
""" |
2212 |
|
2213 |
- class _dep_check_composite_db(portage.dbapi): |
2214 |
- """ |
2215 |
- A dbapi-like interface that is optimized for use in dep_check() calls. |
2216 |
- This is built on top of the existing depgraph package selection logic. |
2217 |
- Some packages that have been added to the graph may be masked from this |
2218 |
- view in order to influence the atom preference selection that occurs |
2219 |
- via dep_check(). |
2220 |
- """ |
2221 |
- def __init__(self, depgraph, root): |
2222 |
- portage.dbapi.__init__(self) |
2223 |
- self._depgraph = depgraph |
2224 |
- self._root = root |
2225 |
- self._match_cache = {} |
2226 |
- self._cpv_pkg_map = {} |
2227 |
+class _dep_check_composite_db(portage.dbapi): |
2228 |
+ """ |
2229 |
+ A dbapi-like interface that is optimized for use in dep_check() calls. |
2230 |
+ This is built on top of the existing depgraph package selection logic. |
2231 |
+ Some packages that have been added to the graph may be masked from this |
2232 |
+ view in order to influence the atom preference selection that occurs |
2233 |
+ via dep_check(). |
2234 |
+ """ |
2235 |
+ def __init__(self, depgraph, root): |
2236 |
+ portage.dbapi.__init__(self) |
2237 |
+ self._depgraph = depgraph |
2238 |
+ self._root = root |
2239 |
+ self._match_cache = {} |
2240 |
+ self._cpv_pkg_map = {} |
2241 |
|
2242 |
- def _clear_cache(self): |
2243 |
- self._match_cache.clear() |
2244 |
- self._cpv_pkg_map.clear() |
2245 |
+ def _clear_cache(self): |
2246 |
+ self._match_cache.clear() |
2247 |
+ self._cpv_pkg_map.clear() |
2248 |
|
2249 |
- def match(self, atom): |
2250 |
- ret = self._match_cache.get(atom) |
2251 |
- if ret is not None: |
2252 |
- return ret[:] |
2253 |
- orig_atom = atom |
2254 |
- if "/" not in atom: |
2255 |
- atom = self._dep_expand(atom) |
2256 |
- pkg, existing = self._depgraph._select_package(self._root, atom) |
2257 |
- if not pkg: |
2258 |
- ret = [] |
2259 |
- else: |
2260 |
- # Return the highest available from select_package() as well as |
2261 |
- # any matching slots in the graph db. |
2262 |
- slots = set() |
2263 |
- slots.add(pkg.metadata["SLOT"]) |
2264 |
- atom_cp = portage.dep_getkey(atom) |
2265 |
- if pkg.cp.startswith("virtual/"): |
2266 |
- # For new-style virtual lookahead that occurs inside |
2267 |
- # dep_check(), examine all slots. This is needed |
2268 |
- # so that newer slots will not unnecessarily be pulled in |
2269 |
- # when a satisfying lower slot is already installed. For |
2270 |
- # example, if virtual/jdk-1.4 is satisfied via kaffe then |
2271 |
- # there's no need to pull in a newer slot to satisfy a |
2272 |
- # virtual/jdk dependency. |
2273 |
- for db, pkg_type, built, installed, db_keys in \ |
2274 |
- self._depgraph._filtered_trees[self._root]["dbs"]: |
2275 |
- for cpv in db.match(atom): |
2276 |
- if portage.cpv_getkey(cpv) != pkg.cp: |
2277 |
- continue |
2278 |
- slots.add(db.aux_get(cpv, ["SLOT"])[0]) |
2279 |
- ret = [] |
2280 |
- if self._visible(pkg): |
2281 |
- self._cpv_pkg_map[pkg.cpv] = pkg |
2282 |
- ret.append(pkg.cpv) |
2283 |
- slots.remove(pkg.metadata["SLOT"]) |
2284 |
- while slots: |
2285 |
- slot_atom = "%s:%s" % (atom_cp, slots.pop()) |
2286 |
- pkg, existing = self._depgraph._select_package( |
2287 |
- self._root, slot_atom) |
2288 |
- if not pkg: |
2289 |
- continue |
2290 |
- if not self._visible(pkg): |
2291 |
- continue |
2292 |
- self._cpv_pkg_map[pkg.cpv] = pkg |
2293 |
- ret.append(pkg.cpv) |
2294 |
- if ret: |
2295 |
- self._cpv_sort_ascending(ret) |
2296 |
- self._match_cache[orig_atom] = ret |
2297 |
+ def match(self, atom): |
2298 |
+ ret = self._match_cache.get(atom) |
2299 |
+ if ret is not None: |
2300 |
return ret[:] |
2301 |
+ orig_atom = atom |
2302 |
+ if "/" not in atom: |
2303 |
+ atom = self._dep_expand(atom) |
2304 |
+ pkg, existing = self._depgraph._select_package(self._root, atom) |
2305 |
+ if not pkg: |
2306 |
+ ret = [] |
2307 |
+ else: |
2308 |
+ # Return the highest available from select_package() as well as |
2309 |
+ # any matching slots in the graph db. |
2310 |
+ slots = set() |
2311 |
+ slots.add(pkg.metadata["SLOT"]) |
2312 |
+ atom_cp = portage.dep_getkey(atom) |
2313 |
+ if pkg.cp.startswith("virtual/"): |
2314 |
+ # For new-style virtual lookahead that occurs inside |
2315 |
+ # dep_check(), examine all slots. This is needed |
2316 |
+ # so that newer slots will not unnecessarily be pulled in |
2317 |
+ # when a satisfying lower slot is already installed. For |
2318 |
+ # example, if virtual/jdk-1.4 is satisfied via kaffe then |
2319 |
+ # there's no need to pull in a newer slot to satisfy a |
2320 |
+ # virtual/jdk dependency. |
2321 |
+ for db, pkg_type, built, installed, db_keys in \ |
2322 |
+ self._depgraph._dynamic_config._filtered_trees[self._root]["dbs"]: |
2323 |
+ for cpv in db.match(atom): |
2324 |
+ if portage.cpv_getkey(cpv) != pkg.cp: |
2325 |
+ continue |
2326 |
+ slots.add(db.aux_get(cpv, ["SLOT"])[0]) |
2327 |
+ ret = [] |
2328 |
+ if self._visible(pkg): |
2329 |
+ self._cpv_pkg_map[pkg.cpv] = pkg |
2330 |
+ ret.append(pkg.cpv) |
2331 |
+ slots.remove(pkg.metadata["SLOT"]) |
2332 |
+ while slots: |
2333 |
+ slot_atom = "%s:%s" % (atom_cp, slots.pop()) |
2334 |
+ pkg, existing = self._depgraph._select_package( |
2335 |
+ self._root, slot_atom) |
2336 |
+ if not pkg: |
2337 |
+ continue |
2338 |
+ if not self._visible(pkg): |
2339 |
+ continue |
2340 |
+ self._cpv_pkg_map[pkg.cpv] = pkg |
2341 |
+ ret.append(pkg.cpv) |
2342 |
+ if ret: |
2343 |
+ self._cpv_sort_ascending(ret) |
2344 |
+ self._match_cache[orig_atom] = ret |
2345 |
+ return ret[:] |
2346 |
|
2347 |
- def _visible(self, pkg): |
2348 |
- if pkg.installed and "selective" not in self._depgraph.myparams: |
2349 |
- try: |
2350 |
- arg = self._depgraph._iter_atoms_for_pkg(pkg).next() |
2351 |
- except (StopIteration, portage.exception.InvalidDependString): |
2352 |
- arg = None |
2353 |
- if arg: |
2354 |
+ def _visible(self, pkg): |
2355 |
+ if pkg.installed and "selective" not in self._depgraph._dynamic_config.myparams: |
2356 |
+ try: |
2357 |
+ arg = self._depgraph._iter_atoms_for_pkg(pkg).next() |
2358 |
+ except (StopIteration, portage.exception.InvalidDependString): |
2359 |
+ arg = None |
2360 |
+ if arg: |
2361 |
+ return False |
2362 |
+ if pkg.installed: |
2363 |
+ try: |
2364 |
+ if not visible( |
2365 |
+ self._depgraph._frozen_config.pkgsettings[pkg.root], pkg): |
2366 |
return False |
2367 |
- if pkg.installed: |
2368 |
- try: |
2369 |
- if not visible( |
2370 |
- self._depgraph.pkgsettings[pkg.root], pkg): |
2371 |
- return False |
2372 |
- except portage.exception.InvalidDependString: |
2373 |
- pass |
2374 |
- in_graph = self._depgraph._slot_pkg_map[ |
2375 |
- self._root].get(pkg.slot_atom) |
2376 |
- if in_graph is None: |
2377 |
- # Mask choices for packages which are not the highest visible |
2378 |
- # version within their slot (since they usually trigger slot |
2379 |
- # conflicts). |
2380 |
- highest_visible, in_graph = self._depgraph._select_package( |
2381 |
- self._root, pkg.slot_atom) |
2382 |
- if pkg != highest_visible: |
2383 |
- return False |
2384 |
- elif in_graph != pkg: |
2385 |
- # Mask choices for packages that would trigger a slot |
2386 |
- # conflict with a previously selected package. |
2387 |
+ except portage.exception.InvalidDependString: |
2388 |
+ pass |
2389 |
+ in_graph = self._depgraph._dynamic_config._slot_pkg_map[ |
2390 |
+ self._root].get(pkg.slot_atom) |
2391 |
+ if in_graph is None: |
2392 |
+ # Mask choices for packages which are not the highest visible |
2393 |
+ # version within their slot (since they usually trigger slot |
2394 |
+ # conflicts). |
2395 |
+ highest_visible, in_graph = self._depgraph._select_package( |
2396 |
+ self._root, pkg.slot_atom) |
2397 |
+ if pkg != highest_visible: |
2398 |
return False |
2399 |
- return True |
2400 |
+ elif in_graph != pkg: |
2401 |
+ # Mask choices for packages that would trigger a slot |
2402 |
+ # conflict with a previously selected package. |
2403 |
+ return False |
2404 |
+ return True |
2405 |
|
2406 |
- def _dep_expand(self, atom): |
2407 |
- """ |
2408 |
- This is only needed for old installed packages that may |
2409 |
- contain atoms that are not fully qualified with a specific |
2410 |
- category. Emulate the cpv_expand() function that's used by |
2411 |
- dbapi.match() in cases like this. If there are multiple |
2412 |
- matches, it's often due to a new-style virtual that has |
2413 |
- been added, so try to filter those out to avoid raising |
2414 |
- a ValueError. |
2415 |
- """ |
2416 |
- root_config = self._depgraph.roots[self._root] |
2417 |
- orig_atom = atom |
2418 |
- expanded_atoms = self._depgraph._dep_expand(root_config, atom) |
2419 |
- if len(expanded_atoms) > 1: |
2420 |
- non_virtual_atoms = [] |
2421 |
- for x in expanded_atoms: |
2422 |
- if not portage.dep_getkey(x).startswith("virtual/"): |
2423 |
- non_virtual_atoms.append(x) |
2424 |
- if len(non_virtual_atoms) == 1: |
2425 |
- expanded_atoms = non_virtual_atoms |
2426 |
- if len(expanded_atoms) > 1: |
2427 |
- # compatible with portage.cpv_expand() |
2428 |
- raise portage.exception.AmbiguousPackageName( |
2429 |
- [portage.dep_getkey(x) for x in expanded_atoms]) |
2430 |
- if expanded_atoms: |
2431 |
- atom = expanded_atoms[0] |
2432 |
+ def _dep_expand(self, atom): |
2433 |
+ """ |
2434 |
+ This is only needed for old installed packages that may |
2435 |
+ contain atoms that are not fully qualified with a specific |
2436 |
+ category. Emulate the cpv_expand() function that's used by |
2437 |
+ dbapi.match() in cases like this. If there are multiple |
2438 |
+ matches, it's often due to a new-style virtual that has |
2439 |
+ been added, so try to filter those out to avoid raising |
2440 |
+ a ValueError. |
2441 |
+ """ |
2442 |
+ root_config = self._depgraph.roots[self._root] |
2443 |
+ orig_atom = atom |
2444 |
+ expanded_atoms = self._depgraph._dep_expand(root_config, atom) |
2445 |
+ if len(expanded_atoms) > 1: |
2446 |
+ non_virtual_atoms = [] |
2447 |
+ for x in expanded_atoms: |
2448 |
+ if not portage.dep_getkey(x).startswith("virtual/"): |
2449 |
+ non_virtual_atoms.append(x) |
2450 |
+ if len(non_virtual_atoms) == 1: |
2451 |
+ expanded_atoms = non_virtual_atoms |
2452 |
+ if len(expanded_atoms) > 1: |
2453 |
+ # compatible with portage.cpv_expand() |
2454 |
+ raise portage.exception.AmbiguousPackageName( |
2455 |
+ [portage.dep_getkey(x) for x in expanded_atoms]) |
2456 |
+ if expanded_atoms: |
2457 |
+ atom = expanded_atoms[0] |
2458 |
+ else: |
2459 |
+ null_atom = insert_category_into_atom(atom, "null") |
2460 |
+ null_cp = portage.dep_getkey(null_atom) |
2461 |
+ cat, atom_pn = portage.catsplit(null_cp) |
2462 |
+ virts_p = root_config.settings.get_virts_p().get(atom_pn) |
2463 |
+ if virts_p: |
2464 |
+ # Allow the resolver to choose which virtual. |
2465 |
+ atom = insert_category_into_atom(atom, "virtual") |
2466 |
else: |
2467 |
- null_atom = insert_category_into_atom(atom, "null") |
2468 |
- null_cp = portage.dep_getkey(null_atom) |
2469 |
- cat, atom_pn = portage.catsplit(null_cp) |
2470 |
- virts_p = root_config.settings.get_virts_p().get(atom_pn) |
2471 |
- if virts_p: |
2472 |
- # Allow the resolver to choose which virtual. |
2473 |
- atom = insert_category_into_atom(atom, "virtual") |
2474 |
- else: |
2475 |
- atom = insert_category_into_atom(atom, "null") |
2476 |
- return atom |
2477 |
+ atom = insert_category_into_atom(atom, "null") |
2478 |
+ return atom |
2479 |
|
2480 |
- def aux_get(self, cpv, wants): |
2481 |
- metadata = self._cpv_pkg_map[cpv].metadata |
2482 |
- return [metadata.get(x, "") for x in wants] |
2483 |
+ def aux_get(self, cpv, wants): |
2484 |
+ metadata = self._cpv_pkg_map[cpv].metadata |
2485 |
+ return [metadata.get(x, "") for x in wants] |
2486 |
|
2487 |
|
2488 |
def ambiguous_package_name(arg, atoms, root_config, spinner, myopts): |
2489 |
@@ -4746,7 +4759,7 @@ |
2490 |
if not skip_unsatisfied: |
2491 |
raise |
2492 |
|
2493 |
- graph = mydepgraph.digraph |
2494 |
+ graph = mydepgraph._dynamic_config.digraph |
2495 |
unsatisfied_parents = dict((dep.parent, dep.parent) \ |
2496 |
for dep in e.value) |
2497 |
traversed_nodes = set() |