From debf30ee98b29894bd913b3ec691662143c0f30e Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 31 May 2013 15:43:07 -0700 Subject: [PATCH] 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 a46f565a3..7b2cf54a5 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 99b96bf2f..7929a78f3 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.""" -- 2.26.2