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

Collapse All | Expand All

(-)pym/_emerge/depgraph.py (-11 / +31 lines)
Lines 54-60 Link Here
54
54
55
class _frozen_depgraph_config(object):
55
class _frozen_depgraph_config(object):
56
56
57
	def __init__(self, settings, trees, myopts, spinner):
57
	def __init__(self, settings, trees, myopts, spinner, allow_backtracking=False):
58
		self.settings = settings
58
		self.settings = settings
59
		self.target_root = settings["ROOT"]
59
		self.target_root = settings["ROOT"]
60
		self.myopts = myopts
60
		self.myopts = myopts
Lines 88-97 Link Here
88
				clone=self.trees[myroot]["vartree"].settings)
88
				clone=self.trees[myroot]["vartree"].settings)
89
89
90
		self._required_set_names = set(["system", "world"])
90
		self._required_set_names = set(["system", "world"])
91
		self._allow_backtracking = allow_backtracking
91
92
92
class _dynamic_depgraph_config(object):
93
class _dynamic_depgraph_config(object):
93
94
94
	def __init__(self, depgraph, myparams):
95
	def __init__(self, depgraph, myparams, runtime_pkg_mask):
95
		self.myparams = myparams
96
		self.myparams = myparams
96
		# Maps slot atom to package for each Package added to the graph.
97
		# Maps slot atom to package for each Package added to the graph.
97
		self._slot_pkg_map = {}
98
		self._slot_pkg_map = {}
Lines 155-160 Link Here
155
		self._initially_unsatisfied_deps = []
156
		self._initially_unsatisfied_deps = []
156
		self._ignored_deps = []
157
		self._ignored_deps = []
157
		self._highest_pkg_cache = {}
158
		self._highest_pkg_cache = {}
159
		self._runtime_pkg_mask = runtime_pkg_mask
160
		self._need_restart = False
158
161
159
		for myroot in depgraph._frozen_config.trees:
162
		for myroot in depgraph._frozen_config.trees:
160
			self._slot_pkg_map[myroot] = {}
163
			self._slot_pkg_map[myroot] = {}
Lines 245-256 Link Here
245
	_dep_keys = ["DEPEND", "RDEPEND", "PDEPEND"]
248
	_dep_keys = ["DEPEND", "RDEPEND", "PDEPEND"]
246
	
249
	
247
	def __init__(self, settings, trees, myopts, myparams, spinner,
250
	def __init__(self, settings, trees, myopts, myparams, spinner,
248
		frozen_config=None):	
251
		frozen_config=None, runtime_pkg_mask=[], allow_backtracking=False):
249
		if frozen_config is None:
252
		if frozen_config is None:
250
			frozen_config = _frozen_depgraph_config(settings, trees,
253
			frozen_config = _frozen_depgraph_config(settings, trees,
251
			myopts, spinner)
254
			myopts, spinner, allow_backtracking=allow_backtracking)
252
		self._frozen_config = frozen_config
255
		self._frozen_config = frozen_config
253
		self._dynamic_config = _dynamic_depgraph_config(self, myparams)
256
		self._dynamic_config = _dynamic_depgraph_config(self, myparams, runtime_pkg_mask)
254
257
255
		self._select_atoms = self._select_atoms_highest_available
258
		self._select_atoms = self._select_atoms_highest_available
256
		self._select_package = self._select_pkg_highest_available
259
		self._select_package = self._select_pkg_highest_available
Lines 696-708 Link Here
696
								(dep.parent, dep.atom))
699
								(dep.parent, dep.atom))
697
					return 1
700
					return 1
698
				else:
701
				else:
702
					# A slot collision has occurred. 
703
					if self._frozen_config._allow_backtracking:
704
						#Mask existing_node and restart dependency calculation.
705
						print "A slot collsion occured for ", existing_node.slot_atom, ". Masking ", existing_node.cpv, "."
706
						self._dynamic_config._runtime_pkg_mask.append(existing_node)
707
						self._dynamic_config._need_restart = True
708
						return 0
709
					else:
710
						#Sometimes this coincides with unresolvable blockers, \
711
						#so the slot collision will be shown later if there are \
712
						#no unresolvable blockers.
713
						self._add_slot_conflict(pkg)
714
						slot_collision = True
699
715
700
					# A slot collision has occurred.  Sometimes this coincides
701
					# with unresolvable blockers, so the slot collision will be
702
					# shown later if there are no unresolvable blockers.
703
					self._add_slot_conflict(pkg)
704
					slot_collision = True
705
706
			if slot_collision:
716
			if slot_collision:
707
				# Now add this node to the graph so that self.display()
717
				# Now add this node to the graph so that self.display()
708
				# can show use flags and --tree portage.output.  This node is
718
				# can show use flags and --tree portage.output.  This node is
Lines 1945-1950 Link Here
1945
1955
1946
				for pkg in self._iter_match_pkgs(root_config, pkg_type, atom, 
1956
				for pkg in self._iter_match_pkgs(root_config, pkg_type, atom, 
1947
					onlydeps=onlydeps):
1957
					onlydeps=onlydeps):
1958
					if pkg in self._dynamic_config._runtime_pkg_mask:
1959
						#The package has been masked by the backtracking logic
1960
						continue
1948
					cpv = pkg.cpv
1961
					cpv = pkg.cpv
1949
					# Make --noreplace take precedence over --newuse.
1962
					# Make --noreplace take precedence over --newuse.
1950
					if not pkg.installed and noreplace and \
1963
					if not pkg.installed and noreplace and \
Lines 4572-4577 Link Here
4572
		graph in order to avoid making a potentially unsafe decision.
4585
		graph in order to avoid making a potentially unsafe decision.
4573
		"""
4586
		"""
4574
4587
4588
	def need_restart(self):
4589
		return self._dynamic_config._need_restart
4590
4591
	def get_runtime_pkg_mask(self):
4592
		return self._dynamic_config._runtime_pkg_mask[:]
4593
4594
4575
class _dep_check_composite_db(portage.dbapi):
4595
class _dep_check_composite_db(portage.dbapi):
4576
	"""
4596
	"""
4577
	A dbapi-like interface that is optimized for use in dep_check() calls.
4597
	A dbapi-like interface that is optimized for use in dep_check() calls.
(-)pym/_emerge/actions.py (-17 / +27 lines)
Lines 296-321 Link Here
296
		if ("--resume" in myopts):
296
		if ("--resume" in myopts):
297
			print darkgreen("emerge: It seems we have nothing to resume...")
297
			print darkgreen("emerge: It seems we have nothing to resume...")
298
			return os.EX_OK
298
			return os.EX_OK
299
		
300
		if "--quiet" not in myopts and "--nodeps" not in myopts:
301
				print "Calculating dependencies  ",
302
				sys.stdout.flush()
299
303
300
		myparams = create_depgraph_params(myopts, myaction)
304
		runtime_pkg_mask = []
301
		if "--quiet" not in myopts and "--nodeps" not in myopts:
305
		while True:
302
			print "Calculating dependencies  ",
306
			myparams = create_depgraph_params(myopts, myaction)
303
			sys.stdout.flush()
307
			mydepgraph = depgraph(settings, trees, myopts, myparams, spinner, \
304
		mydepgraph = depgraph(settings, trees, myopts, myparams, spinner)
308
				runtime_pkg_mask=runtime_pkg_mask, allow_backtracking=True)
305
		try:
309
			try:
306
			retval, favorites = mydepgraph.select_files(myfiles)
310
				retval, favorites = mydepgraph.select_files(myfiles)
307
		except portage.exception.PackageNotFound, e:
311
			except portage.exception.PackageNotFound, e:
308
			portage.writemsg("\n!!! %s\n" % str(e), noiselevel=-1)
312
				portage.writemsg("\n!!! %s\n" % str(e), noiselevel=-1)
309
			return 1
313
				return 1
310
		except portage.exception.PackageSetNotFound, e:
314
			except portage.exception.PackageSetNotFound, e:
311
			root_config = trees[settings["ROOT"]]["root_config"]
315
				root_config = trees[settings["ROOT"]]["root_config"]
312
			display_missing_pkg_set(root_config, e.value)
316
				display_missing_pkg_set(root_config, e.value)
313
			return 1
317
				return 1
318
			if not retval:
319
				if mydepgraph.need_restart():
320
					runtime_pkg_mask = mydepgraph.get_runtime_pkg_mask()
321
				else:
322
					mydepgraph.display_problems()
323
					return 1
324
			else:
325
				break
326
314
		if show_spinner:
327
		if show_spinner:
315
			print "\b\b... done!"
328
			print "\b\b... done!"
316
		if not retval:
317
			mydepgraph.display_problems()
318
			return 1
319
329
320
	if "--pretend" not in myopts and \
330
	if "--pretend" not in myopts and \
321
		("--ask" in myopts or "--tree" in myopts or \
331
		("--ask" in myopts or "--tree" in myopts or \

Return to bug 275217