Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 234907
Collapse All | Expand All

(-)pym/_emerge/__init__.py (-1 / +81 lines)
Lines 4484-4489 Link Here
4484
		self._irrelevant_blockers = digraph()
4484
		self._irrelevant_blockers = digraph()
4485
		# Contains only unsolvable Package -> Blocker edges
4485
		# Contains only unsolvable Package -> Blocker edges
4486
		self._unsolvable_blockers = digraph()
4486
		self._unsolvable_blockers = digraph()
4487
		# Contains all Blocker -> Blocked Package edges
4488
		self._blocked_pkgs = digraph()
4489
		# Contains world packages that have been protected from
4490
		# uninstallation but may not have been added to the graph
4491
		# if the graph is not complete yet.
4492
		self._blocked_world_pkgs = {}
4487
		self._slot_collision_info = {}
4493
		self._slot_collision_info = {}
4488
		# Slot collision nodes are not allowed to block other packages since
4494
		# Slot collision nodes are not allowed to block other packages since
4489
		# blocker validation is only able to account for one package per slot.
4495
		# blocker validation is only able to account for one package per slot.
Lines 6444-6449 Link Here
6444
						# is already done and this would be likely to
6450
						# is already done and this would be likely to
6445
						# confuse users if displayed like a normal blocker.
6451
						# confuse users if displayed like a normal blocker.
6446
						continue
6452
						continue
6453
6454
					self._blocked_pkgs.add(pkg, blocker)
6455
6447
					if parent.operation == "merge":
6456
					if parent.operation == "merge":
6448
						# Maybe the blocked package can be replaced or simply
6457
						# Maybe the blocked package can be replaced or simply
6449
						# unmerged to resolve this block.
6458
						# unmerged to resolve this block.
Lines 6462-6467 Link Here
6462
						# merge of either package is triggered.
6471
						# merge of either package is triggered.
6463
						continue
6472
						continue
6464
6473
6474
					self._blocked_pkgs.add(pkg, blocker)
6475
6465
					# Maybe the blocking package can be
6476
					# Maybe the blocking package can be
6466
					# unmerged to resolve this block.
6477
					# unmerged to resolve this block.
6467
					if parent.operation == "merge" and pkg.installed:
6478
					if parent.operation == "merge" and pkg.installed:
Lines 6514-6520 Link Here
6514
	def _accept_blocker_conflicts(self):
6525
	def _accept_blocker_conflicts(self):
6515
		acceptable = False
6526
		acceptable = False
6516
		for x in ("--buildpkgonly", "--fetchonly",
6527
		for x in ("--buildpkgonly", "--fetchonly",
6517
			"--fetch-all-uri", "--nodeps", "--pretend"):
6528
			"--fetch-all-uri", "--nodeps"):
6518
			if x in self.myopts:
6529
			if x in self.myopts:
6519
				acceptable = True
6530
				acceptable = True
6520
				break
6531
				break
Lines 6977-6982 Link Here
6977
									break
6988
									break
6978
								if not satisfied:
6989
								if not satisfied:
6979
									skip = True
6990
									skip = True
6991
									self._blocked_world_pkgs[inst_pkg] = atom
6980
									break
6992
									break
6981
						except portage.exception.InvalidDependString, e:
6993
						except portage.exception.InvalidDependString, e:
6982
							portage.writemsg("!!! Invalid PROVIDE in " + \
6994
							portage.writemsg("!!! Invalid PROVIDE in " + \
Lines 7208-7213 Link Here
7208
		portage.writemsg("\n", noiselevel=-1)
7220
		portage.writemsg("\n", noiselevel=-1)
7209
		for line in wrap(msg, 70):
7221
		for line in wrap(msg, 70):
7210
			portage.writemsg(prefix + line + "\n", noiselevel=-1)
7222
			portage.writemsg(prefix + line + "\n", noiselevel=-1)
7223
7224
		# Display the conflicting packages along with the packages
7225
		# that pulled them in. This is helpful for troubleshooting
7226
		# cases in which blockers don't solve automatically and
7227
		# the reasons are not apparent from the normal merge list
7228
		# display.
7229
7230
		conflict_pkgs = {}
7231
		for blocker in blockers:
7232
			for pkg in chain(self._blocked_pkgs.child_nodes(blocker), \
7233
				self._blocker_parents.parent_nodes(blocker)):
7234
				parent_atoms = self._parent_atoms.get(pkg)
7235
				if not parent_atoms:
7236
					atom = self._blocked_world_pkgs.get(pkg)
7237
					if atom is not None:
7238
						parent_atoms = set([("@world", atom)])
7239
				if parent_atoms:
7240
					conflict_pkgs[pkg] = parent_atoms
7241
7242
		if conflict_pkgs:
7243
			msg = []
7244
			msg.append("\n")
7245
			indent = "  "
7246
			# Max number of parents shown, to avoid flooding the display.
7247
			max_parents = 3
7248
			for pkg, parent_atoms in conflict_pkgs.iteritems():
7249
7250
				pruned_list = set()
7251
7252
				# Prefer conflict packages over others.
7253
				for parent_atom in parent_atoms:
7254
					if len(pruned_list) >= max_parents:
7255
						break
7256
					parent, atom = parent_atom
7257
					if parent in conflict_pkgs:
7258
						pruned_list.add(parent_atom)
7259
7260
				for parent_atom in parent_atoms:
7261
					if len(pruned_list) >= max_parents:
7262
						break
7263
					pruned_list.add(parent_atom)
7264
7265
				omitted_parents = len(parent_atoms) - len(pruned_list)
7266
				msg.append(indent + "%s pulled in by\n" % pkg)
7267
7268
				for parent_atom in pruned_list:
7269
					parent, atom = parent_atom
7270
					msg.append(2*indent)
7271
					if isinstance(parent,
7272
						(PackageArg, AtomArg)):
7273
						# For PackageArg and AtomArg types, it's
7274
						# redundant to display the atom attribute.
7275
						msg.append(str(parent))
7276
					else:
7277
						# Display the specific atom from SetArg or
7278
						# Package types.
7279
						msg.append("%s required by %s" % (atom, parent))
7280
					msg.append("\n")
7281
7282
				if omitted_parents:
7283
					msg.append(2*indent)
7284
					msg.append("(and %d more)\n" % omitted_parents)
7285
7286
				msg.append("\n")
7287
7288
			sys.stderr.write("".join(msg))
7289
			sys.stderr.flush()
7290
7211
		if "--quiet" not in self.myopts:
7291
		if "--quiet" not in self.myopts:
7212
			show_blocker_docs_link()
7292
			show_blocker_docs_link()
7213
7293

Return to bug 234907