Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 520950 | Differences between
and this patch

Collapse All | Expand All

(-)a/pym/_emerge/depgraph.py (-14 / +64 lines)
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 2114-2121 class depgraph(object): Link Here
2114
					if nested_set is None:
2115
					if nested_set is None:
2115
						nested_set = root_config.sets.get(s)
2116
						nested_set = root_config.sets.get(s)
2116
					if nested_set is not None:
2117
					if nested_set is not None:
2118
						# Propagate the reset_depth attribute from
2119
						# parent set to nested set. 
2117
						nested_arg = SetArg(arg=token, pset=nested_set,
2120
						nested_arg = SetArg(arg=token, pset=nested_set,
2121
							reset_depth=arg.reset_depth,
2118
							root_config=root_config)
2122
							root_config=root_config)
2123
						# If a node with the same hash already exists in
2124
						# the digraph, keep the existing instance which
2125
						# may have a different reset_depth attribute
2126
						# (meaning that it corresponds to a user
2127
						# argument).
2128
						nested_arg = self._dynamic_config.digraph.get(nested_arg, nested_arg)
2119
						arg_stack.append(nested_arg)
2129
						arg_stack.append(nested_arg)
2120
						if add_to_digraph:
2130
						if add_to_digraph:
2121
							self._dynamic_config.digraph.add(nested_arg, arg,
2131
							self._dynamic_config.digraph.add(nested_arg, arg,
Lines 2164-2172 class depgraph(object): Link Here
2164
				dep.collapsed_priority.ignored):
2174
				dep.collapsed_priority.ignored):
2165
				# This is an unnecessary build-time dep.
2175
				# This is an unnecessary build-time dep.
2166
				return 1
2176
				return 1
2177
2178
			# NOTE: For removal actions, allow_unsatisfied is always
2179
			# True since all existing removal actions traverse all
2180
			# installed deps deeply via the _complete_graph method,
2181
			# which calls _create_graph with allow_unsatisfied = True.
2167
			if allow_unsatisfied:
2182
			if allow_unsatisfied:
2168
				self._dynamic_config._unsatisfied_deps.append(dep)
2183
				self._dynamic_config._unsatisfied_deps.append(dep)
2169
				return 1
2184
				return 1
2185
2186
			# The following case occurs when
2187
			# _solve_non_slot_operator_slot_conflicts calls
2188
			# _create_graph. In this case, ignore unsatisfied deps for
2189
			# installed packages only if their depth is beyond the depth
2190
			# requested by the user and the dep was initially
2191
			# unsatisfied (not broken by a slot conflict in the current
2192
			# graph). See bug #520950.
2193
			# NOTE: The value of dep.parent.depth is guaranteed to be
2194
			# either an integer or True, with the value True indicating
2195
			# that the parent has been pulled in by the _complete_graph
2196
			# method (rather than by explicit arguments or their deep
2197
			# dependencies). These cases must be distinguished because
2198
			# depth is meaningless for packages that are not reachable
2199
			# as deep dependencies of arguments.
2200
			if (self._dynamic_config._complete_mode and
2201
				isinstance(dep.parent, Package) and
2202
				dep.parent.installed and
2203
				(dep.parent.depth is True or
2204
				(self._frozen_config.requested_depth is not True and
2205
+				dep.parent.depth >= self._frozen_config.requested_depth))):
2206
				inst_pkg, in_graph = \
2207
					self._select_pkg_from_installed(dep.root, dep.atom)
2208
				if inst_pkg is None:
2209
					self._dynamic_config._initially_unsatisfied_deps.append(dep)
2210
					return 1
2211
2170
			self._dynamic_config._unsatisfied_deps_for_display.append(
2212
			self._dynamic_config._unsatisfied_deps_for_display.append(
2171
				((dep.root, dep.atom), {"myparent":dep.parent}))
2213
				((dep.root, dep.atom), {"myparent":dep.parent}))
2172
2214
Lines 2411-2424 class depgraph(object): Link Here
2411
		# Installing package A, we need to make sure package A's deps are met.
2453
		# 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
2454
		# 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.
2455
		# If we are in --nodeps (no recursion) mode, we obviously only check 1 level of dependencies.
2414
		if arg_atoms and depth > 0:
2456
		if arg_atoms and (depth is True or depth > 0):
2415
			for parent, atom in arg_atoms:
2457
			for parent, atom in arg_atoms:
2416
				if parent.reset_depth:
2458
				if parent.reset_depth:
2417
					depth = 0
2459
					depth = 0
2418
					break
2460
					break
2419
2461
2420
		if previously_added and pkg.depth is not None:
2462
		if previously_added and isinstance(pkg.depth, int):
2421
			depth = min(pkg.depth, depth)
2463
			if depth is True:
2464
				depth = pkg.depth
2465
			else:
2466
				depth = min(pkg.depth, depth)
2422
		pkg.depth = depth
2467
		pkg.depth = depth
2423
		deep = self._dynamic_config.myparams.get("deep", 0)
2468
		deep = self._dynamic_config.myparams.get("deep", 0)
2424
		update = "--update" in self._frozen_config.myopts
2469
		update = "--update" in self._frozen_config.myopts
Lines 2716-2722 class depgraph(object): Link Here
2716
2761
2717
	def _wrapped_add_pkg_dep_string(self, pkg, dep_root, dep_priority,
2762
	def _wrapped_add_pkg_dep_string(self, pkg, dep_root, dep_priority,
2718
		dep_string, allow_unsatisfied):
2763
		dep_string, allow_unsatisfied):
2719
		depth = pkg.depth + 1
2764
		if pkg.depth is True:
2765
			depth = True
2766
		else:
2767
			depth = pkg.depth + 1
2720
		deep = self._dynamic_config.myparams.get("deep", 0)
2768
		deep = self._dynamic_config.myparams.get("deep", 0)
2721
		recurse_satisfied = deep is True or depth <= deep
2769
		recurse_satisfied = deep is True or depth <= deep
2722
		debug = "--debug" in self._frozen_config.myopts
2770
		debug = "--debug" in self._frozen_config.myopts
Lines 3947-3956 class depgraph(object): Link Here
3947
			# Recursively traversed virtual dependencies, and their
3995
			# Recursively traversed virtual dependencies, and their
3948
			# direct dependencies, are considered to have the same
3996
			# direct dependencies, are considered to have the same
3949
			# depth as direct dependencies.
3997
			# depth as direct dependencies.
3950
			if parent.depth is None:
3998
			if isinstance(parent.depth, int):
3951
				virt_depth = None
3952
			else:
3953
				virt_depth = parent.depth + 1
3999
				virt_depth = parent.depth + 1
4000
			else:
4001
				# The depth may be None when called via
4002
				# _select_atoms_probe, or it may be True
4003
				# for complete mode.
4004
				virt_depth = parent.depth
3954
			chosen_atom_ids = frozenset(id(atom) for atom in mycheck[1])
4005
			chosen_atom_ids = frozenset(id(atom) for atom in mycheck[1])
3955
			selected_atoms = OrderedDict()
4006
			selected_atoms = OrderedDict()
3956
			node_stack = [(parent, None, None)]
4007
			node_stack = [(parent, None, None)]
Lines 5833-5846 class depgraph(object): Link Here
5833
					pset = root_config.sets[s]
5884
					pset = root_config.sets[s]
5834
				atom = SETPREFIX + s
5885
				atom = SETPREFIX + s
5835
				args.append(SetArg(arg=atom, pset=pset,
5886
				args.append(SetArg(arg=atom, pset=pset,
5836
					root_config=root_config))
5887
					reset_depth=False, root_config=root_config))
5837
5888
5838
		self._set_args(args)
5889
		self._set_args(args)
5839
		for arg in self._expand_set_args(args, add_to_digraph=True):
5890
		for arg in self._expand_set_args(args, add_to_digraph=True):
5840
			for atom in arg.pset.getAtoms():
5891
			for atom in arg.pset.getAtoms():
5841
				self._dynamic_config._dep_stack.append(
5892
				self._dynamic_config._dep_stack.append(
5842
					Dependency(atom=atom, root=arg.root_config.root,
5893
					Dependency(atom=atom, root=arg.root_config.root,
5843
						parent=arg))
5894
						parent=arg, depth=True))
5844
5895
5845
		if True:
5896
		if True:
5846
			if self._dynamic_config._ignored_deps:
5897
			if self._dynamic_config._ignored_deps:
Lines 8487-8493 def _backtrack_depgraph(settings, trees, myopts, myparams, myaction, myfiles, sp Link Here
8487
	backtracked = 0
8538
	backtracked = 0
8488
8539
8489
	frozen_config = _frozen_depgraph_config(settings, trees,
8540
	frozen_config = _frozen_depgraph_config(settings, trees,
8490
		myopts, spinner)
8541
		myopts, myparams, spinner)
8491
8542
8492
	while backtracker:
8543
	while backtracker:
8493
8544
Lines 8569-8575 def _resume_depgraph(settings, trees, mtimedb, myopts, myparams, spinner): Link Here
8569
	mergelist = mtimedb["resume"]["mergelist"]
8620
	mergelist = mtimedb["resume"]["mergelist"]
8570
	dropped_tasks = {}
8621
	dropped_tasks = {}
8571
	frozen_config = _frozen_depgraph_config(settings, trees,
8622
	frozen_config = _frozen_depgraph_config(settings, trees,
8572
		myopts, spinner)
8623
		myopts, myparams, spinner)
8573
	while True:
8624
	while True:
8574
		mydepgraph = depgraph(settings, trees,
8625
		mydepgraph = depgraph(settings, trees,
8575
			myopts, myparams, spinner, frozen_config=frozen_config)
8626
			myopts, myparams, spinner, frozen_config=frozen_config)
8576
- 

Return to bug 520950