Lines 107-113
def _wildcard_set(atoms):
Link Here
|
107 |
|
107 |
|
108 |
class _frozen_depgraph_config(object): |
108 |
class _frozen_depgraph_config(object): |
109 |
|
109 |
|
110 |
def __init__(self, settings, trees, myopts, spinner): |
110 |
def __init__(self, settings, trees, myopts, params, spinner): |
111 |
self.settings = settings |
111 |
self.settings = settings |
112 |
self.target_root = settings["EROOT"] |
112 |
self.target_root = settings["EROOT"] |
113 |
self.myopts = myopts |
113 |
self.myopts = myopts |
Lines 115-120
class _frozen_depgraph_config(object):
Link Here
|
115 |
if settings.get("PORTAGE_DEBUG", "") == "1": |
115 |
if settings.get("PORTAGE_DEBUG", "") == "1": |
116 |
self.edebug = 1 |
116 |
self.edebug = 1 |
117 |
self.spinner = spinner |
117 |
self.spinner = spinner |
|
|
118 |
self.requested_depth = params.get("deep", 0) |
118 |
self._running_root = trees[trees._running_eroot]["root_config"] |
119 |
self._running_root = trees[trees._running_eroot]["root_config"] |
119 |
self.pkgsettings = {} |
120 |
self.pkgsettings = {} |
120 |
self.trees = {} |
121 |
self.trees = {} |
Lines 508-514
class depgraph(object):
Link Here
|
508 |
frozen_config=None, backtrack_parameters=BacktrackParameter(), allow_backtracking=False): |
509 |
frozen_config=None, backtrack_parameters=BacktrackParameter(), allow_backtracking=False): |
509 |
if frozen_config is None: |
510 |
if frozen_config is None: |
510 |
frozen_config = _frozen_depgraph_config(settings, trees, |
511 |
frozen_config = _frozen_depgraph_config(settings, trees, |
511 |
myopts, spinner) |
512 |
myopts, myparams, spinner) |
512 |
self._frozen_config = frozen_config |
513 |
self._frozen_config = frozen_config |
513 |
self._dynamic_config = _dynamic_depgraph_config(self, myparams, |
514 |
self._dynamic_config = _dynamic_depgraph_config(self, myparams, |
514 |
allow_backtracking, backtrack_parameters) |
515 |
allow_backtracking, backtrack_parameters) |
Lines 2095-2100
class depgraph(object):
Link Here
|
2095 |
arg = arg_stack.pop() |
2096 |
arg = arg_stack.pop() |
2096 |
if arg in traversed_set_args: |
2097 |
if arg in traversed_set_args: |
2097 |
continue |
2098 |
continue |
|
|
2099 |
|
2100 |
# If a node with the same hash already exists in |
2101 |
# the digraph, preserve the existing instance which |
2102 |
# may have a different reset_depth attribute |
2103 |
# (distiguishes user arguments from sets added for |
2104 |
# another reason such as complete mode). |
2105 |
arg = self._dynamic_config.digraph.get(arg, arg) |
2098 |
traversed_set_args.add(arg) |
2106 |
traversed_set_args.add(arg) |
2099 |
|
2107 |
|
2100 |
if add_to_digraph: |
2108 |
if add_to_digraph: |
Lines 2114-2121
class depgraph(object):
Link Here
|
2114 |
if nested_set is None: |
2122 |
if nested_set is None: |
2115 |
nested_set = root_config.sets.get(s) |
2123 |
nested_set = root_config.sets.get(s) |
2116 |
if nested_set is not None: |
2124 |
if nested_set is not None: |
|
|
2125 |
# Propagate the reset_depth attribute from |
2126 |
# parent set to nested set. |
2117 |
nested_arg = SetArg(arg=token, pset=nested_set, |
2127 |
nested_arg = SetArg(arg=token, pset=nested_set, |
|
|
2128 |
reset_depth=arg.reset_depth, |
2118 |
root_config=root_config) |
2129 |
root_config=root_config) |
|
|
2130 |
|
2131 |
# Preserve instances already in the graph (same |
2132 |
# reason as for the "arg" variable above). |
2133 |
nested_arg = self._dynamic_config.digraph.get( |
2134 |
nested_arg, nested_arg) |
2119 |
arg_stack.append(nested_arg) |
2135 |
arg_stack.append(nested_arg) |
2120 |
if add_to_digraph: |
2136 |
if add_to_digraph: |
2121 |
self._dynamic_config.digraph.add(nested_arg, arg, |
2137 |
self._dynamic_config.digraph.add(nested_arg, arg, |
Lines 2164-2172
class depgraph(object):
Link Here
|
2164 |
dep.collapsed_priority.ignored): |
2180 |
dep.collapsed_priority.ignored): |
2165 |
# This is an unnecessary build-time dep. |
2181 |
# This is an unnecessary build-time dep. |
2166 |
return 1 |
2182 |
return 1 |
|
|
2183 |
|
2184 |
# NOTE: For removal actions, allow_unsatisfied is always |
2185 |
# True since all existing removal actions traverse all |
2186 |
# installed deps deeply via the _complete_graph method, |
2187 |
# which calls _create_graph with allow_unsatisfied = True. |
2167 |
if allow_unsatisfied: |
2188 |
if allow_unsatisfied: |
2168 |
self._dynamic_config._unsatisfied_deps.append(dep) |
2189 |
self._dynamic_config._unsatisfied_deps.append(dep) |
2169 |
return 1 |
2190 |
return 1 |
|
|
2191 |
|
2192 |
# The following case occurs when |
2193 |
# _solve_non_slot_operator_slot_conflicts calls |
2194 |
# _create_graph. In this case, ignore unsatisfied deps for |
2195 |
# installed packages only if their depth is beyond the depth |
2196 |
# requested by the user and the dep was initially |
2197 |
# unsatisfied (not broken by a slot conflict in the current |
2198 |
# graph). See bug #520950. |
2199 |
# NOTE: The value of dep.parent.depth is guaranteed to be |
2200 |
# either an integer or True, with the value True indicating |
2201 |
# that the parent has been pulled in by the _complete_graph |
2202 |
# method (rather than by explicit arguments or their deep |
2203 |
# dependencies). These cases must be distinguished because |
2204 |
# depth is meaningless for packages that are not reachable |
2205 |
# as deep dependencies of arguments. |
2206 |
if (self._dynamic_config._complete_mode and |
2207 |
isinstance(dep.parent, Package) and |
2208 |
dep.parent.installed and |
2209 |
(dep.parent.depth is True or |
2210 |
(self._frozen_config.requested_depth is not True and |
2211 |
dep.parent.depth >= self._frozen_config.requested_depth))): |
2212 |
inst_pkg, in_graph = \ |
2213 |
self._select_pkg_from_installed(dep.root, dep.atom) |
2214 |
if inst_pkg is None: |
2215 |
self._dynamic_config._initially_unsatisfied_deps.append(dep) |
2216 |
return 1 |
2217 |
|
2170 |
self._dynamic_config._unsatisfied_deps_for_display.append( |
2218 |
self._dynamic_config._unsatisfied_deps_for_display.append( |
2171 |
((dep.root, dep.atom), {"myparent":dep.parent})) |
2219 |
((dep.root, dep.atom), {"myparent":dep.parent})) |
2172 |
|
2220 |
|
Lines 2411-2424
class depgraph(object):
Link Here
|
2411 |
# Installing package A, we need to make sure package A's deps are met. |
2459 |
# Installing package A, we need to make sure package A's deps are met. |
2412 |
# emerge --deep <pkgspec>; we need to recursively check dependencies of pkgspec |
2460 |
# emerge --deep <pkgspec>; we need to recursively check dependencies of pkgspec |
2413 |
# If we are in --nodeps (no recursion) mode, we obviously only check 1 level of dependencies. |
2461 |
# If we are in --nodeps (no recursion) mode, we obviously only check 1 level of dependencies. |
2414 |
if arg_atoms and depth > 0: |
2462 |
if arg_atoms and (depth is True or depth > 0): |
2415 |
for parent, atom in arg_atoms: |
2463 |
for parent, atom in arg_atoms: |
2416 |
if parent.reset_depth: |
2464 |
if parent.reset_depth: |
2417 |
depth = 0 |
2465 |
depth = 0 |
2418 |
break |
2466 |
break |
2419 |
|
2467 |
|
2420 |
if previously_added and pkg.depth is not None: |
2468 |
if previously_added and isinstance(pkg.depth, int): |
2421 |
depth = min(pkg.depth, depth) |
2469 |
if depth is True: |
|
|
2470 |
depth = pkg.depth |
2471 |
else: |
2472 |
depth = min(pkg.depth, depth) |
2422 |
pkg.depth = depth |
2473 |
pkg.depth = depth |
2423 |
deep = self._dynamic_config.myparams.get("deep", 0) |
2474 |
deep = self._dynamic_config.myparams.get("deep", 0) |
2424 |
update = "--update" in self._frozen_config.myopts |
2475 |
update = "--update" in self._frozen_config.myopts |
Lines 2716-2722
class depgraph(object):
Link Here
|
2716 |
|
2767 |
|
2717 |
def _wrapped_add_pkg_dep_string(self, pkg, dep_root, dep_priority, |
2768 |
def _wrapped_add_pkg_dep_string(self, pkg, dep_root, dep_priority, |
2718 |
dep_string, allow_unsatisfied): |
2769 |
dep_string, allow_unsatisfied): |
2719 |
depth = pkg.depth + 1 |
2770 |
if pkg.depth is True: |
|
|
2771 |
depth = True |
2772 |
else: |
2773 |
depth = pkg.depth + 1 |
2720 |
deep = self._dynamic_config.myparams.get("deep", 0) |
2774 |
deep = self._dynamic_config.myparams.get("deep", 0) |
2721 |
recurse_satisfied = deep is True or depth <= deep |
2775 |
recurse_satisfied = deep is True or depth <= deep |
2722 |
debug = "--debug" in self._frozen_config.myopts |
2776 |
debug = "--debug" in self._frozen_config.myopts |
Lines 3947-3956
class depgraph(object):
Link Here
|
3947 |
# Recursively traversed virtual dependencies, and their |
4001 |
# Recursively traversed virtual dependencies, and their |
3948 |
# direct dependencies, are considered to have the same |
4002 |
# direct dependencies, are considered to have the same |
3949 |
# depth as direct dependencies. |
4003 |
# depth as direct dependencies. |
3950 |
if parent.depth is None: |
4004 |
if isinstance(parent.depth, int): |
3951 |
virt_depth = None |
|
|
3952 |
else: |
3953 |
virt_depth = parent.depth + 1 |
4005 |
virt_depth = parent.depth + 1 |
|
|
4006 |
else: |
4007 |
# The depth may be None when called via |
4008 |
# _select_atoms_probe, or it may be True |
4009 |
# for complete mode. |
4010 |
virt_depth = parent.depth |
3954 |
chosen_atom_ids = frozenset(id(atom) for atom in mycheck[1]) |
4011 |
chosen_atom_ids = frozenset(id(atom) for atom in mycheck[1]) |
3955 |
selected_atoms = OrderedDict() |
4012 |
selected_atoms = OrderedDict() |
3956 |
node_stack = [(parent, None, None)] |
4013 |
node_stack = [(parent, None, None)] |
Lines 5833-5846
class depgraph(object):
Link Here
|
5833 |
pset = root_config.sets[s] |
5890 |
pset = root_config.sets[s] |
5834 |
atom = SETPREFIX + s |
5891 |
atom = SETPREFIX + s |
5835 |
args.append(SetArg(arg=atom, pset=pset, |
5892 |
args.append(SetArg(arg=atom, pset=pset, |
5836 |
root_config=root_config)) |
5893 |
reset_depth=False, root_config=root_config)) |
5837 |
|
5894 |
|
5838 |
self._set_args(args) |
5895 |
self._set_args(args) |
5839 |
for arg in self._expand_set_args(args, add_to_digraph=True): |
5896 |
for arg in self._expand_set_args(args, add_to_digraph=True): |
5840 |
for atom in arg.pset.getAtoms(): |
5897 |
for atom in arg.pset.getAtoms(): |
5841 |
self._dynamic_config._dep_stack.append( |
5898 |
self._dynamic_config._dep_stack.append( |
5842 |
Dependency(atom=atom, root=arg.root_config.root, |
5899 |
Dependency(atom=atom, root=arg.root_config.root, |
5843 |
parent=arg)) |
5900 |
parent=arg, depth=True)) |
5844 |
|
5901 |
|
5845 |
if True: |
5902 |
if True: |
5846 |
if self._dynamic_config._ignored_deps: |
5903 |
if self._dynamic_config._ignored_deps: |
Lines 8487-8493
def _backtrack_depgraph(settings, trees, myopts, myparams, myaction, myfiles, sp
Link Here
|
8487 |
backtracked = 0 |
8544 |
backtracked = 0 |
8488 |
|
8545 |
|
8489 |
frozen_config = _frozen_depgraph_config(settings, trees, |
8546 |
frozen_config = _frozen_depgraph_config(settings, trees, |
8490 |
myopts, spinner) |
8547 |
myopts, myparams, spinner) |
8491 |
|
8548 |
|
8492 |
while backtracker: |
8549 |
while backtracker: |
8493 |
|
8550 |
|
Lines 8569-8575
def _resume_depgraph(settings, trees, mtimedb, myopts, myparams, spinner):
Link Here
|
8569 |
mergelist = mtimedb["resume"]["mergelist"] |
8626 |
mergelist = mtimedb["resume"]["mergelist"] |
8570 |
dropped_tasks = {} |
8627 |
dropped_tasks = {} |
8571 |
frozen_config = _frozen_depgraph_config(settings, trees, |
8628 |
frozen_config = _frozen_depgraph_config(settings, trees, |
8572 |
myopts, spinner) |
8629 |
myopts, myparams, spinner) |
8573 |
while True: |
8630 |
while True: |
8574 |
mydepgraph = depgraph(settings, trees, |
8631 |
mydepgraph = depgraph(settings, trees, |
8575 |
myopts, myparams, spinner, frozen_config=frozen_config) |
8632 |
myopts, myparams, spinner, frozen_config=frozen_config) |
8576 |
- |
|
|