Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/_emerge/
Date: Fri, 31 May 2013 22:43:31
Message-Id: 1370040187.debf30ee98b29894bd913b3ec691662143c0f30e.zmedico@gentoo
commit:     debf30ee98b29894bd913b3ec691662143c0f30e
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri May 31 22:43:07 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri May 31 22:43:07 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=debf30ee

depgraph: buidpkgonly error earlier, bug #471910

---
 pym/_emerge/actions.py  | 27 +--------------------------
 pym/_emerge/depgraph.py | 23 +++++++++++++++++++++++
 2 files changed, 24 insertions(+), 26 deletions(-)

diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
index a46f565..7b2cf54 100644
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -418,33 +418,8 @@ def action_build(settings, trees, mtimedb,
 			mergelist_shown = True
 			if retval != os.EX_OK:
 				return retval
-			if "--buildpkgonly" in myopts:
-				graph_copy = mydepgraph._dynamic_config.digraph.copy()
-				removed_nodes = set()
-				for node in graph_copy:
-					if not isinstance(node, Package) or \
-						node.operation == "nomerge":
-						removed_nodes.add(node)
-				graph_copy.difference_update(removed_nodes)
-				if not graph_copy.hasallzeros(ignore_priority = \
-					DepPrioritySatisfiedRange.ignore_medium):
-					print("\n!!! --buildpkgonly requires all dependencies to be merged.")
-					print("!!! You have to merge the dependencies before you can build this package.\n")
-					return 1
+
 	else:
-		if "--buildpkgonly" in myopts:
-			graph_copy = mydepgraph._dynamic_config.digraph.copy()
-			removed_nodes = set()
-			for node in graph_copy:
-				if not isinstance(node, Package) or \
-					node.operation == "nomerge":
-					removed_nodes.add(node)
-			graph_copy.difference_update(removed_nodes)
-			if not graph_copy.hasallzeros(ignore_priority = \
-				DepPrioritySatisfiedRange.ignore_medium):
-				print("\n!!! --buildpkgonly requires all dependencies to be merged.")
-				print("!!! Cannot merge requested packages. Merge deps and try again.\n")
-				return 1
 
 		if not mergelist_shown:
 			# If we haven't already shown the merge list above, at

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 99b96bf..7929a78 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -424,6 +424,7 @@ class _dynamic_depgraph_config(object):
 		self._skip_restart = False
 		self._backtrack_infos = {}
 
+		self._buildpkgonly_deps_unsatisfied = False
 		self._autounmask = depgraph._frozen_config.myopts.get('--autounmask') != 'n'
 		self._success_without_autounmask = False
 		self._traverse_ignored_deps = False
@@ -3175,6 +3176,21 @@ class depgraph(object):
 			# want_restart_for_use_change triggers this
 			return False, myfavorites
 
+		if "--fetchonly" not in self._frozen_config.myopts and \
+			"--buildpkgonly" in self._frozen_config.myopts:
+			graph_copy = self._dynamic_config.digraph.copy()
+			removed_nodes = set()
+			for node in graph_copy:
+				if not isinstance(node, Package) or \
+					node.operation == "nomerge":
+					removed_nodes.add(node)
+			graph_copy.difference_update(removed_nodes)
+			if not graph_copy.hasallzeros(ignore_priority = \
+				DepPrioritySatisfiedRange.ignore_medium):
+				self._dynamic_config._buildpkgonly_deps_unsatisfied = True
+				self._dynamic_config._skip_restart = True
+				return False, myfavorites
+
 		# Any failures except those due to autounmask *alone* should return
 		# before this point, since the success_without_autounmask flag that's
 		# set below is reserved for cases where there are *zero* other
@@ -7239,6 +7255,13 @@ class depgraph(object):
 			self._show_unsatisfied_dep(*pargs,
 				**portage._native_kwargs(kwargs))
 
+		if self._dynamic_config._buildpkgonly_deps_unsatisfied:
+			self._show_merge_list()
+			writemsg("\n!!! --buildpkgonly requires all "
+				"dependencies to be merged.\n", noiselevel=-1)
+			writemsg("!!! Cannot merge requested packages. "
+				"Merge deps and try again.\n\n", noiselevel=-1)
+
 	def saveNomergeFavorites(self):
 		"""Find atoms in favorites that are not in the mergelist and add them
 		to the world file if necessary."""