From 7b64f2e44cb46607304788f6fb714e50d52f911e Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 29 Mar 2008 06:49:55 +0000 Subject: [PATCH] Bug #214691 - Move the "slot collision" display so that it is shown after the merge list where it is most likely to be seen (along with other depgraph problems). (trunk r9584) svn path=/main/branches/2.1.2/; revision=9596 --- bin/emerge | 42 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/bin/emerge b/bin/emerge index 95ab24baf..1301f4759 100755 --- a/bin/emerge +++ b/bin/emerge @@ -1529,6 +1529,7 @@ class depgraph: self._pprovided_args = [] self._missing_args = [] self._masked_installed = [] + self._unsatisfied_deps_for_display = [] def _show_slot_collision_notice(self): """Show an informational message advising the user to mask one of the @@ -1537,6 +1538,9 @@ class depgraph: already been selected) will be required in order to handle all possible cases.""" + if not self._slot_collision_info: + return + msg = [] msg.append("\n!!! Multiple versions within a single " + \ "package slot have been \n") @@ -1834,8 +1838,8 @@ class depgraph: self._missing_args.append(arg) if "selective" not in self.myparams: - self._show_unsatisfied_dep( - myroot, arg, myparent=myparent) + self._unsatisfied_deps_for_display.append( + ((myroot, arg), {"myparent":myparent})) return 0 pkg = Package(type_name=mytype, root=myroot, @@ -2456,8 +2460,8 @@ class depgraph: if not matched_packages: if raise_on_missing: raise portage_exception.PackageNotFound(x) - self._show_unsatisfied_dep(myroot, x, - myparent=myparent) + self._unsatisfied_deps_for_display.append( + ((myroot, x), {"myparent":myparent})) return 0 if "--debug" in self.myopts: @@ -2747,8 +2751,8 @@ class depgraph: # unresolvable blocks. for x in self.altlist(): if x[0] == "blocks": + self._slot_collision_info.clear() return True - self._show_slot_collision_notice() if not self._accept_collisions(): return False return True @@ -3765,6 +3769,20 @@ class depgraph: print bold('*'+revision) sys.stdout.write(text) + self.display_problems() + return os.EX_OK + + def display_problems(self): + """ + Display problems with the dependency graph such as slot collisions. + This is called internally by display() to show the problems _after_ + the merge list where it is most likely to be seen, but if display() + is not going to be called then this method should be called explicitly + to ensure that the user is notified of problems with the graph. + """ + + self._show_slot_collision_notice() + if self._pprovided_args: arg_refs = {} for arg_atom in self._pprovided_args: @@ -3801,7 +3819,9 @@ class depgraph: msg.append("The best course of action depends on the reason that an offending\n") msg.append("package.provided entry exists.\n\n") sys.stderr.write("".join(msg)) - return os.EX_OK + + for pargs, kwargs in self._unsatisfied_deps_for_display: + self._show_unsatisfied_dep(*pargs, **kwargs) def calc_changelog(self,ebuildpath,current,next): if ebuildpath == None or not os.path.exists(ebuildpath): @@ -6324,6 +6344,10 @@ def action_build(settings, trees, mtimedb, merge_count = 0 pretend = "--pretend" in myopts fetchonly = "--fetchonly" in myopts or "--fetch-all-uri" in myopts + ask = "--ask" in myopts + tree = "--tree" in myopts + verbose = "--verbose" in myopts + quiet = "--quiet" in myopts if pretend or fetchonly: # make the mtimedb readonly mtimedb.filename = None @@ -6425,6 +6449,7 @@ def action_build(settings, trees, mtimedb, mydepgraph = depgraph(settings, trees, myopts, myparams, spinner) if not mydepgraph.xcreate(myaction): print "!!! Depgraph creation failed." + mydepgraph.display_problems() return 1 if "--quiet" not in myopts and "--nodeps" not in myopts: print "\b\b... done!" @@ -6439,9 +6464,14 @@ def action_build(settings, trees, mtimedb, portage.writemsg("\n!!! %s\n" % str(e), noiselevel=-1) return 1 if not retval: + mydepgraph.display_problems() return 1 if "--quiet" not in myopts and "--nodeps" not in myopts: print "\b\b... done!" + display = pretend or \ + ((ask or tree or verbose) and not (quiet and not ask)) + if not display: + mydepgraph.display_problems() if "--pretend" not in myopts and \ ("--ask" in myopts or "--tree" in myopts or \ -- 2.26.2