View | Details | Raw Unified
Collapse All | Expand All

(-) pym/_emerge/__init__.py (-41 / +34 lines)
 Lines 4307-4313    Link Here 
		# to the graph.
		# to the graph.
		self._graph_trees = {}
		self._graph_trees = {}
		# All Package instances
		# All Package instances
		self._pkg_cache = self._package_cache(self)
		self._pkg_cache = {}
		for myroot in trees:
		for myroot in trees:
			self.trees[myroot] = {}
			self.trees[myroot] = {}
			# Create a RootConfig instance that references
			# Create a RootConfig instance that references
 Lines 5706-5711    Link Here 
			return ret
			return ret
		ret = self._select_pkg_highest_available_imp(root, atom, onlydeps=onlydeps)
		ret = self._select_pkg_highest_available_imp(root, atom, onlydeps=onlydeps)
		self._highest_pkg_cache[cache_key] = ret
		self._highest_pkg_cache[cache_key] = ret
		pkg, existing = ret
		if pkg is not None:
			settings = pkg.root_config.settings
			if visible(settings, pkg) and not (pkg.installed and \
				settings._getMissingKeywords(pkg.cpv, pkg.metadata)):
				pkg.root_config.visible_pkgs.cpv_inject(pkg)
		return ret
		return ret
	def _select_pkg_highest_available_imp(self, root, atom, onlydeps=False):
	def _select_pkg_highest_available_imp(self, root, atom, onlydeps=False):
 Lines 5829-5835    Link Here 
							calculated_use = True
							calculated_use = True
						self._pkg_cache[pkg] = pkg
						self._pkg_cache[pkg] = pkg
					if not installed or (installed and matched_packages):
					if not installed or (built and matched_packages):
						# Only enforce visibility on installed packages
						# Only enforce visibility on installed packages
						# if there is at least one other visible package
						# if there is at least one other visible package
						# available. By filtering installed masked packages
						# available. By filtering installed masked packages
 Lines 5848-5856    Link Here 
						# version is masked by KEYWORDS, but never
						# version is masked by KEYWORDS, but never
						# reinstall the same exact version only due
						# reinstall the same exact version only due
						# to a KEYWORDS mask.
						# to a KEYWORDS mask.
						if installed and matched_packages and \
						if built and matched_packages:
							pkgsettings._getMissingKeywords(
							pkg.cpv, pkg.metadata):
							different_version = None
							different_version = None
							for avail_pkg in matched_packages:
							for avail_pkg in matched_packages:
								if not portage.dep.cpvequal(
								if not portage.dep.cpvequal(
 Lines 5858-5867    Link Here 
									different_version = avail_pkg
									different_version = avail_pkg
									break
									break
							if different_version is not None:
							if different_version is not None:
								# Only reinstall for KEYWORDS if
								# it's not the same version.
								continue
								if installed and \
									pkgsettings._getMissingKeywords(
									pkg.cpv, pkg.metadata):
									continue
								# If the ebuild no longer exists or it's
								# keywords have been dropped, reject built
								# instances (installed or binary).
								# If --usepkgonly is enabled, assume that
								# the ebuild status should be ignored.
								if not usepkgonly:
									try:
										pkg_eb = self._pkg(
											pkg.cpv, "ebuild", root_config)
									except portage.exception.PackageNotFound:
										continue
									else:
										if not visible(pkgsettings, pkg_eb):
											continue
					if not pkg.built and not calculated_use:
					if not pkg.built and not calculated_use:
						# This is avoided whenever possible because
						# This is avoided whenever possible because
						# it's expensive.
						# it's expensive.
 Lines 5997-6018    Link Here 
					if pkg.cp == cp]
					if pkg.cp == cp]
				break
				break
		# If the installed version is in a different slot and it is higher than
		# the highest available visible package, _iter_atoms_for_pkg() may fail
		# to properly match the available package with a corresponding argument
		# atom. Detect this case and correct it here.
		if not selective and len(matched_packages) > 1 and \
			matched_packages[-1].installed and \
			matched_packages[-1].slot_atom != \
			matched_packages[-2].slot_atom and \
			matched_packages[-1] > matched_packages[-2]:
			pkg = matched_packages[-2]
			if pkg.root == self.target_root and \
				self._set_atoms.findAtomForPackage(pkg):
				# Select the available package instead
				# of the installed package.
				matched_packages.pop()
		if len(matched_packages) > 1:
		if len(matched_packages) > 1:
			bestmatch = portage.best(
			bestmatch = portage.best(
				[pkg.cpv for pkg in matched_packages])
				[pkg.cpv for pkg in matched_packages])
 Lines 6149-6155    Link Here 
			db = root_config.trees[tree_type].dbapi
			db = root_config.trees[tree_type].dbapi
			db_keys = list(self._trees_orig[root_config.root][
			db_keys = list(self._trees_orig[root_config.root][
				tree_type].dbapi._aux_cache_keys)
				tree_type].dbapi._aux_cache_keys)
			metadata = izip(db_keys, db.aux_get(cpv, db_keys))
			try:
				metadata = izip(db_keys, db.aux_get(cpv, db_keys))
			except KeyError:
				raise portage.exception.PackageNotFound(cpv)
			pkg = Package(cpv=cpv, metadata=metadata,
			pkg = Package(cpv=cpv, metadata=metadata,
				root_config=root_config, installed=installed)
				root_config=root_config, installed=installed)
			if type_name == "ebuild":
			if type_name == "ebuild":
 Lines 8453-8474    Link Here 
			metadata = self._cpv_pkg_map[cpv].metadata
			metadata = self._cpv_pkg_map[cpv].metadata
			return [metadata.get(x, "") for x in wants]
			return [metadata.get(x, "") for x in wants]
	class _package_cache(dict):
		def __init__(self, depgraph):
			dict.__init__(self)
			self._depgraph = depgraph
		def __setitem__(self, k, v):
			dict.__setitem__(self, k, v)
			root_config = self._depgraph.roots[v.root]
			try:
				if visible(root_config.settings, v) and \
					not (v.installed and \
					v.root_config.settings._getMissingKeywords(v.cpv, v.metadata)):
					root_config.visible_pkgs.cpv_inject(v)
			except portage.exception.InvalidDependString:
				pass
class RepoDisplay(object):
class RepoDisplay(object):
	def __init__(self, roots):
	def __init__(self, roots):
		self._shown_repos = {}
		self._shown_repos = {}