public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: pym/_emerge/resolver/, pym/_emerge/
@ 2011-06-21  7:58 Zac Medico
  0 siblings, 0 replies; 15+ messages in thread
From: Zac Medico @ 2011-06-21  7:58 UTC (permalink / raw
  To: gentoo-commits

commit:     bd3a6386eb50fdab72f092a4c0585ef152c7019e
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 21 07:57:59 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Jun 21 07:57:59 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=bd3a6386

extract_affecting_use: less strict for installed

---
 pym/_emerge/depgraph.py                     |    8 ++++++--
 pym/_emerge/resolver/circular_dependency.py |   10 ++++++++--
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 80409b0..c22215b 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -2668,8 +2668,12 @@ class depgraph(object):
 
 				affecting_use = set()
 				for dep_str in dep_strings:
-					affecting_use.update(extract_affecting_use(dep_str, atom,
-						eapi=node.metadata["EAPI"]))
+					try:
+						affecting_use.update(extract_affecting_use(
+							dep_str, atom, eapi=node.metadata["EAPI"]))
+					except InvalidDependString:
+						if not node.installed:
+							raise
 
 				#Don't show flags as 'affecting' if the user can't change them,
 				affecting_use.difference_update(node.use.mask, \

diff --git a/pym/_emerge/resolver/circular_dependency.py b/pym/_emerge/resolver/circular_dependency.py
index 08dd5c5..aabc174 100644
--- a/pym/_emerge/resolver/circular_dependency.py
+++ b/pym/_emerge/resolver/circular_dependency.py
@@ -6,6 +6,7 @@ from __future__ import print_function
 from itertools import chain
 
 from portage.dep import use_reduce, extract_affecting_use, check_required_use, get_required_use_flags
+from portage.exception import InvalidDependString
 from portage.output import colorize
 from _emerge.DepPrioritySatisfiedRange import DepPrioritySatisfiedRange
 
@@ -112,8 +113,13 @@ class circular_dependency_handler(object):
 					parent_atom = atom.unevaluated_atom
 					break
 
-			affecting_use = extract_affecting_use(dep, parent_atom,
-				eapi=parent.metadata["EAPI"])
+			try:
+				affecting_use = extract_affecting_use(dep, parent_atom,
+					eapi=parent.metadata["EAPI"])
+			except InvalidDependString:
+				if not parent.installed:
+					raise
+				affecting_use = set()
 
 			# Make sure we don't want to change a flag that is 
 			#	a) in use.mask or use.force



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/_emerge/resolver/, pym/_emerge/
@ 2011-06-27  0:18 Zac Medico
  0 siblings, 0 replies; 15+ messages in thread
From: Zac Medico @ 2011-06-27  0:18 UTC (permalink / raw
  To: gentoo-commits

commit:     c3f0895fb89c7b0647428de37eb0f893939d93f7
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 27 00:16:07 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Jun 27 00:16:07 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=c3f0895f

Package: add use.expand/expand_hidden attributes

This allows the merge list display to account for repository-level
USE_EXPAND and USE_EXPAND_HIDDEN settings (see bug #370693).

---
 pym/_emerge/Package.py         |   21 ++++++++++++++++++++-
 pym/_emerge/resolver/output.py |   13 +++++--------
 2 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/pym/_emerge/Package.py b/pym/_emerge/Package.py
index 593e0d3..7a25638 100644
--- a/pym/_emerge/Package.py
+++ b/pym/_emerge/Package.py
@@ -389,10 +389,13 @@ class Package(Task):
 
 	class _use_class(object):
 
-		__slots__ = ("enabled", "_force", "_pkg", "_mask")
+		__slots__ = ("enabled", "_expand", "_expand_hidden",
+			"_force", "_pkg", "_mask")
 
 		def __init__(self, pkg, use_str):
 			self._pkg = pkg
+			self._expand = None
+			self._expand_hidden = None
 			self._force = None
 			self._mask = None
 			self.enabled = frozenset(use_str.split())
@@ -407,10 +410,26 @@ class Package(Task):
 
 		def _init_force_mask(self):
 			pkgsettings = self._pkg._get_pkgsettings()
+			self._expand = frozenset(
+				pkgsettings.get("USE_EXPAND", "").lower().split())
+			self._expand_hidden = frozenset(
+				pkgsettings.get("USE_EXPAND_HIDDEN", "").lower().split())
 			self._force = pkgsettings.useforce
 			self._mask = pkgsettings.usemask
 
 		@property
+		def expand(self):
+			if self._expand is None:
+				self._init_force_mask()
+			return self._expand
+
+		@property
+		def expand_hidden(self):
+			if self._expand_hidden is None:
+				self._init_force_mask()
+			return self._expand_hidden
+
+		@property
 		def force(self):
 			if self._force is None:
 				self._init_force_mask()

diff --git a/pym/_emerge/resolver/output.py b/pym/_emerge/resolver/output.py
index 6c3579f..69a30cc 100644
--- a/pym/_emerge/resolver/output.py
+++ b/pym/_emerge/resolver/output.py
@@ -151,11 +151,8 @@ class Display(object):
 
 		self.old_use = [flag for flag in self.old_use if flag in self.old_iuse]
 
-		self.use_expand = self.pkgsettings["USE_EXPAND"].lower().split()
-		self.use_expand.sort()
-		self.use_expand.reverse()
-		self.use_expand_hidden = \
-			self.pkgsettings["USE_EXPAND_HIDDEN"].lower().split()
+		self.use_expand = pkg.use.expand
+		self.use_expand_hidden = pkg.use.expand_hidden
 		return
 
 	def include_mask_str(self):
@@ -253,10 +250,10 @@ class Display(object):
 		old_iuse_map = self.map_to_use_expand(self.old_iuse)
 		old_use_map = self.map_to_use_expand(self.old_use)
 
-		self.use_expand.sort()
-		self.use_expand.insert(0, "USE")
+		use_expand = sorted(self.use_expand)
+		use_expand.insert(0, "USE")
 
-		for key in self.use_expand:
+		for key in use_expand:
 			if key in self.use_expand_hidden:
 				continue
 			self.verboseadd += _create_use_string(self.conf, key.upper(),



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/_emerge/resolver/, pym/_emerge/
@ 2011-07-09 22:55 Zac Medico
  0 siblings, 0 replies; 15+ messages in thread
From: Zac Medico @ 2011-07-09 22:55 UTC (permalink / raw
  To: gentoo-commits

commit:     da3ad6bd4e0adc5ee928f1886c9c147c637706f2
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Jul  9 22:54:47 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Jul  9 22:54:47 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=da3ad6bd

circular_dependency: show debug graph earlier

This might help in some cases like bug 374397 where we're
troubleshooting the circular_dependency code.

---
 pym/_emerge/depgraph.py                     |    3 +--
 pym/_emerge/resolver/circular_dependency.py |   10 ++++++++++
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 899d04e..64ed50e 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -5497,8 +5497,7 @@ class depgraph(object):
 			noiselevel=-1)
 		portage.writemsg("\n", noiselevel=-1)
 
-		if handler.circular_dep_message is None or \
-			"--debug" in self._frozen_config.myopts:
+		if handler.circular_dep_message is None:
 			handler.debug_print()
 			portage.writemsg("\n", noiselevel=-1)
 

diff --git a/pym/_emerge/resolver/circular_dependency.py b/pym/_emerge/resolver/circular_dependency.py
index 9a3286c..994e202 100644
--- a/pym/_emerge/resolver/circular_dependency.py
+++ b/pym/_emerge/resolver/circular_dependency.py
@@ -4,10 +4,12 @@
 from __future__ import print_function
 
 from itertools import chain, product
+import logging
 
 from portage.dep import use_reduce, extract_affecting_use, check_required_use, get_required_use_flags
 from portage.exception import InvalidDependString
 from portage.output import colorize
+from portage.util import writemsg_level
 from _emerge.DepPrioritySatisfiedRange import DepPrioritySatisfiedRange
 
 class circular_dependency_handler(object):
@@ -17,6 +19,14 @@ class circular_dependency_handler(object):
 		self.graph = graph
 		self.all_parent_atoms = depgraph._dynamic_config._parent_atoms
 
+		if "--debug" in depgraph._frozen_config.myopts:
+			# Show this debug output before doing the calculations
+			# that follow, so at least we have this debug info
+			# if we happen to hit a bug later.
+			writemsg_level("\n\ncircular dependency graph:\n\n",
+				level=logging.DEBUG, noiselevel=-1)
+			self.debug_print()
+
 		self.cycles, self.shortest_cycle = self._find_cycles()
 		#Guess if it is a large cluster of cycles. This usually requires
 		#a global USE change.



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/_emerge/resolver/, pym/_emerge/
@ 2011-12-18  2:07 Arfrever Frehtes Taifersar Arahesis
  0 siblings, 0 replies; 15+ messages in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2011-12-18  2:07 UTC (permalink / raw
  To: gentoo-commits

commit:     d1672181743ed2a4a62b542f197fc1321a699d17
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Gentoo <DOT> Org>
AuthorDate: Sun Dec 18 02:06:38 2011 +0000
Commit:     Arfrever Frehtes Taifersar Arahesis <arfrever <AT> gentoo <DOT> org>
CommitDate: Sun Dec 18 02:06:38 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d1672181

Fix some warnings found by pylint.

---
 pym/_emerge/AsynchronousLock.py      |    4 +-
 pym/_emerge/BinpkgExtractorAsync.py  |    3 +-
 pym/_emerge/BlockerCache.py          |    2 +-
 pym/_emerge/EbuildExecuter.py        |    2 -
 pym/_emerge/FakeVartree.py           |    2 -
 pym/_emerge/PipeReader.py            |    2 +-
 pym/_emerge/actions.py               |   19 ++++++--------
 pym/_emerge/depgraph.py              |   45 +++++++--------------------------
 pym/_emerge/main.py                  |    7 +----
 pym/_emerge/resolver/backtracking.py |    2 +-
 10 files changed, 25 insertions(+), 63 deletions(-)

diff --git a/pym/_emerge/AsynchronousLock.py b/pym/_emerge/AsynchronousLock.py
index 9d0545b..ae3bde4 100644
--- a/pym/_emerge/AsynchronousLock.py
+++ b/pym/_emerge/AsynchronousLock.py
@@ -10,7 +10,7 @@ import sys
 try:
 	import threading
 except ImportError:
-	import dummy_threading as threading
+	threading = dummy_threading
 
 import portage
 from portage import os
@@ -117,7 +117,7 @@ class _LockThread(AbstractPollTask):
 		self._files = {}
 		self._files['pipe_read'] = pr
 		self._files['pipe_write'] = pw
-		for k, f in self._files.items():
+		for f in self._files.values():
 			fcntl.fcntl(f, fcntl.F_SETFL,
 				fcntl.fcntl(f, fcntl.F_GETFL) | os.O_NONBLOCK)
 		self._reg_id = self.scheduler.register(self._files['pipe_read'],

diff --git a/pym/_emerge/BinpkgExtractorAsync.py b/pym/_emerge/BinpkgExtractorAsync.py
index d1630f2..f25cbf9 100644
--- a/pym/_emerge/BinpkgExtractorAsync.py
+++ b/pym/_emerge/BinpkgExtractorAsync.py
@@ -1,9 +1,8 @@
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 from _emerge.SpawnProcess import SpawnProcess
 import portage
-import os
 import signal
 
 class BinpkgExtractorAsync(SpawnProcess):

diff --git a/pym/_emerge/BlockerCache.py b/pym/_emerge/BlockerCache.py
index 0076828..57e9d2c 100644
--- a/pym/_emerge/BlockerCache.py
+++ b/pym/_emerge/BlockerCache.py
@@ -145,7 +145,7 @@ class BlockerCache(portage.cache.mappings.MutableMapping):
 				f.close()
 				portage.util.apply_secpass_permissions(
 					self._cache_filename, gid=portage.portage_gid, mode=0o644)
-			except (IOError, OSError) as e:
+			except (IOError, OSError):
 				pass
 			self._modified.clear()
 

diff --git a/pym/_emerge/EbuildExecuter.py b/pym/_emerge/EbuildExecuter.py
index f8febd4..2b8f120 100644
--- a/pym/_emerge/EbuildExecuter.py
+++ b/pym/_emerge/EbuildExecuter.py
@@ -34,8 +34,6 @@ class EbuildExecuter(CompositeTask):
 		cleanup = 0
 		portage.prepare_build_dirs(pkg.root, settings, cleanup)
 
-		portdb = pkg.root_config.trees['porttree'].dbapi
-		ebuild_path = settings['EBUILD']
 		alist = settings.configdict["pkg"].get("A", "").split()
 		_prepare_fake_distdir(settings, alist)
 

diff --git a/pym/_emerge/FakeVartree.py b/pym/_emerge/FakeVartree.py
index 626d471..e1e5757 100644
--- a/pym/_emerge/FakeVartree.py
+++ b/pym/_emerge/FakeVartree.py
@@ -167,8 +167,6 @@ class FakeVartree(vartree):
 		real_vardb = self._root_config.trees["vartree"].dbapi
 		current_cpv_set = frozenset(real_vardb.cpv_all())
 		pkg_vardb = self.dbapi
-		pkg_cache = self._pkg_cache
-		aux_get_history = self._aux_get_history
 
 		# Remove any packages that have been uninstalled.
 		for pkg in list(pkg_vardb):

diff --git a/pym/_emerge/PipeReader.py b/pym/_emerge/PipeReader.py
index b162fe5..0f784cf 100644
--- a/pym/_emerge/PipeReader.py
+++ b/pym/_emerge/PipeReader.py
@@ -26,7 +26,7 @@ class PipeReader(AbstractPollTask):
 		else:
 			output_handler = self._output_handler
 
-		for k, f in self.input_files.items():
+		for f in self.input_files.values():
 			fcntl.fcntl(f.fileno(), fcntl.F_SETFL,
 				fcntl.fcntl(f.fileno(), fcntl.F_GETFL) | os.O_NONBLOCK)
 			self._reg_ids.add(self.scheduler.register(f.fileno(),

diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
index b3d0b12..1725053 100644
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -187,8 +187,7 @@ def action_build(settings, trees, mtimedb,
 			" entire repository or category at once."
 		prefix = bad(" * ")
 		writemsg(prefix + "\n")
-		from textwrap import wrap
-		for line in wrap(msg, 72):
+		for line in textwrap.wrap(msg, 72):
 			writemsg("%s%s\n" % (prefix, line))
 		writemsg(prefix + "\n")
 
@@ -216,7 +215,6 @@ def action_build(settings, trees, mtimedb,
 			if isinstance(e, depgraph.UnsatisfiedResumeDep):
 				mydepgraph = e.depgraph
 
-			from textwrap import wrap
 			from portage.output import EOutput
 			out = EOutput()
 
@@ -255,7 +253,7 @@ def action_build(settings, trees, mtimedb,
 					"to skip the first package in the list and " + \
 					"any other packages that may be " + \
 					"masked or have missing dependencies."
-				for line in wrap(msg, 72):
+				for line in textwrap.wrap(msg, 72):
 					out.eerror(line)
 			elif isinstance(e, portage.exception.PackageNotFound):
 				out.eerror("An expected package is " + \
@@ -265,7 +263,7 @@ def action_build(settings, trees, mtimedb,
 					"packages that are no longer " + \
 					"available. Please restart/continue " + \
 					"the operation manually."
-				for line in wrap(msg, 72):
+				for line in textwrap.wrap(msg, 72):
 					out.eerror(line)
 
 		if success:
@@ -1066,9 +1064,8 @@ def calc_depclean(settings, trees, ldpath_mtimes,
 				"the packages that pulled them in."
 
 			prefix = bad(" * ")
-			from textwrap import wrap
 			writemsg_level("".join(prefix + "%s\n" % line for \
-				line in wrap(msg, 70)), level=logging.WARNING, noiselevel=-1)
+				line in textwrap.wrap(msg, 70)), level=logging.WARNING, noiselevel=-1)
 
 			msg = []
 			for pkg in sorted(consumer_map, key=cmp_sort_key(cmp_pkg_cpv)):
@@ -2755,8 +2752,8 @@ def adjust_config(myopts, settings):
 	if settings.get("NOCOLOR") not in ("yes","true"):
 		portage.output.havecolor = 1
 
-	"""The explicit --color < y | n > option overrides the NOCOLOR environment
-	variable and stdout auto-detection."""
+	# The explicit --color < y | n > option overrides the NOCOLOR environment
+	# variable and stdout auto-detection.
 	if "--color" in myopts:
 		if "y" == myopts["--color"]:
 			portage.output.havecolor = 1
@@ -2828,7 +2825,7 @@ def getportageversion(portdir, _unused, profile, chost, vardb):
 		for cpv in sorted(libclist):
 			libc_split = portage.catpkgsplit(cpv)[1:]
 			if libc_split[-1] == "r0":
-				libc_split[:-1]
+				libc_split = libc_split[:-1]
 			libcver.append("-".join(libc_split))
 	else:
 		libcver = ["unavailable"]
@@ -2987,7 +2984,7 @@ def load_emerge_config(trees=None):
 			kwargs[k] = v
 	trees = portage.create_trees(trees=trees, **kwargs)
 
-	for root, root_trees in trees.items():
+	for root_trees in trees.values():
 		settings = root_trees["vartree"].settings
 		settings._init_dirs()
 		setconfig = load_default_config(settings, root_trees)

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 63365cd..93819c6 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -928,7 +928,6 @@ class depgraph(object):
 		buildpkgonly = "--buildpkgonly" in self._frozen_config.myopts
 		nodeps = "--nodeps" in self._frozen_config.myopts
 		deep = self._dynamic_config.myparams.get("deep", 0)
-		recurse = deep is True or dep.depth <= deep
 		if dep.blocker:
 			if not buildpkgonly and \
 				not nodeps and \
@@ -973,7 +972,7 @@ class depgraph(object):
 			# infinite backtracking loop.
 			if self._dynamic_config._allow_backtracking:
 				if dep.parent in self._dynamic_config._runtime_pkg_mask:
-					if "--debug" in self._frozen_config.myopts:
+					if debug:
 						writemsg(
 							"!!! backtracking loop detected: %s %s\n" % \
 							(dep.parent,
@@ -988,7 +987,7 @@ class depgraph(object):
 					if dep_pkg is None:
 						self._dynamic_config._backtrack_infos["missing dependency"] = dep
 						self._dynamic_config._need_restart = True
-						if "--debug" in self._frozen_config.myopts:
+						if debug:
 							msg = []
 							msg.append("")
 							msg.append("")
@@ -1069,8 +1068,6 @@ class depgraph(object):
 		# are never processed more than once.
 		previously_added = pkg in self._dynamic_config.digraph
 
-		# select the correct /var database that we'll be checking against
-		vardbapi = self._frozen_config.trees[pkg.root]["vartree"].dbapi
 		pkgsettings = self._frozen_config.pkgsettings[pkg.root]
 
 		arg_atoms = None
@@ -1311,12 +1308,11 @@ class depgraph(object):
 				self._dynamic_config.digraph.add(pkg, parent, priority=priority)
 				self._add_parent_atom(pkg, parent_atom)
 
-		""" This section determines whether we go deeper into dependencies or not.
-			We want to go deeper on a few occasions:
-			Installing package A, we need to make sure package A's deps are met.
-			emerge --deep <pkgspec>; we need to recursively check dependencies of pkgspec
-			If we are in --nodeps (no recursion) mode, we obviously only check 1 level of dependencies.
-		"""
+		# This section determines whether we go deeper into dependencies or not.
+		# We want to go deeper on a few occasions:
+		# Installing package A, we need to make sure package A's deps are met.
+		# emerge --deep <pkgspec>; we need to recursively check dependencies of pkgspec
+		# If we are in --nodeps (no recursion) mode, we obviously only check 1 level of dependencies.
 		if arg_atoms:
 			depth = 0
 		pkg.depth = depth
@@ -1366,11 +1362,7 @@ class depgraph(object):
 
 		mytype = pkg.type_name
 		myroot = pkg.root
-		mykey = pkg.cpv
 		metadata = pkg.metadata
-		myuse = self._pkg_use_enabled(pkg)
-		jbigkey = pkg
-		depth = pkg.depth + 1
 		removal_action = "remove" in self._dynamic_config.myparams
 
 		edepend={}
@@ -1434,7 +1426,6 @@ class depgraph(object):
 		)
 
 		debug = "--debug" in self._frozen_config.myopts
-		strict = mytype != "installed"
 
 		for dep_root, dep_string, dep_priority in deps:
 				if not dep_string:
@@ -1527,7 +1518,7 @@ class depgraph(object):
 			selected_atoms = self._select_atoms(dep_root,
 				dep_string, myuse=self._pkg_use_enabled(pkg), parent=pkg,
 				strict=strict, priority=dep_priority)
-		except portage.exception.InvalidDependString as e:
+		except portage.exception.InvalidDependString:
 			if pkg.installed:
 				self._dynamic_config._masked_installed.add(pkg)
 				return 1
@@ -1777,7 +1768,7 @@ class depgraph(object):
 			pkg_atom_map.setdefault(pkg, set()).add(atom)
 			cp_pkg_map.setdefault(pkg.cp, set()).add(pkg)
 
-		for cp, pkgs in cp_pkg_map.items():
+		for pkgs in cp_pkg_map.values():
 			if len(pkgs) < 2:
 				for pkg in pkgs:
 					for atom in pkg_atom_map[pkg]:
@@ -1932,7 +1923,6 @@ class depgraph(object):
 	def _iter_atoms_for_pkg(self, pkg):
 		depgraph_sets = self._dynamic_config.sets[pkg.root]
 		atom_arg_map = depgraph_sets.atom_arg_map
-		root_config = self._frozen_config.roots[pkg.root]
 		for atom in depgraph_sets.atoms.iterAtomsForPackage(pkg):
 			if atom.cp != pkg.cp and \
 				self._have_new_virt(pkg.root, atom.cp):
@@ -1971,7 +1961,6 @@ class depgraph(object):
 		myfavorites=[]
 		eroot = root_config.root
 		root = root_config.settings['ROOT']
-		dbs = self._dynamic_config._filtered_trees[eroot]["dbs"]
 		vardb = self._frozen_config.trees[eroot]["vartree"].dbapi
 		real_vardb = self._frozen_config._trees_orig[eroot]["vartree"].dbapi
 		portdb = self._frozen_config.trees[eroot]["porttree"].dbapi
@@ -2948,7 +2937,6 @@ class depgraph(object):
 		missing_use_adjustable = set()
 		required_use_unsatisfied = []
 		masked_pkg_instances = set()
-		missing_licenses = []
 		have_eapi_mask = False
 		pkgsettings = self._frozen_config.pkgsettings[root]
 		root_config = self._frozen_config.roots[root]
@@ -2959,7 +2947,6 @@ class depgraph(object):
 		for db, pkg_type, built, installed, db_keys in dbs:
 			if installed:
 				continue
-			match = db.match
 			if hasattr(db, "xmatch"):
 				cpv_list = db.xmatch("match-all-cpv-only", atom.without_use)
 			else:
@@ -3478,7 +3465,6 @@ class depgraph(object):
 		self._dynamic_config._highest_pkg_cache[cache_key] = ret
 		pkg, existing = ret
 		if pkg is not None:
-			settings = pkg.root_config.settings
 			if self._pkg_visibility_check(pkg) and \
 				not (pkg.installed and pkg.masks):
 				self._dynamic_config._visible_pkgs[pkg.root].cpv_inject(pkg)
@@ -3740,7 +3726,6 @@ class depgraph(object):
 		pkgsettings = self._frozen_config.pkgsettings[root]
 		dbs = self._dynamic_config._filtered_trees[root]["dbs"]
 		vardb = self._frozen_config.roots[root].trees["vartree"].dbapi
-		portdb = self._frozen_config.roots[root].trees["porttree"].dbapi
 		# List of acceptable packages, ordered by type preference.
 		matched_packages = []
 		matched_pkgs_ignore_use = []
@@ -4433,9 +4418,6 @@ class depgraph(object):
 			"--nodeps" in self._frozen_config.myopts:
 			return True
 
-		complete = "complete" in self._dynamic_config.myparams
-		deep = "deep" in self._dynamic_config.myparams
-
 		if True:
 			# Pull in blockers from all installed packages that haven't already
 			# been pulled into the depgraph, in order to ensure that they are
@@ -4450,10 +4432,8 @@ class depgraph(object):
 			dep_keys = ["RDEPEND", "PDEPEND"]
 			for myroot in self._frozen_config.trees:
 				vardb = self._frozen_config.trees[myroot]["vartree"].dbapi
-				portdb = self._frozen_config.trees[myroot]["porttree"].dbapi
 				pkgsettings = self._frozen_config.pkgsettings[myroot]
 				root_config = self._frozen_config.roots[myroot]
-				dbs = self._dynamic_config._filtered_trees[myroot]["dbs"]
 				final_db = self._dynamic_config.mydbapi[myroot]
 
 				blocker_cache = BlockerCache(myroot, vardb)
@@ -6355,7 +6335,6 @@ class depgraph(object):
 
 		args_set = self._dynamic_config.sets[
 			self._frozen_config.target_root].sets['__non_set_args__']
-		portdb = self._frozen_config.trees[self._frozen_config.target_root]["porttree"].dbapi
 		added_favorites = set()
 		for x in self._dynamic_config._set_nodes:
 			if x.operation != "nomerge":
@@ -6419,15 +6398,12 @@ class depgraph(object):
 			mergelist = []
 
 		favorites = resume_data.get("favorites")
-		args_set = self._dynamic_config.sets[
-			self._frozen_config.target_root].sets['__non_set_args__']
 		if isinstance(favorites, list):
 			args = self._load_favorites(favorites)
 		else:
 			args = []
 
 		fakedb = self._dynamic_config.mydbapi
-		trees = self._frozen_config.trees
 		serialized_tasks = []
 		masked_tasks = []
 		for x in mergelist:
@@ -7085,7 +7061,6 @@ def _resume_depgraph(settings, trees, mtimedb, myopts, myparams, spinner):
 
 def get_mask_info(root_config, cpv, pkgsettings,
 	db, pkg_type, built, installed, db_keys, myrepo = None, _pkg_use_enabled=None):
-	eapi_masked = False
 	try:
 		metadata = dict(zip(db_keys,
 			db.aux_get(cpv, db_keys, myrepo=myrepo)))
@@ -7195,7 +7170,7 @@ def _get_masking_status(pkg, pkgsettings, root_config, myrepo=None, use=None):
 				pkg.metadata["CHOST"]))
 
 	if pkg.invalid:
-		for msg_type, msgs in pkg.invalid.items():
+		for msgs in pkg.invalid.values():
 			for msg in msgs:
 				mreasons.append(
 					_MaskReason("invalid", "invalid: %s" % (msg,)))

diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index ce73c17..0a9bd1d 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -10,7 +10,6 @@ import sys
 import textwrap
 import platform
 import portage
-import portage
 portage.proxy.lazyimport.lazyimport(globals(),
 	'portage.news:count_unread_news,display_news_notifications',
 )
@@ -253,7 +252,6 @@ def display_preserved_libs(vardbapi, myopts):
 		linkmap = vardbapi._linkmap
 		consumer_map = {}
 		owners = {}
-		linkmap_broken = False
 
 		try:
 			linkmap.rebuild()
@@ -261,7 +259,6 @@ def display_preserved_libs(vardbapi, myopts):
 			writemsg_level("!!! Command Not Found: %s\n" % (e,),
 				level=logging.ERROR, noiselevel=-1)
 			del e
-			linkmap_broken = True
 		else:
 			search_for_owners = set()
 			for cpv in plibdata:
@@ -603,8 +600,6 @@ def parse_opts(tmpcmdline, silent=False):
 	myopts = {}
 	myfiles=[]
 
-	global options, shortmapping
-
 	actions = frozenset([
 		"clean", "check-news", "config", "depclean", "help",
 		"info", "list-sets", "metadata", "moo",
@@ -1562,7 +1557,7 @@ def config_protect_check(trees):
 def profile_check(trees, myaction):
 	if myaction in ("help", "info", "search", "sync", "version"):
 		return os.EX_OK
-	for root, root_trees in trees.items():
+	for root_trees in trees.values():
 		if root_trees["root_config"].settings.profiles:
 			continue
 		# generate some profile related warning messages

diff --git a/pym/_emerge/resolver/backtracking.py b/pym/_emerge/resolver/backtracking.py
index e072275..f2857b0 100644
--- a/pym/_emerge/resolver/backtracking.py
+++ b/pym/_emerge/resolver/backtracking.py
@@ -47,7 +47,7 @@ class BacktrackParameter(object):
 			self.reinstall_list == other.reinstall_list
 
 
-class _BacktrackNode:
+class _BacktrackNode(object):
 
 	__slots__ = (
 		"parameter", "depth", "mask_steps", "terminal",



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/_emerge/resolver/, pym/_emerge/
@ 2011-12-19 20:44 Zac Medico
  0 siblings, 0 replies; 15+ messages in thread
From: Zac Medico @ 2011-12-19 20:44 UTC (permalink / raw
  To: gentoo-commits

commit:     a323da487a2380484e6c23514cc1f75b8e8ceaaf
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 19 20:44:47 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Dec 19 20:44:47 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a323da48

Display EROOT when ROOT != "/".

Since commit a715b65f7bd36409c1283e6911265d1f4405ab7a, the Package.root
and RootConfig.root attributes refer to EROOT instead of ROOT.
Therefore, adjust display code so that EROOT is only displayed when
ROOT != "/".

---
 pym/_emerge/MergeListItem.py           |    2 +-
 pym/_emerge/PackageMerge.py            |    2 +-
 pym/_emerge/Scheduler.py               |    8 ++++----
 pym/_emerge/depgraph.py                |   10 +++++-----
 pym/_emerge/main.py                    |    5 +++--
 pym/_emerge/resolver/output.py         |    2 +-
 pym/_emerge/resolver/slot_collision.py |    2 +-
 7 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/pym/_emerge/MergeListItem.py b/pym/_emerge/MergeListItem.py
index 2176bf6..8086c68 100644
--- a/pym/_emerge/MergeListItem.py
+++ b/pym/_emerge/MergeListItem.py
@@ -68,7 +68,7 @@ class MergeListItem(CompositeTask):
 					pkg_repo_name = "unknown repo"
 				msg += " from %s" % pkg_repo_name
 
-		if pkg.root != "/":
+		if pkg.root_config.settings["ROOT"] != "/":
 			msg += " %s %s" % (preposition, pkg.root)
 
 		if not build_opts.pretend:

diff --git a/pym/_emerge/PackageMerge.py b/pym/_emerge/PackageMerge.py
index f8fa04a..eed34e9 100644
--- a/pym/_emerge/PackageMerge.py
+++ b/pym/_emerge/PackageMerge.py
@@ -28,7 +28,7 @@ class PackageMerge(CompositeTask):
 			counter_str,
 			colorize("GOOD", pkg.cpv))
 
-		if pkg.root != "/":
+		if pkg.root_config.settings["ROOT"] != "/":
 			msg += " %s %s" % (preposition, pkg.root)
 
 		if not self.merge.build_opts.fetchonly and \

diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py
index 3800b8b..d09b474 100644
--- a/pym/_emerge/Scheduler.py
+++ b/pym/_emerge/Scheduler.py
@@ -425,7 +425,7 @@ class Scheduler(PollScheduler):
 				msg = [""]
 				for pkg in interactive_tasks:
 					pkg_str = "  " + colorize("INFORM", str(pkg.cpv))
-					if pkg.root != "/":
+					if pkg.root_config.settings["ROOT"] != "/":
 						pkg_str += " for " + pkg.root
 					msg.append(pkg_str)
 				msg.append("")
@@ -1251,7 +1251,7 @@ class Scheduler(PollScheduler):
 
 		# Skip this if $ROOT != / since it shouldn't matter if there
 		# are unsatisfied system runtime deps in this case.
-		if pkg.root != '/':
+		if pkg.root_config.settings["ROOT"] != "/":
 			return
 
 		completed_tasks = self._completed_tasks
@@ -1711,7 +1711,7 @@ class Scheduler(PollScheduler):
 		pkg = failed_pkg.pkg
 		msg = "%s to %s %s" % \
 			(bad("Failed"), action, colorize("INFORM", pkg.cpv))
-		if pkg.root != "/":
+		if pkg.root_config.settings["ROOT"] != "/":
 			msg += " %s %s" % (preposition, pkg.root)
 
 		log_path = self._locate_failure_log(failed_pkg)
@@ -1841,7 +1841,7 @@ class Scheduler(PollScheduler):
 			pkg = task
 			msg = "emerge --keep-going:" + \
 				" %s" % (pkg.cpv,)
-			if pkg.root != "/":
+			if pkg.root_config.settings["ROOT"] != "/":
 				msg += " for %s" % (pkg.root,)
 			msg += " dropped due to unsatisfied dependency."
 			for line in textwrap.wrap(msg, msg_width):

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 93819c6..2c44ce1 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -594,7 +594,7 @@ class depgraph(object):
 
 		for pkg, flags in self._dynamic_config.ignored_binaries.items():
 			writemsg("    =%s" % pkg.cpv, noiselevel=-1)
-			if pkg.root != '/':
+			if pkg.root_config.settings["ROOT"] != "/":
 				writemsg(" for %s" % (pkg.root,), noiselevel=-1)
 			writemsg("\n        use flag(s): %s\n" % ", ".join(sorted(flags)),
 				noiselevel=-1)
@@ -679,7 +679,7 @@ class depgraph(object):
 				"due to unsatisfied dependencies:\n\n", noiselevel=-1)
 
 			writemsg(str(pkg.slot_atom), noiselevel=-1)
-			if pkg.root != '/':
+			if pkg.root_config.settings["ROOT"] != "/":
 				writemsg(" for %s" % (pkg.root,), noiselevel=-1)
 			writemsg("\n", noiselevel=-1)
 
@@ -695,7 +695,7 @@ class depgraph(object):
 				"!!! triggered by backtracking:\n\n", noiselevel=-1)
 			for pkg, parent_atoms in backtrack_masked:
 				writemsg(str(pkg.slot_atom), noiselevel=-1)
-				if pkg.root != '/':
+				if pkg.root_config.settings["ROOT"] != "/":
 					writemsg(" for %s" % (pkg.root,), noiselevel=-1)
 				writemsg("\n", noiselevel=-1)
 
@@ -712,7 +712,7 @@ class depgraph(object):
 		indent = "  "
 		for pkg, parent_atoms in missed_updates:
 			msg.append(str(pkg.slot_atom))
-			if pkg.root != '/':
+			if pkg.root_config.settings["ROOT"] != "/":
 				msg.append(" for %s" % (pkg.root,))
 			msg.append("\n\n")
 
@@ -2930,7 +2930,7 @@ class depgraph(object):
 			xinfo = _unicode_decode('"%s"') % (myparent,)
 		# Discard null/ from failed cpv_expand category expansion.
 		xinfo = xinfo.replace("null/", "")
-		if root != "/":
+		if root != self._frozen_config._running_root.root:
 			xinfo = "%s for %s" % (xinfo, root)
 		masked_packages = []
 		missing_use = []

diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index 0a9bd1d..d02f2a6 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -1547,9 +1547,10 @@ def repo_name_duplicate_check(trees):
 
 def config_protect_check(trees):
 	for root, root_trees in trees.items():
-		if not root_trees["root_config"].settings.get("CONFIG_PROTECT"):
+		settings = root_trees["root_config"].settings
+		if not settings.get("CONFIG_PROTECT"):
 			msg = "!!! CONFIG_PROTECT is empty"
-			if root != "/":
+			if settings["ROOT"] != "/":
 				msg += " for '%s'" % root
 			msg += "\n"
 			writemsg_level(msg, level=logging.WARN, noiselevel=-1)

diff --git a/pym/_emerge/resolver/output.py b/pym/_emerge/resolver/output.py
index b73b190..bed5e44 100644
--- a/pym/_emerge/resolver/output.py
+++ b/pym/_emerge/resolver/output.py
@@ -833,7 +833,7 @@ class Display(object):
 				if self.include_mask_str():
 					addl += self.gen_mask_str(pkg)
 
-				if pkg.root != "/":
+				if pkg.root_config.settings["ROOT"] != "/":
 					if pkg_info.oldbest:
 						pkg_info.oldbest += " "
 					if self.conf.columns:

diff --git a/pym/_emerge/resolver/slot_collision.py b/pym/_emerge/resolver/slot_collision.py
index 3207138..1d522aa 100644
--- a/pym/_emerge/resolver/slot_collision.py
+++ b/pym/_emerge/resolver/slot_collision.py
@@ -244,7 +244,7 @@ class slot_conflict_handler(object):
 		for (slot_atom, root), pkgs \
 			in self.slot_collision_info.items():
 			msg.append(str(slot_atom))
-			if root != '/':
+			if root != self.depgraph._frozen_config._running_root.root:
 				msg.append(" for %s" % (root,))
 			msg.append("\n\n")
 



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/_emerge/resolver/, pym/_emerge/
@ 2012-01-20 23:44 Arfrever Frehtes Taifersar Arahesis
  0 siblings, 0 replies; 15+ messages in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2012-01-20 23:44 UTC (permalink / raw
  To: gentoo-commits

commit:     95d6ed5e34d59b5ba42d36cfc3554296007d060b
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Gentoo <DOT> Org>
AuthorDate: Fri Jan 20 23:40:52 2012 +0000
Commit:     Arfrever Frehtes Taifersar Arahesis <arfrever <AT> gentoo <DOT> org>
CommitDate: Fri Jan 20 23:40:52 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=95d6ed5e

Print ::${repository} in output of `emerge -pv ${package}` by default.
Add --quiet-repo-display option, which enables previous, more quiet output.

---
 pym/_emerge/main.py                    |    1 +
 pym/_emerge/resolver/output.py         |   60 +++++++++++++++++++++++---------
 pym/_emerge/resolver/output_helpers.py |    3 +-
 3 files changed, 46 insertions(+), 18 deletions(-)

diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index d02f2a6..65df99d 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -66,6 +66,7 @@ options=[
 "--nodeps",       "--noreplace",
 "--nospinner",    "--oneshot",
 "--onlydeps",     "--pretend",
+"--quiet-repo-display",
 "--quiet-unmerge-warn",
 "--resume",
 "--searchdesc",

diff --git a/pym/_emerge/resolver/output.py b/pym/_emerge/resolver/output.py
index bed5e44..15f9225 100644
--- a/pym/_emerge/resolver/output.py
+++ b/pym/_emerge/resolver/output.py
@@ -13,7 +13,7 @@ import sys
 from portage import os
 from portage import _unicode_decode
 from portage.dbapi.dep_expand import dep_expand
-from portage.dep import cpvequal
+from portage.dep import cpvequal, _repo_separator
 from portage.exception import InvalidDependString, SignatureException
 from portage.output import ( blue, bold, colorize, create_color_func,
 	darkblue, darkgreen, green, nc_len, red, teal, turquoise, yellow )
@@ -339,6 +339,9 @@ class Display(object):
 					self.counters.totalsize += mysize
 			self.verboseadd += _format_size(mysize)
 
+		if not self.quiet_repo_display:
+			return
+
 		# overlay verbose
 		# assign index for a previous version in the same slot
 		slot_matches = self.vardb.match(pkg.slot_atom)
@@ -368,8 +371,7 @@ class Display(object):
 			repoadd_set.add(self.repoadd)
 
 
-	@staticmethod
-	def convert_myoldbest(myoldbest):
+	def convert_myoldbest(self, myoldbest):
 		"""converts and colorizes a version list to a string
 
 		@param myoldbest: list
@@ -384,6 +386,8 @@ class Display(object):
 					"-" + catpkgsplit(pkg.cpv)[3]
 				if key[-3:] == "-r0":
 					key = key[:-3]
+				if self.conf.verbosity == 3 and not self.quiet_repo_display:
+					key += _repo_separator + pkg.repo
 				versions.append(key)
 			myoldbest_str = blue("["+", ".join(versions)+"]")
 		return myoldbest_str
@@ -412,10 +416,13 @@ class Display(object):
 		@param pkg: _emerge.Package instance
 		@rtype string
 		"""
+		ver_str = pkg_info.ver
+		if self.conf.verbosity == 3 and not self.quiet_repo_display:
+			ver_str += _repo_separator + pkg.repo
 		if self.conf.quiet:
 			myprint = addl + " " + self.indent + \
 				self.pkgprint(pkg_info.cp, pkg_info)
-			myprint = myprint+darkblue(" "+pkg_info.ver)+" "
+			myprint = myprint+darkblue(" "+ver_str)+" "
 			myprint = myprint+pkg_info.oldbest
 			myprint = myprint+darkgreen("to "+pkg.root)
 			self.verboseadd = None
@@ -430,7 +437,7 @@ class Display(object):
 					self.indent, self.pkgprint(pkg.cp, pkg_info))
 			if (self.newlp-nc_len(myprint)) > 0:
 				myprint = myprint+(" "*(self.newlp-nc_len(myprint)))
-			myprint = myprint+"["+darkblue(pkg_info.ver)+"] "
+			myprint = myprint+"["+darkblue(ver_str)+"] "
 			if (self.oldlp-nc_len(myprint)) > 0:
 				myprint = myprint+" "*(self.oldlp-nc_len(myprint))
 			myprint = myprint+pkg_info.oldbest
@@ -447,10 +454,13 @@ class Display(object):
 		@rtype string
 		Modifies self.verboseadd
 		"""
+		ver_str = pkg_info.ver
+		if self.conf.verbosity == 3 and not self.quiet_repo_display:
+			ver_str += _repo_separator + pkg.repo
 		if self.conf.quiet:
 			myprint = addl + " " + self.indent + \
 				self.pkgprint(pkg_info.cp, pkg_info)
-			myprint = myprint+" "+green(pkg_info.ver)+" "
+			myprint = myprint+" "+green(ver_str)+" "
 			myprint = myprint+pkg_info.oldbest
 			self.verboseadd = None
 		else:
@@ -465,7 +475,7 @@ class Display(object):
 					self.indent, self.pkgprint(pkg.cp, pkg_info))
 			if (self.newlp-nc_len(myprint)) > 0:
 				myprint = myprint+(" "*(self.newlp-nc_len(myprint)))
-			myprint = myprint+green(" ["+pkg_info.ver+"] ")
+			myprint = myprint+green(" ["+ver_str+"] ")
 			if (self.oldlp-nc_len(myprint)) > 0:
 				myprint = myprint+(" "*(self.oldlp-nc_len(myprint)))
 			myprint += pkg_info.oldbest
@@ -480,18 +490,21 @@ class Display(object):
 		@param addl: the current text to add for the next line to output
 		@rtype the updated addl
 		"""
+		pkg_str = pkg.cpv
+		if self.conf.verbosity == 3 and not self.quiet_repo_display:
+			pkg_str += _repo_separator + pkg.repo
 		if not pkg_info.merge:
 			addl = self.empty_space_in_brackets()
 			myprint = "[%s%s] %s%s %s" % \
 				(self.pkgprint(pkg_info.operation.ljust(13),
 				pkg_info), addl,
-				self.indent, self.pkgprint(pkg.cpv, pkg_info),
+				self.indent, self.pkgprint(pkg_str, pkg_info),
 				pkg_info.oldbest)
 		else:
 			myprint = "[%s %s] %s%s %s" % \
 				(self.pkgprint(pkg.type_name, pkg_info),
 				addl, self.indent,
-				self.pkgprint(pkg.cpv, pkg_info), pkg_info.oldbest)
+				self.pkgprint(pkg_str, pkg_info), pkg_info.oldbest)
 		return myprint
 
 
@@ -795,9 +808,12 @@ class Display(object):
 		# files to fetch list - avoids counting a same file twice
 		# in size display (verbose mode)
 		self.myfetchlist = set()
-		# Use this set to detect when all the "repoadd" strings are "[0]"
-		# and disable the entire repo display in this case.
-		repoadd_set = set()
+		
+		self.quiet_repo_display = "--quiet-repo-display" in depgraph._frozen_config.myopts
+		if self.quiet_repo_display:
+			# Use this set to detect when all the "repoadd" strings are "[0]"
+			# and disable the entire repo display in this case.
+			repoadd_set = set()
 
 		for mylist_index in range(len(mylist)):
 			pkg, depth, ordered = mylist[mylist_index]
@@ -814,11 +830,15 @@ class Display(object):
 				addl, pkg_info.oldbest, myinslotlist = \
 					self._get_installed_best(pkg, pkg_info)
 				self.verboseadd = ""
-				self.repoadd = None
+				if self.quiet_repo_display:
+					self.repoadd = None
 				self._display_use(pkg, pkg_info.oldbest, myinslotlist)
 				self.recheck_hidden(pkg)
 				if self.conf.verbosity == 3:
-					self.verbose_size(pkg, repoadd_set, pkg_info)
+					if self.quiet_repo_display:
+						self.verbose_size(pkg, repoadd_set, pkg_info)
+					else:
+						self.verbose_size(pkg, None, pkg_info)
 
 				pkg_info.cp = pkg.cp
 				pkg_info.ver = self.get_ver_str(pkg)
@@ -840,6 +860,9 @@ class Display(object):
 						myprint = self._set_non_root_columns(
 							addl, pkg_info, pkg)
 					else:
+						pkg_str = pkg.cpv
+						if self.conf.verbosity == 3 and not self.quiet_repo_display:
+							pkg_str += _repo_separator + pkg.repo
 						if not pkg_info.merge:
 							addl = self.empty_space_in_brackets()
 							myprint = "[%s%s] " % (
@@ -850,7 +873,7 @@ class Display(object):
 							myprint = "[%s %s] " % (
 								self.pkgprint(pkg.type_name, pkg_info), addl)
 						myprint += self.indent + \
-							self.pkgprint(pkg.cpv, pkg_info) + " " + \
+							self.pkgprint(pkg_str, pkg_info) + " " + \
 							pkg_info.oldbest + darkgreen("to " + pkg.root)
 				else:
 					if self.conf.columns:
@@ -862,9 +885,12 @@ class Display(object):
 
 				if self.conf.columns and pkg.operation == "uninstall":
 					continue
-				self.print_msg.append((myprint, self.verboseadd, self.repoadd))
+				if self.quiet_repo_display:
+					self.print_msg.append((myprint, self.verboseadd, self.repoadd))
+				else:
+					self.print_msg.append((myprint, self.verboseadd, None))
 
-		show_repos = repoadd_set and repoadd_set != set(["0"])
+		show_repos = self.quiet_repo_display and repoadd_set and repoadd_set != set(["0"])
 
 		# now finally print out the messages
 		self.print_messages(show_repos)

diff --git a/pym/_emerge/resolver/output_helpers.py b/pym/_emerge/resolver/output_helpers.py
index 4587661..5e5e106 100644
--- a/pym/_emerge/resolver/output_helpers.py
+++ b/pym/_emerge/resolver/output_helpers.py
@@ -211,7 +211,8 @@ class _DisplayConfig(object):
 				del e
 		self.columnwidth = mywidth
 
-		self.repo_display = _RepoDisplay(frozen_config.roots)
+		if "--quiet-repo-display" in frozen_config.myopts:
+			self.repo_display = _RepoDisplay(frozen_config.roots)
 		self.trees = frozen_config.trees
 		self.pkgsettings = frozen_config.pkgsettings
 		self.target_root = frozen_config.target_root



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/_emerge/resolver/, pym/_emerge/
@ 2012-06-19 21:27 Zac Medico
  0 siblings, 0 replies; 15+ messages in thread
From: Zac Medico @ 2012-06-19 21:27 UTC (permalink / raw
  To: gentoo-commits

commit:     7fdb5d855e9bd97825c1886e9788ecb1539e7759
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 19 21:27:11 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Jun 19 21:27:11 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=7fdb5d85

depgraph: optimize slot conflict backtrack order

---
 pym/_emerge/depgraph.py              |    8 ++++++--
 pym/_emerge/resolver/backtracking.py |   10 +++++++++-
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 071d058..291080a 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -366,7 +366,11 @@ class _dynamic_depgraph_config(object):
 		# This use used to check if we have accounted for blockers
 		# relevant to a package.
 		self._traversed_pkg_deps = set()
-		self._slot_collision_info = {}
+		# This should be ordered such that the backtracker will
+		# attempt to solve conflicts which occurred earlier first,
+		# since an earlier conflict can be the cause of a conflict
+		# which occurs later.
+		self._slot_collision_info = OrderedDict()
 		# Slot collision nodes are not allowed to block other packages since
 		# blocker validation is only able to account for one package per slot.
 		self._slot_collision_nodes = set()
@@ -911,7 +915,7 @@ class depgraph(object):
 		to_be_masked = backtrack_data[-1][0]
 
 		self._dynamic_config._backtrack_infos.setdefault(
-			"slot conflict", []).extend(backtrack_data)
+			"slot conflict", []).append(backtrack_data)
 		self._dynamic_config._need_restart = True
 		if debug:
 			msg = []

diff --git a/pym/_emerge/resolver/backtracking.py b/pym/_emerge/resolver/backtracking.py
index f2857b0..2f8b6d0 100644
--- a/pym/_emerge/resolver/backtracking.py
+++ b/pym/_emerge/resolver/backtracking.py
@@ -131,6 +131,14 @@ class Backtracker(object):
 
 		return True
 
+	def _feedback_slot_conflicts(self, conflicts_data):
+		# This should be ordered such that the backtracker will
+		# attempt to solve conflicts which occurred earlier first,
+		# since an earlier conflict can be the cause of a conflict
+		# which occurs later.
+		for slot_data in reversed(conflicts_data):
+			self._feedback_slot_conflict(slot_data)
+
 	def _feedback_slot_conflict(self, conflict_data):
 		for pkg, parent_atoms in conflict_data:
 			new_node = copy.deepcopy(self._current_node)
@@ -196,7 +204,7 @@ class Backtracker(object):
 
 		#There is at most one of the following types of conflicts for a given restart.
 		if "slot conflict" in infos:
-			self._feedback_slot_conflict(infos["slot conflict"])
+			self._feedback_slot_conflicts(infos["slot conflict"])
 		elif "missing dependency" in infos:
 			self._feedback_missing_dep(infos["missing dependency"])
 



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/_emerge/resolver/, pym/_emerge/
@ 2012-06-23  6:28 Zac Medico
  0 siblings, 0 replies; 15+ messages in thread
From: Zac Medico @ 2012-06-23  6:28 UTC (permalink / raw
  To: gentoo-commits

commit:     22b8c653bbb09570b428f7f744a267feb30bf4f1
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Jun 23 06:28:10 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Jun 23 06:28:10 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=22b8c653

Slot conflict "abi" backtrack nodes non-terminal.

---
 pym/_emerge/depgraph.py              |    6 +++++-
 pym/_emerge/resolver/backtracking.py |    2 ++
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 75e3500..07d30e6 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -881,8 +881,12 @@ class depgraph(object):
 			not self._accept_blocker_conflicts():
 			remaining = []
 			for pkg in conflict_pkgs:
-				if not self._slot_conflict_backtrack_abi(pkg,
+				if self._slot_conflict_backtrack_abi(pkg,
 					slot_nodes, conflict_atoms):
+					backtrack_infos = self._dynamic_config._backtrack_infos
+					config = backtrack_infos.setdefault("config", {})
+					config.setdefault("slot_conflict_abi", set()).add(pkg)
+				else:
 					remaining.append(pkg)
 			if remaining:
 				self._slot_confict_backtrack(root, slot_atom,

diff --git a/pym/_emerge/resolver/backtracking.py b/pym/_emerge/resolver/backtracking.py
index f39bad4..00a07bc 100644
--- a/pym/_emerge/resolver/backtracking.py
+++ b/pym/_emerge/resolver/backtracking.py
@@ -186,6 +186,8 @@ class Backtracker(object):
 			elif change == "needed_use_config_changes":
 				for pkg, (new_use, new_changes) in data:
 					para.needed_use_config_changes[pkg] = (new_use, new_changes)
+			elif change == "slot_conflict_abi":
+				new_node.terminal = False
 			elif change == "slot_abi_mask_built":
 				for pkg, mask_reasons in data.items():
 					para.runtime_pkg_mask.setdefault(pkg,



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/_emerge/resolver/, pym/_emerge/
@ 2012-09-26  4:11 Zac Medico
  0 siblings, 0 replies; 15+ messages in thread
From: Zac Medico @ 2012-09-26  4:11 UTC (permalink / raw
  To: gentoo-commits

commit:     886eee63bc0f4b56a6705d2ed671f361ed907f5f
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 26 04:11:31 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Sep 26 04:11:31 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=886eee63

Use constants for more hardcoded *DEPEND lists.

---
 pym/_emerge/depgraph.py                     |   10 ++++------
 pym/_emerge/resolver/circular_dependency.py |    5 +++--
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 1588f2c..b4c799e 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -3187,15 +3187,13 @@ class depgraph(object):
 				if priorities is None:
 					# This edge comes from _parent_atoms and was not added to
 					# the graph, and _parent_atoms does not contain priorities.
-					dep_strings.add(node.metadata["DEPEND"])
-					dep_strings.add(node.metadata["RDEPEND"])
-					dep_strings.add(node.metadata["PDEPEND"])
-					dep_strings.add(node.metadata["HDEPEND"])
+					for k in Package._dep_keys:
+						dep_strings.add(node.metadata[k])
 				else:
 					for priority in priorities:
 						if priority.buildtime:
-							dep_strings.add(node.metadata["DEPEND"])
-							dep_strings.add(node.metadata["HDEPEND"])
+							for k in Package._buildtime_keys:
+								dep_strings.add(node.metadata[k])
 						if priority.runtime:
 							dep_strings.add(node.metadata["RDEPEND"])
 						if priority.runtime_post:

diff --git a/pym/_emerge/resolver/circular_dependency.py b/pym/_emerge/resolver/circular_dependency.py
index d60f185..5192d61 100644
--- a/pym/_emerge/resolver/circular_dependency.py
+++ b/pym/_emerge/resolver/circular_dependency.py
@@ -11,6 +11,7 @@ from portage.exception import InvalidDependString
 from portage.output import colorize
 from portage.util import writemsg_level
 from _emerge.DepPrioritySatisfiedRange import DepPrioritySatisfiedRange
+from _emerge.Package import Package
 
 class circular_dependency_handler(object):
 	
@@ -113,8 +114,8 @@ class circular_dependency_handler(object):
 			parent_atoms = self.all_parent_atoms.get(pkg)
 
 			if priorities[-1].buildtime:
-				dep = parent.metadata["DEPEND"] + \
-					" " + parent.metadata["HDEPEND"]
+				dep = " ".join(parent.metadata[k]
+					for k in Package._buildtime_keys)
 			elif priorities[-1].runtime:
 				dep = parent.metadata["RDEPEND"]
 


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/_emerge/resolver/, pym/_emerge/
@ 2012-11-27  5:34 Zac Medico
  0 siblings, 0 replies; 15+ messages in thread
From: Zac Medico @ 2012-11-27  5:34 UTC (permalink / raw
  To: gentoo-commits

commit:     b56487d85a1dbfce3d286c3c22774655f7fdbf06
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 27 05:34:24 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Nov 27 05:34:24 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b56487d8

Package: add defined_phases, properties, restrict

---
 pym/_emerge/EbuildBuild.py     |    4 ++--
 pym/_emerge/Package.py         |   12 ++++++++++++
 pym/_emerge/Scheduler.py       |    4 ++--
 pym/_emerge/resolver/output.py |    4 ++--
 4 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/pym/_emerge/EbuildBuild.py b/pym/_emerge/EbuildBuild.py
index 2da09e7..cec63d9 100644
--- a/pym/_emerge/EbuildBuild.py
+++ b/pym/_emerge/EbuildBuild.py
@@ -260,8 +260,8 @@ class EbuildBuild(CompositeTask):
 		# to be displayed for problematic packages even though they do
 		# not set RESTRICT=fetch (bug #336499).
 
-		if 'fetch' not in self.pkg._metadata.restrict and \
-			'nofetch' not in self.pkg._metadata.defined_phases:
+		if 'fetch' not in self.pkg.restrict and \
+			'nofetch' not in self.pkg.defined_phases:
 			self._unlock_builddir()
 			self.wait()
 			return

diff --git a/pym/_emerge/Package.py b/pym/_emerge/Package.py
index 7950ffb..602fea8 100644
--- a/pym/_emerge/Package.py
+++ b/pym/_emerge/Package.py
@@ -109,6 +109,18 @@ class Package(Task):
 		return self._metadata["EAPI"]
 
 	@property
+	def defined_phases(self):
+		return self._metadata.defined_phases
+
+	@property
+	def properties(self):
+		return self._metadata.properties
+
+	@property
+	def restrict(self):
+		return self._metadata.restrict
+
+	@property
 	def metadata(self):
 		warnings.warn("_emerge.Package.Package.metadata is deprecated",
 			DeprecationWarning, stacklevel=3)

diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py
index 72f1943..708af12 100644
--- a/pym/_emerge/Scheduler.py
+++ b/pym/_emerge/Scheduler.py
@@ -409,7 +409,7 @@ class Scheduler(PollScheduler):
 			if not (isinstance(task, Package) and \
 				task.operation == "merge"):
 				continue
-			if 'interactive' in task._metadata.properties:
+			if 'interactive' in task.properties:
 				interactive_tasks.append(task)
 		return interactive_tasks
 
@@ -786,7 +786,7 @@ class Scheduler(PollScheduler):
 			if x.eapi in ("0", "1", "2", "3"):
 				continue
 
-			if "pretend" not in x._metadata.defined_phases:
+			if "pretend" not in x.defined_phases:
 				continue
 
 			out_str =">>> Running pre-merge checks for " + colorize("INFORM", x.cpv) + "\n"

diff --git a/pym/_emerge/resolver/output.py b/pym/_emerge/resolver/output.py
index 1fdc08d..3d6af66 100644
--- a/pym/_emerge/resolver/output.py
+++ b/pym/_emerge/resolver/output.py
@@ -651,7 +651,7 @@ class Display(object):
 			pkg_info.repo_path_real = self.portdb.getRepositoryPath(pkg.repo)
 		pkg_info.use = list(self.conf.pkg_use_enabled(pkg))
 		if not pkg.built and pkg.operation == 'merge' and \
-			'fetch' in pkg._metadata.restrict:
+			'fetch' in pkg.restrict:
 			if pkg_info.ordered:
 				self.counters.restrict_fetch += 1
 			pkg_info.attr_display.fetch_restrict = True
@@ -853,7 +853,7 @@ class Display(object):
 				pkg_info.oldbest = self.convert_myoldbest(pkg, pkg_info)
 				pkg_info.system, pkg_info.world = \
 					self.check_system_world(pkg)
-				if 'interactive' in pkg._metadata.properties and \
+				if 'interactive' in pkg.properties and \
 					pkg.operation == 'merge':
 					pkg_info.attr_display.interactive = True
 					if ordered:


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/_emerge/resolver/, pym/_emerge/
@ 2012-12-10  0:26 Zac Medico
  0 siblings, 0 replies; 15+ messages in thread
From: Zac Medico @ 2012-12-10  0:26 UTC (permalink / raw
  To: gentoo-commits

commit:     ecae0c4fc46d6bc8054104a99af90bc45d4e7429
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 10 00:26:14 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Dec 10 00:26:14 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ecae0c4f

get_real_flag: handls use-dep default bug #446666

---
 pym/_emerge/Package.py                 |    7 +++++--
 pym/_emerge/depgraph.py                |    3 +++
 pym/_emerge/resolver/slot_collision.py |    3 +++
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/pym/_emerge/Package.py b/pym/_emerge/Package.py
index 86ed5f7..e19b784 100644
--- a/pym/_emerge/Package.py
+++ b/pym/_emerge/Package.py
@@ -642,6 +642,10 @@ class Package(Task):
 			return missing_iuse
 
 		def get_real_flag(self, flag):
+			"""
+			Returns the flag's name within the scope of this package
+			(accounting for aliases), or None if the flag is unknown.
+			"""
 			if flag in self.all:
 				return flag
 			elif flag in self.all_aliases:
@@ -649,8 +653,7 @@ class Package(Task):
 					if flag in v:
 						return k
 			else:
-				raise ValueError("'%s' flag is not in IUSE and is not an alias of any flag in IUSE of '%s::%s'" %
-					(flag, self._pkg.cpv, self._pkg.repo))
+				return None
 
 	def __len__(self):
 		return 4

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 568a116..3cd44dd 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -4109,6 +4109,9 @@ class depgraph(object):
 
 		for flag, state in target_use.items():
 			real_flag = pkg.iuse.get_real_flag(flag)
+			if real_flag is None:
+				# Triggered by use-dep defaults.
+				continue
 			if state:
 				if real_flag not in old_use:
 					if new_changes.get(real_flag) == False:

diff --git a/pym/_emerge/resolver/slot_collision.py b/pym/_emerge/resolver/slot_collision.py
index e04166b..8b2f4b8 100644
--- a/pym/_emerge/resolver/slot_collision.py
+++ b/pym/_emerge/resolver/slot_collision.py
@@ -226,6 +226,9 @@ class slot_conflict_handler(object):
 		for pkg in solution:
 			for flag, state in solution[pkg].items():
 				real_flag = pkg.iuse.get_real_flag(flag)
+				if real_flag is None:
+					# Triggered by use-dep defaults.
+					continue
 				if state == "enabled" and flag not in _pkg_use_enabled(pkg):
 					new_change.setdefault(pkg, {})[real_flag] = True
 				elif state == "disabled" and flag in _pkg_use_enabled(pkg):


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/_emerge/resolver/, pym/_emerge/
@ 2013-06-01  0:17 Zac Medico
  0 siblings, 0 replies; 15+ messages in thread
From: Zac Medico @ 2013-06-01  0:17 UTC (permalink / raw
  To: gentoo-commits

commit:     27c2591cd0b433e4b94575175dc7b9404e66747d
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Jun  1 00:16:34 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Jun  1 00:16:34 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=27c2591c

depgraph.display(): handle reverse for --tree

This factors --tree logic out of the calling code, and allows
optimization of _show_merge_list to use reference comparison instead
of == comparison. Also, deprecate the unused depgraph.altlist()
"reversed" parameter, due to builtin name collision.

---
 pym/_emerge/Scheduler.py                    |  6 +-----
 pym/_emerge/actions.py                      |  8 ++++----
 pym/_emerge/depgraph.py                     | 26 +++++++++++++++-----------
 pym/_emerge/resolver/circular_dependency.py |  3 +--
 4 files changed, 21 insertions(+), 22 deletions(-)

diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py
index 4e8b223..94d3d3f 100644
--- a/pym/_emerge/Scheduler.py
+++ b/pym/_emerge/Scheduler.py
@@ -1827,11 +1827,7 @@ class Scheduler(PollScheduler):
 			return False
 
 		if success and self._show_list():
-			mylist = mydepgraph.altlist()
-			if mylist:
-				if "--tree" in self.myopts:
-					mylist = tuple(reversed(mylist))
-				mydepgraph.display(mylist, favorites=self._favorites)
+			mydepgraph.display(mydepgraph.altlist(), favorites=self._favorites)
 
 		if not success:
 			self._post_mod_echo_msgs.append(mydepgraph.display_problems)

diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
index 7b2cf54..d6e8100 100644
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -336,7 +336,7 @@ def action_build(settings, trees, mtimedb,
 				return os.EX_OK
 			favorites = mtimedb["resume"]["favorites"]
 			retval = mydepgraph.display(
-				mydepgraph.altlist(reversed=tree),
+				mydepgraph.altlist(),
 				favorites=favorites)
 			mydepgraph.display_problems()
 			mergelist_shown = True
@@ -345,7 +345,7 @@ def action_build(settings, trees, mtimedb,
 			prompt="Would you like to resume merging these packages?"
 		else:
 			retval = mydepgraph.display(
-				mydepgraph.altlist(reversed=("--tree" in myopts)),
+				mydepgraph.altlist(),
 				favorites=favorites)
 			mydepgraph.display_problems()
 			mergelist_shown = True
@@ -404,7 +404,7 @@ def action_build(settings, trees, mtimedb,
 				return os.EX_OK
 			favorites = mtimedb["resume"]["favorites"]
 			retval = mydepgraph.display(
-				mydepgraph.altlist(reversed=tree),
+				mydepgraph.altlist(),
 				favorites=favorites)
 			mydepgraph.display_problems()
 			mergelist_shown = True
@@ -412,7 +412,7 @@ def action_build(settings, trees, mtimedb,
 				return retval
 		else:
 			retval = mydepgraph.display(
-				mydepgraph.altlist(reversed=("--tree" in myopts)),
+				mydepgraph.altlist(),
 				favorites=favorites)
 			mydepgraph.display_problems()
 			mergelist_shown = True

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 9c0a966..3e29508 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -9,6 +9,7 @@ import logging
 import stat
 import sys
 import textwrap
+import warnings
 from collections import deque
 from itertools import chain
 
@@ -5694,7 +5695,12 @@ class depgraph(object):
 
 		mygraph.order.sort(key=cmp_sort_key(cmp_merge_preference))
 
-	def altlist(self, reversed=False):
+	def altlist(self, reversed=DeprecationWarning):
+
+		if reversed is not DeprecationWarning:
+			warnings.warn("The reversed parameter of "
+				"_emerge.depgraph.depgraph.altlist() is deprecated",
+				DeprecationWarning, stacklevel=2)
 
 		while self._dynamic_config._serialized_tasks_cache is None:
 			self._resolve_conflicts()
@@ -5705,8 +5711,8 @@ class depgraph(object):
 				pass
 
 		retlist = self._dynamic_config._serialized_tasks_cache
-		if reversed:
-			# TODO: deprecate the "reversed" parameter (builtin name collision)
+		if reversed is not DeprecationWarning and reversed:
+			# TODO: remove the "reversed" parameter (builtin name collision)
 			retlist = list(retlist)
 			retlist.reverse()
 			retlist = tuple(retlist)
@@ -6647,14 +6653,8 @@ class depgraph(object):
 	def _show_merge_list(self):
 		if self._dynamic_config._serialized_tasks_cache is not None and \
 			not (self._dynamic_config._displayed_list is not None and \
-			(self._dynamic_config._displayed_list is self._dynamic_config._serialized_tasks_cache or \
-			self._dynamic_config._displayed_list == self._dynamic_config._serialized_tasks_cache or \
-			self._dynamic_config._displayed_list == \
-				list(reversed(self._dynamic_config._serialized_tasks_cache)))):
-			display_list = self._dynamic_config._serialized_tasks_cache
-			if "--tree" in self._frozen_config.myopts:
-				display_list = tuple(reversed(display_list))
-			self.display(display_list)
+			self._dynamic_config._displayed_list is self._dynamic_config._serialized_tasks_cache):
+			self.display(self._dynamic_config._serialized_tasks_cache)
 
 	def _show_unsatisfied_blockers(self, blockers):
 		self._show_merge_list()
@@ -6749,6 +6749,10 @@ class depgraph(object):
 		# redundantly displaying this exact same merge list
 		# again via _show_merge_list().
 		self._dynamic_config._displayed_list = mylist
+
+		if "--tree" in self._frozen_config.myopts:
+			mylist = tuple(reversed(mylist))
+
 		display = Display()
 
 		return display(self, mylist, favorites, verbosity)

diff --git a/pym/_emerge/resolver/circular_dependency.py b/pym/_emerge/resolver/circular_dependency.py
index 6380b22..b710671 100644
--- a/pym/_emerge/resolver/circular_dependency.py
+++ b/pym/_emerge/resolver/circular_dependency.py
@@ -62,8 +62,7 @@ class circular_dependency_handler(object):
 				node = nodes[0]
 			display_order.append(node)
 			tempgraph.remove(node)
-		display_order.reverse()
-		return display_order
+		return tuple(display_order)
 
 	def _prepare_circular_dep_message(self):
 		"""


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/_emerge/resolver/, pym/_emerge/
@ 2014-02-05 19:42 Sebastian Luther
  0 siblings, 0 replies; 15+ messages in thread
From: Sebastian Luther @ 2014-02-05 19:42 UTC (permalink / raw
  To: gentoo-commits

commit:     33b3818c1d74971253e9a9ddbb1047a34afec44c
Author:     Sebastian Luther <SebastianLuther <AT> gmx <DOT> de>
AuthorDate: Wed Jan 22 17:20:19 2014 +0000
Commit:     Sebastian Luther <SebastianLuther <AT> gmx <DOT> de >
CommitDate: Wed Feb  5 19:39:21 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=33b3818c

Replace _slot_pkg_map and some tree dbapiS with _package_tracker

---
 pym/_emerge/depgraph.py                | 48 ++++++++++++++++++++--------------
 pym/_emerge/resolver/output_helpers.py |  7 ++---
 2 files changed, 32 insertions(+), 23 deletions(-)

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 83035c2..fd59dda 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -75,6 +75,7 @@ from _emerge.UseFlagDisplay import pkg_use_display
 from _emerge.userquery import userquery
 
 from _emerge.resolver.backtracking import Backtracker, BacktrackParameter
+from _emerge.resolver.package_tracker import PackageTracker, PackageTrackerDbapiWrapper
 from _emerge.resolver.slot_collision import slot_conflict_handler
 from _emerge.resolver.circular_dependency import circular_dependency_handler
 from _emerge.resolver.output import Display
@@ -341,8 +342,6 @@ class _dynamic_depgraph_config(object):
 		self.myparams = myparams.copy()
 		self._vdb_loaded = False
 		self._allow_backtracking = allow_backtracking
-		# Maps slot atom to package for each Package added to the graph.
-		self._slot_pkg_map = {}
 		# Maps nodes to the reasons they were selected for reinstallation.
 		self._reinstall_nodes = {}
 		self.mydbapi = {}
@@ -432,14 +431,14 @@ class _dynamic_depgraph_config(object):
 		self._traverse_ignored_deps = False
 		self._complete_mode = False
 		self._slot_operator_deps = {}
+		self._package_tracker = PackageTracker()
 
 		for myroot in depgraph._frozen_config.trees:
 			self.sets[myroot] = _depgraph_sets()
-			self._slot_pkg_map[myroot] = {}
 			vardb = depgraph._frozen_config.trees[myroot]["vartree"].dbapi
 			# This dbapi instance will model the state that the vdb will
 			# have after new packages have been installed.
-			fakedb = PackageVirtualDbapi(vardb.settings)
+			fakedb = PackageTrackerDbapiWrapper(myroot, self._package_tracker)
 
 			self.mydbapi[myroot] = fakedb
 			def graph_tree():
@@ -564,12 +563,12 @@ class depgraph(object):
 
 				if not dynamic_deps:
 					for pkg in vardb:
-						fakedb.cpv_inject(pkg)
+						self._dynamic_config._package_tracker.add_installed_pkg(pkg)
 				else:
 					max_jobs = self._frozen_config.myopts.get("--jobs")
 					max_load = self._frozen_config.myopts.get("--load-average")
 					scheduler = TaskScheduler(
-						self._dynamic_deps_preload(fake_vartree, fakedb),
+						self._dynamic_deps_preload(fake_vartree),
 						max_jobs=max_jobs,
 						max_load=max_load,
 						event_loop=fake_vartree._portdb._event_loop)
@@ -578,11 +577,11 @@ class depgraph(object):
 
 		self._dynamic_config._vdb_loaded = True
 
-	def _dynamic_deps_preload(self, fake_vartree, fakedb):
+	def _dynamic_deps_preload(self, fake_vartree):
 		portdb = fake_vartree._portdb
 		for pkg in fake_vartree.dbapi:
 			self._spinner_update()
-			fakedb.cpv_inject(pkg)
+			self._dynamic_config._package_tracker.add_installed_pkg(pkg)
 			ebuild_path, repo_path = \
 				portdb.findname2(pkg.cpv, myrepo=pkg.repo)
 			if ebuild_path is None:
@@ -1050,7 +1049,8 @@ class depgraph(object):
 		all_parents, conflict_pkgs):
 
 		debug = "--debug" in self._frozen_config.myopts
-		existing_node = self._dynamic_config._slot_pkg_map[root][slot_atom]
+		existing_node = next(self._dynamic_config._package_tracker.match(
+			root, slot_atom, installed=False))
 		# In order to avoid a missed update, first mask lower versions
 		# that conflict with higher versions (the backtracker visits
 		# these in reverse order).
@@ -1827,8 +1827,8 @@ class depgraph(object):
 			# The caller has selected a specific package
 			# via self._minimize_packages().
 			dep_pkg = dep.child
-			existing_node = self._dynamic_config._slot_pkg_map[
-				dep.root].get(dep_pkg.slot_atom)
+			existing_node = next(self._dynamic_config._package_tracker.match(
+				dep.root, dep_pkg.slot_atom, installed=False), None)
 
 		if not dep_pkg:
 			if (dep.collapsed_priority.optional or
@@ -1893,7 +1893,9 @@ class depgraph(object):
 		return 1
 
 	def _check_slot_conflict(self, pkg, atom):
-		existing_node = self._dynamic_config._slot_pkg_map[pkg.root].get(pkg.slot_atom)
+		existing_node = next(self._dynamic_config._package_tracker.match(
+			pkg.root, pkg.slot_atom, installed=False), None)
+
 		matches = None
 		if existing_node:
 			matches = pkg.cpv == existing_node.cpv
@@ -2046,7 +2048,7 @@ class depgraph(object):
 				# function despite collisions.
 				pass
 			elif not previously_added:
-				self._dynamic_config._slot_pkg_map[pkg.root][pkg.slot_atom] = pkg
+				self._dynamic_config._package_tracker.add_pkg(pkg)
 				self._dynamic_config.mydbapi[pkg.root].cpv_inject(pkg)
 				self._dynamic_config._filtered_trees[pkg.root]["porttree"].dbapi._clear_cache()
 				self._dynamic_config._highest_pkg_cache.clear()
@@ -2162,7 +2164,8 @@ class depgraph(object):
 		slot_nodes = self._dynamic_config._slot_collision_info.get(slot_key)
 		if slot_nodes is None:
 			slot_nodes = set()
-			slot_nodes.add(self._dynamic_config._slot_pkg_map[pkg.root][pkg.slot_atom])
+			slot_nodes.update(self._dynamic_config._package_tracker.match(
+				pkg.root, pkg.slot_atom, installed=False))
 			self._dynamic_config._slot_collision_info[slot_key] = slot_nodes
 		slot_nodes.add(pkg)
 
@@ -2347,8 +2350,8 @@ class depgraph(object):
 			mypriority.satisfied.visible and \
 			dep.child is not None and \
 			not dep.child.installed and \
-			self._dynamic_config._slot_pkg_map[dep.child.root].get(
-			dep.child.slot_atom) is None and \
+			not any(self._dynamic_config._package_tracker.match(
+				dep.child.root, dep.child.slot_atom, installed=False)) and \
 			not slot_operator_rebuild
 
 	def _wrapped_add_pkg_dep_string(self, pkg, dep_root, dep_priority,
@@ -5071,7 +5074,9 @@ class depgraph(object):
 					# will always end with a break statement below
 					# this point.
 					if find_existing_node:
-						e_pkg = self._dynamic_config._slot_pkg_map[root].get(pkg.slot_atom)
+						e_pkg = next(self._dynamic_config._package_tracker.match(
+							root, pkg.slot_atom, installed=False), None)
+
 						if not e_pkg:
 							break
 
@@ -5319,7 +5324,9 @@ class depgraph(object):
 								matches = unmasked
 
 		pkg = matches[-1] # highest match
-		in_graph = self._dynamic_config._slot_pkg_map[root].get(pkg.slot_atom)
+		in_graph = next(self._dynamic_config._package_tracker.match(
+			root, pkg.slot_atom, installed=False), None)
+
 		return pkg, in_graph
 
 	def _complete_graph(self, required_sets=None):
@@ -7988,8 +7995,9 @@ class _dep_check_composite_db(dbapi):
 				elif not self._depgraph._equiv_ebuild_visible(pkg):
 					return False
 
-		in_graph = self._depgraph._dynamic_config._slot_pkg_map[
-			self._root].get(pkg.slot_atom)
+		in_graph = next(self._depgraph._dynamic_config._package_tracker.match(
+			self._root, pkg.slot_atom, installed=False), None)
+
 		if in_graph is None:
 			# Mask choices for packages which are not the highest visible
 			# version within their slot (since they usually trigger slot

diff --git a/pym/_emerge/resolver/output_helpers.py b/pym/_emerge/resolver/output_helpers.py
index cfa6910..58b2694 100644
--- a/pym/_emerge/resolver/output_helpers.py
+++ b/pym/_emerge/resolver/output_helpers.py
@@ -227,7 +227,7 @@ class _DisplayConfig(object):
 		self.reinstall_nodes = dynamic_config._reinstall_nodes
 		self.digraph = dynamic_config.digraph
 		self.blocker_uninstalls = dynamic_config._blocker_uninstalls
-		self.slot_pkg_map = dynamic_config._slot_pkg_map
+		self.package_tracker = dynamic_config._package_tracker
 		self.set_nodes = dynamic_config._set_nodes
 
 		self.pkg_use_enabled = depgraph._pkg_use_enabled
@@ -370,8 +370,9 @@ def _tree_display(conf, mylist):
 		# If the uninstall task did not need to be executed because
 		# of an upgrade, display Blocker -> Upgrade edges since the
 		# corresponding Blocker -> Uninstall edges will not be shown.
-		upgrade_node = \
-			conf.slot_pkg_map[uninstall.root].get(uninstall.slot_atom)
+		upgrade_node = next(conf.package_tracker.match(
+			uninstall.root, uninstall.slot_atom), None)
+
 		if upgrade_node is not None and \
 			uninstall not in executed_uninstalls:
 			for blocker in uninstall_parents:


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/_emerge/resolver/, pym/_emerge/
@ 2014-02-05 19:42 Sebastian Luther
  0 siblings, 0 replies; 15+ messages in thread
From: Sebastian Luther @ 2014-02-05 19:42 UTC (permalink / raw
  To: gentoo-commits

commit:     731a3e6ea96acde03150905e28ebb69325acc60f
Author:     Sebastian Luther <SebastianLuther <AT> gmx <DOT> de>
AuthorDate: Fri Jan 24 08:43:52 2014 +0000
Commit:     Sebastian Luther <SebastianLuther <AT> gmx <DOT> de >
CommitDate: Wed Feb  5 19:39:21 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=731a3e6e

Replace _slot_collision_info with _package_tracker

---
 pym/_emerge/depgraph.py                | 59 ++++++++++++----------------------
 pym/_emerge/resolver/slot_collision.py | 22 ++++++-------
 2 files changed, 31 insertions(+), 50 deletions(-)

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 9d234c2..484ac14 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -378,11 +378,6 @@ class _dynamic_depgraph_config(object):
 		# This use used to check if we have accounted for blockers
 		# relevant to a package.
 		self._traversed_pkg_deps = set()
-		# This should be ordered such that the backtracker will
-		# attempt to solve conflicts which occurred earlier first,
-		# since an earlier conflict can be the cause of a conflict
-		# which occurs later.
-		self._slot_collision_info = OrderedDict()
 		# Slot collision nodes are not allowed to block other packages since
 		# blocker validation is only able to account for one package per slot.
 		self._slot_collision_nodes = set()
@@ -915,7 +910,7 @@ class depgraph(object):
 		cases.
 		"""
 
-		if not self._dynamic_config._slot_collision_info:
+		if not any(self._dynamic_config._package_tracker.slot_conflicts()):
 			return
 
 		self._show_merge_list()
@@ -971,16 +966,18 @@ class depgraph(object):
 		is called, so that all relevant reverse dependencies are
 		available for use in backtracking decisions.
 		"""
-		for (slot_atom, root), slot_nodes in \
-			self._dynamic_config._slot_collision_info.items():
-			self._process_slot_conflict(root, slot_atom, slot_nodes)
+		for conflict in self._dynamic_config._package_tracker.slot_conflicts():
+			self._process_slot_conflict(conflict)
 
-	def _process_slot_conflict(self, root, slot_atom, slot_nodes):
+	def _process_slot_conflict(self, conflict):
 		"""
 		Process slot conflict data to identify specific atoms which
 		lead to conflict. These atoms only match a subset of the
 		packages that have been pulled into a given slot.
 		"""
+		root = conflict.root
+		slot_atom = conflict.atom
+		slot_nodes = conflict.pkgs
 
 		debug = "--debug" in self._frozen_config.myopts
 
@@ -1999,7 +1996,6 @@ class depgraph(object):
 
 			existing_node, existing_node_matches = \
 				self._check_slot_conflict(pkg, dep.atom)
-			slot_collision = False
 			if existing_node:
 				if existing_node_matches:
 					# The existing node can be reused.
@@ -2032,19 +2028,7 @@ class depgraph(object):
 							modified_use=self._pkg_use_enabled(existing_node))),
 							level=logging.DEBUG, noiselevel=-1)
 
-					slot_collision = True
-
-			if slot_collision:
-				# Now add this node to the graph so that self.display()
-				# can show use flags and --tree portage.output.  This node is
-				# only being partially added to the graph.  It must not be
-				# allowed to interfere with the other nodes that have been
-				# added.
-				# Even though the graph is now invalid, continue to process
-				# dependencies so that things like --fetchonly can still
-				# function despite collisions.
-				pass
-			elif not previously_added:
+			if not previously_added:
 				self._dynamic_config._package_tracker.add_pkg(pkg)
 				self._dynamic_config._filtered_trees[pkg.root]["porttree"].dbapi._clear_cache()
 				self._dynamic_config._highest_pkg_cache.clear()
@@ -2156,14 +2140,6 @@ class depgraph(object):
 
 	def _add_slot_conflict(self, pkg):
 		self._dynamic_config._slot_collision_nodes.add(pkg)
-		slot_key = (pkg.slot_atom, pkg.root)
-		slot_nodes = self._dynamic_config._slot_collision_info.get(slot_key)
-		if slot_nodes is None:
-			slot_nodes = set()
-			slot_nodes.update(self._dynamic_config._package_tracker.match(
-				pkg.root, pkg.slot_atom, installed=False))
-			self._dynamic_config._slot_collision_info[slot_key] = slot_nodes
-		slot_nodes.add(pkg)
 
 	def _add_pkg_deps(self, pkg, allow_unsatisfied=False):
 
@@ -3284,7 +3260,8 @@ class depgraph(object):
 		except self._unknown_internal_error:
 			return False, myfavorites
 
-		if (self._dynamic_config._slot_collision_info and
+		have_slot_conflict = any(self._dynamic_config._package_tracker.slot_conflicts())
+		if (have_slot_conflict and
 			not self._accept_blocker_conflicts()) or \
 			(self._dynamic_config._allow_backtracking and
 			"slot conflict" in self._dynamic_config._backtrack_infos):
@@ -6806,7 +6783,8 @@ class depgraph(object):
 			# conflicts (or by blind luck).
 			raise self._unknown_internal_error()
 
-		if self._dynamic_config._slot_collision_info and \
+		have_slot_conflict = any(self._dynamic_config._package_tracker.slot_conflicts())
+		if have_slot_conflict and \
 			not self._accept_blocker_conflicts():
 			self._dynamic_config._serialized_tasks_cache = retlist
 			self._dynamic_config._scheduler_graph = scheduler_graph
@@ -6881,13 +6859,17 @@ class depgraph(object):
 		# the reasons are not apparent from the normal merge list
 		# display.
 
-		slot_collision_info = self._dynamic_config._slot_collision_info
-
 		conflict_pkgs = {}
 		for blocker in blockers:
 			for pkg in chain(self._dynamic_config._blocked_pkgs.child_nodes(blocker), \
 				self._dynamic_config._blocker_parents.parent_nodes(blocker)):
-				if (pkg.slot_atom, pkg.root) in slot_collision_info:
+
+				is_slot_conflict_pkg = False
+				for conflict in self._dynamic_config._package_tracker.slot_conflicts():
+					if conflict.root == pkg.root and conflict.atom == pkg.slot_atom:
+						is_slot_conflict_pkg = True
+						break
+				if is_slot_conflict_pkg:
 					# The slot conflict display has better noise reduction
 					# than the unsatisfied blockers display, so skip
 					# unsatisfied blockers display for packages involved
@@ -7370,7 +7352,8 @@ class depgraph(object):
 				self._dynamic_config._circular_deps_for_display)
 
 		unresolved_conflicts = False
-		if self._dynamic_config._slot_collision_info:
+		have_slot_conflict = any(self._dynamic_config._package_tracker.slot_conflicts())
+		if have_slot_conflict:
 			unresolved_conflicts = True
 			self._show_slot_collision_notice()
 		if self._dynamic_config._unsatisfied_blockers_for_display is not None:

diff --git a/pym/_emerge/resolver/slot_collision.py b/pym/_emerge/resolver/slot_collision.py
index a193baa..ca3fb74 100644
--- a/pym/_emerge/resolver/slot_collision.py
+++ b/pym/_emerge/resolver/slot_collision.py
@@ -89,10 +89,11 @@ class slot_conflict_handler(object):
 		self.debug = "--debug" in self.myopts
 		if self.debug:
 			writemsg("Starting slot conflict handler\n", noiselevel=-1)
-		#slot_collision_info is a dict mapping (slot atom, root) to set
-		#of packages. The packages in the set all belong to the same
-		#slot.
-		self.slot_collision_info = depgraph._dynamic_config._slot_collision_info
+
+		# List of tuples, where each tuple represents a slot conflict.
+		self.all_conflicts = []
+		for conflict in depgraph._dynamic_config._package_tracker.slot_conflicts():
+			self.all_conflicts.append((conflict.root, conflict.atom, conflict.pkgs))
 		
 		#A dict mapping packages to pairs of parent package
 		#and parent atom
@@ -109,8 +110,7 @@ class slot_conflict_handler(object):
 		all_conflict_atoms_by_slotatom = []
 		
 		#fill conflict_pkgs, all_conflict_atoms_by_slotatom
-		for (atom, root), pkgs \
-			in self.slot_collision_info.items():
+		for root, atom, pkgs in self.all_conflicts:
 			conflict_pkgs.append(list(pkgs))
 			all_conflict_atoms_by_slotatom.append(set())
 			
@@ -249,8 +249,7 @@ class slot_conflict_handler(object):
 		msg.append("!!! into the dependency graph, resulting" + \
 			" in a slot conflict:\n\n")
 
-		for (slot_atom, root), pkgs \
-			in self.slot_collision_info.items():
+		for root, slot_atom, pkgs in self.all_conflicts:
 			msg.append("%s" % (slot_atom,))
 			if root != self.depgraph._frozen_config._running_root.root:
 				msg.append(" for %s" % (root,))
@@ -536,13 +535,13 @@ class slot_conflict_handler(object):
 			return None
 
 		if len(solutions)==1:
-			if len(self.slot_collision_info)==1:
+			if len(self.all_conflicts) == 1:
 				msg += "It might be possible to solve this slot collision\n"
 			else:
 				msg += "It might be possible to solve these slot collisions\n"
 			msg += "by applying all of the following changes:\n"
 		else:
-			if len(self.slot_collision_info)==1:
+			if len(self.all_conflicts) == 1:
 				msg += "It might be possible to solve this slot collision\n"
 			else:
 				msg += "It might be possible to solve these slot collisions\n"
@@ -583,8 +582,7 @@ class slot_conflict_handler(object):
 			if not pkg.installed:
 				continue
 
-			for (atom, root), pkgs \
-				in self.slot_collision_info.items():
+			for root, atom, pkgs in self.all_conflicts:
 				if pkg not in pkgs:
 					continue
 				for other_pkg in pkgs:


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/_emerge/resolver/, pym/_emerge/
@ 2017-10-04 18:32 Zac Medico
  0 siblings, 0 replies; 15+ messages in thread
From: Zac Medico @ 2017-10-04 18:32 UTC (permalink / raw
  To: gentoo-commits

commit:     d93c62eab16b1ecb09766448f8dbc12a2e17d933
Author:     Daniel Robbins <drobbins <AT> funtoo <DOT> org>
AuthorDate: Wed Oct  4 18:10:09 2017 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Oct  4 18:31:12 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=d93c62ea

_dynamic_depgraph_config: new digraph docs

Closes: https://github.com/gentoo/portage/pull/217

 pym/_emerge/depgraph.py                 | 41 +++++++++++++++++++++++++++++++++
 pym/_emerge/resolver/package_tracker.py | 12 +++++-----
 2 files changed, 47 insertions(+), 6 deletions(-)

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 0b9b98dbb..751111fb3 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -357,6 +357,47 @@ class _rebuild_config(object):
 
 class _dynamic_depgraph_config(object):
 
+	"""
+	``dynamic_depgraph_config`` is an object that is used to collect settings and important data structures that are
+	used in calculating Portage dependencies. Each depgraph created by the depgraph.py code gets its own
+	``dynamic_depgraph_config``, whereas ``frozen_depgraph_config`` is shared among all depgraphs.
+
+	**self.digraph**
+
+	Of particular importance is the instance variable ``self.digraph``, which is an instance of
+	``portage.util.digraph``, a directed graph data structure. ``portage.util.digraph`` is used for a variety of
+	purposes in the Portage codebase, but in this particular scenario as ``self.digraph``, it is used to create a
+	dependency tree of Portage packages. So for ``self.digraph``, each *node* of the directed graph is a ``Package``,
+	while *edges* connect nodes and each edge can have a Priority. The Priority setting is used to help resolve
+	circular dependencies, and should be interpreted in the direction of parent to child.
+
+	Conceptually, think of ``self.digraph`` as containing user-specified packages or sets at the very top, with
+	dependencies hanging down as children, and dependencies of those children as children of children, etc. The depgraph
+	is intended to model dependency relationships, not the order that packages should be installed.
+
+	**resolving the digraph**
+
+	To convert a digraph to an ordered list of packages to merge in an order where all dependencies are properly
+	satisfied, we would first start by looking at leaf nodes, which are nodes that have no dependencies of their own. We
+	could then traverse the digraph upwards from the leaf nodes, towards the parents. Along the way, depending on emerge
+	options, we could make decisions what packages should be installed or rebuilt. This is how ``self.digraph`` is used
+	in the code.
+
+	**digraph creation**
+
+	The ``depgraph.py`` code creates the digraph by first adding emerge arguments to the digraph as the main parents,
+	so if ``@world`` is specified, then the world set is added as the main parents. Then, ``emerge`` will determine
+	the dependencies of these packages, and depending on what options are passed to ``emerge``, will look at installed
+	packages, binary packages and available ebuilds that could be merged to satisfy dependencies, and these will be
+	added as children in the digraph. Children of children will be added as dependencies as needed, depending on the
+	depth setting used by ``emerge``.
+
+	As the digraph is created, it is perfectly fine for Packages to be added to the digraph that conflict with one
+	another. After the digraph has been fully populated to the necessary depth, code within ``depgraph.py`` will
+	identify any conflicts that are modeled within the digraph and determine the best way to handle them.
+
+	"""
+
 	def __init__(self, depgraph, myparams, allow_backtracking, backtrack_parameters):
 		self.myparams = myparams.copy()
 		self._vdb_loaded = False

diff --git a/pym/_emerge/resolver/package_tracker.py b/pym/_emerge/resolver/package_tracker.py
index 06163574e..ccb0b11cf 100644
--- a/pym/_emerge/resolver/package_tracker.py
+++ b/pym/_emerge/resolver/package_tracker.py
@@ -42,13 +42,13 @@ class PackageTracker(object):
 	considering installing on the system, based on the information in Portage's dependency graph. Multiple roots are
 	supported, so that situations can be modeled where ROOT is set to a non-default value (non-``/``).
 
-	You can use the add_pkg() method to add a to-be-merged package to the PackageTracker, and ``add_installed_pkg()``
-	to add an already-installed package to the package tracker. Typical use of the package tracker involves the
-	depgraph.py code populating the package tracker with calls to ``add_installed_pkg()`` to add all installed packages
-	on the system, and then it is initialized and ready for use. At that point, ``depgraph.py`` can use ``add_pkg()``
-	to add to-be-installed packages to the system.
+	You can use the add_pkg() method to add a to-be-merged package to the PackageTracker, and ``add_installed_pkg()`` to
+	add an already-installed package to the package tracker. Typical use of the package tracker involves the
+	``depgraph.py`` code populating the package tracker with calls to ``add_installed_pkg()`` to add all installed
+	packages on the system, and then it is initialized and ready for use. At that point, ``depgraph.py`` can use
+	``add_pkg()`` to add to-be-installed packages to the system.
 
-	It's worth mentioning that PackageTracker uses ``Package`` objects as arguments, and stores these objects
+	It's worth mentioning that ``PackageTracker`` uses ``Package`` objects as arguments, and stores these objects
 	internally. There are parts of the code that ensure that a ``Package`` instance is added to the PackageTracker
 	only once.
 


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2017-10-04 18:33 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-20 23:44 [gentoo-commits] proj/portage:master commit in: pym/_emerge/resolver/, pym/_emerge/ Arfrever Frehtes Taifersar Arahesis
  -- strict thread matches above, loose matches on Subject: below --
2017-10-04 18:32 Zac Medico
2014-02-05 19:42 Sebastian Luther
2014-02-05 19:42 Sebastian Luther
2013-06-01  0:17 Zac Medico
2012-12-10  0:26 Zac Medico
2012-11-27  5:34 Zac Medico
2012-09-26  4:11 Zac Medico
2012-06-23  6:28 Zac Medico
2012-06-19 21:27 Zac Medico
2011-12-19 20:44 Zac Medico
2011-12-18  2:07 Arfrever Frehtes Taifersar Arahesis
2011-07-09 22:55 Zac Medico
2011-06-27  0:18 Zac Medico
2011-06-21  7:58 Zac Medico

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox