From 60fcd62f4d1839b7d0db5636522dcc6ef23b8a34 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 3 May 2008 21:17:05 +0000 Subject: When loadResumeCommand() rejects a resume list, give a more informative explanation. (trunk r10139) svn path=/main/branches/2.1.2/; revision=10140 --- bin/emerge | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/bin/emerge b/bin/emerge index 7f600dbc5..2122ee0a5 100755 --- a/bin/emerge +++ b/bin/emerge @@ -4992,8 +4992,8 @@ class depgraph(object): # This probably means that a required package # was dropped via --skipfirst. It makes the # resume list invalid, so convert it to a - # PackageNotFound exception. - raise portage_exception.PackageNotFound( + # UnsatisfiedResumeDep exception. + raise self.UnsatisfiedResumeDep( self._unsatisfied_deps[0].atom) self._serialized_tasks_cache = None try: @@ -5063,6 +5063,13 @@ class depgraph(object): if arg not in refs: refs.append(arg) + class UnsatisfiedResumeDep(portage_exception.PortageException): + """ + A dependency of a resume list is not installed. This + can occur when a required package is dropped from the + merge list via --skipfirst. + """ + class _internal_exception(portage_exception.PortageException): def __init__(self, value=""): portage_exception.PortageException.__init__(self, value) @@ -7774,14 +7781,34 @@ def action_build(settings, trees, mtimedb, success = False try: success = mydepgraph.loadResumeCommand(mtimedb["resume"]) - except portage_exception.PackageNotFound: + except (portage_exception.PackageNotFound, + mydepgraph.UnsatisfiedResumeDep), e: if show_spinner: print + from textwrap import wrap from output import EOutput out = EOutput() - out.eerror("Error: The resume list contains packages that are no longer") - out.eerror(" available to be emerged. Please restart/continue") - out.eerror(" the merge operation manually.") + + if isinstance(e, mydepgraph.UnsatisfiedResumeDep): + out.eerror("An expected dependency " + \ + "is not installed: %s" % str(e)) + out.eerror("") + msg = "The resume list contains packages " + \ + "with dependencies that have not been " + \ + "installed yet. Please restart/continue " + \ + "the operation manually." + for line in wrap(msg, 72): + out.eerror(line) + elif isinstance(e, portage_exception.PackageNotFound): + out.eerror("An expected package is " + \ + "not available: %s" % str(e)) + out.eerror("") + msg = "The resume list contains one or more " + \ + "packages that are no longer " + \ + "available. Please restart/continue " + \ + "the operation manually." + for line in wrap(msg, 72): + out.eerror(line) else: if show_spinner: print "\b\b... done!" -- cgit v1.2.3-1-g7c22