Gentoo Archives: gentoo-commits

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