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

(-)pym/_emerge/__init__.py (-41 / +34 lines)
Lines 4307-4313 Link Here
4307
		# to the graph.
4307
		# to the graph.
4308
		self._graph_trees = {}
4308
		self._graph_trees = {}
4309
		# All Package instances
4309
		# All Package instances
4310
		self._pkg_cache = self._package_cache(self)
4310
		self._pkg_cache = {}
4311
		for myroot in trees:
4311
		for myroot in trees:
4312
			self.trees[myroot] = {}
4312
			self.trees[myroot] = {}
4313
			# Create a RootConfig instance that references
4313
			# Create a RootConfig instance that references
Lines 5706-5711 Link Here
5706
			return ret
5706
			return ret
5707
		ret = self._select_pkg_highest_available_imp(root, atom, onlydeps=onlydeps)
5707
		ret = self._select_pkg_highest_available_imp(root, atom, onlydeps=onlydeps)
5708
		self._highest_pkg_cache[cache_key] = ret
5708
		self._highest_pkg_cache[cache_key] = ret
5709
		pkg, existing = ret
5710
		if pkg is not None:
5711
			settings = pkg.root_config.settings
5712
			if visible(settings, pkg) and not (pkg.installed and \
5713
				settings._getMissingKeywords(pkg.cpv, pkg.metadata)):
5714
				pkg.root_config.visible_pkgs.cpv_inject(pkg)
5709
		return ret
5715
		return ret
5710
5716
5711
	def _select_pkg_highest_available_imp(self, root, atom, onlydeps=False):
5717
	def _select_pkg_highest_available_imp(self, root, atom, onlydeps=False):
Lines 5829-5835 Link Here
5829
							calculated_use = True
5835
							calculated_use = True
5830
						self._pkg_cache[pkg] = pkg
5836
						self._pkg_cache[pkg] = pkg
5831
5837
5832
					if not installed or (installed and matched_packages):
5838
					if not installed or (built and matched_packages):
5833
						# Only enforce visibility on installed packages
5839
						# Only enforce visibility on installed packages
5834
						# if there is at least one other visible package
5840
						# if there is at least one other visible package
5835
						# available. By filtering installed masked packages
5841
						# available. By filtering installed masked packages
Lines 5848-5856 Link Here
5848
						# version is masked by KEYWORDS, but never
5854
						# version is masked by KEYWORDS, but never
5849
						# reinstall the same exact version only due
5855
						# reinstall the same exact version only due
5850
						# to a KEYWORDS mask.
5856
						# to a KEYWORDS mask.
5851
						if installed and matched_packages and \
5857
						if built and matched_packages:
5852
							pkgsettings._getMissingKeywords(
5858
5853
							pkg.cpv, pkg.metadata):
5854
							different_version = None
5859
							different_version = None
5855
							for avail_pkg in matched_packages:
5860
							for avail_pkg in matched_packages:
5856
								if not portage.dep.cpvequal(
5861
								if not portage.dep.cpvequal(
Lines 5858-5867 Link Here
5858
									different_version = avail_pkg
5863
									different_version = avail_pkg
5859
									break
5864
									break
5860
							if different_version is not None:
5865
							if different_version is not None:
5861
								# Only reinstall for KEYWORDS if
5862
								# it's not the same version.
5863
								continue
5864
5866
5867
								if installed and \
5868
									pkgsettings._getMissingKeywords(
5869
									pkg.cpv, pkg.metadata):
5870
									continue
5871
5872
								# If the ebuild no longer exists or it's
5873
								# keywords have been dropped, reject built
5874
								# instances (installed or binary).
5875
								# If --usepkgonly is enabled, assume that
5876
								# the ebuild status should be ignored.
5877
								if not usepkgonly:
5878
									try:
5879
										pkg_eb = self._pkg(
5880
											pkg.cpv, "ebuild", root_config)
5881
									except portage.exception.PackageNotFound:
5882
										continue
5883
									else:
5884
										if not visible(pkgsettings, pkg_eb):
5885
											continue
5886
5865
					if not pkg.built and not calculated_use:
5887
					if not pkg.built and not calculated_use:
5866
						# This is avoided whenever possible because
5888
						# This is avoided whenever possible because
5867
						# it's expensive.
5889
						# it's expensive.
Lines 5997-6018 Link Here
5997
					if pkg.cp == cp]
6019
					if pkg.cp == cp]
5998
				break
6020
				break
5999
6021
6000
		# If the installed version is in a different slot and it is higher than
6001
		# the highest available visible package, _iter_atoms_for_pkg() may fail
6002
		# to properly match the available package with a corresponding argument
6003
		# atom. Detect this case and correct it here.
6004
		if not selective and len(matched_packages) > 1 and \
6005
			matched_packages[-1].installed and \
6006
			matched_packages[-1].slot_atom != \
6007
			matched_packages[-2].slot_atom and \
6008
			matched_packages[-1] > matched_packages[-2]:
6009
			pkg = matched_packages[-2]
6010
			if pkg.root == self.target_root and \
6011
				self._set_atoms.findAtomForPackage(pkg):
6012
				# Select the available package instead
6013
				# of the installed package.
6014
				matched_packages.pop()
6015
6016
		if len(matched_packages) > 1:
6022
		if len(matched_packages) > 1:
6017
			bestmatch = portage.best(
6023
			bestmatch = portage.best(
6018
				[pkg.cpv for pkg in matched_packages])
6024
				[pkg.cpv for pkg in matched_packages])
Lines 6149-6155 Link Here
6149
			db = root_config.trees[tree_type].dbapi
6155
			db = root_config.trees[tree_type].dbapi
6150
			db_keys = list(self._trees_orig[root_config.root][
6156
			db_keys = list(self._trees_orig[root_config.root][
6151
				tree_type].dbapi._aux_cache_keys)
6157
				tree_type].dbapi._aux_cache_keys)
6152
			metadata = izip(db_keys, db.aux_get(cpv, db_keys))
6158
			try:
6159
				metadata = izip(db_keys, db.aux_get(cpv, db_keys))
6160
			except KeyError:
6161
				raise portage.exception.PackageNotFound(cpv)
6153
			pkg = Package(cpv=cpv, metadata=metadata,
6162
			pkg = Package(cpv=cpv, metadata=metadata,
6154
				root_config=root_config, installed=installed)
6163
				root_config=root_config, installed=installed)
6155
			if type_name == "ebuild":
6164
			if type_name == "ebuild":
Lines 8453-8474 Link Here
8453
			metadata = self._cpv_pkg_map[cpv].metadata
8462
			metadata = self._cpv_pkg_map[cpv].metadata
8454
			return [metadata.get(x, "") for x in wants]
8463
			return [metadata.get(x, "") for x in wants]
8455
8464
8456
	class _package_cache(dict):
8457
		def __init__(self, depgraph):
8458
			dict.__init__(self)
8459
			self._depgraph = depgraph
8460
8461
		def __setitem__(self, k, v):
8462
			dict.__setitem__(self, k, v)
8463
			root_config = self._depgraph.roots[v.root]
8464
			try:
8465
				if visible(root_config.settings, v) and \
8466
					not (v.installed and \
8467
					v.root_config.settings._getMissingKeywords(v.cpv, v.metadata)):
8468
					root_config.visible_pkgs.cpv_inject(v)
8469
			except portage.exception.InvalidDependString:
8470
				pass
8471
8472
class RepoDisplay(object):
8465
class RepoDisplay(object):
8473
	def __init__(self, roots):
8466
	def __init__(self, roots):
8474
		self._shown_repos = {}
8467
		self._shown_repos = {}

Return to bug 252167