From c4de481fffdf47e6f17668ada3548ef1189f7e7b Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 22 Jul 2008 00:24:27 +0000 Subject: [PATCH] Adjust --fetchonly failure messages to work better with background mode. svn path=/main/trunk/; revision=11159 --- pym/_emerge/__init__.py | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index 3ddb7be5f..04037d6b9 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -29,6 +29,7 @@ import logging import select import shlex import shutil +import textwrap import urlparse import weakref import gc @@ -2402,8 +2403,9 @@ class EbuildBuild(CompositeTask): if opts.fetchonly: if self._final_exit(fetcher) != os.EX_OK: - eerror("!!! Fetch for %s failed, continuing..." % pkg.cpv, - phase="unpack", key=pkg.cpv) + if not self.background: + eerror("Fetch for %s failed, continuing..." % pkg.cpv, + phase="unpack", key=pkg.cpv) self.wait() return @@ -9075,15 +9077,26 @@ class Scheduler(PollScheduler): "--fetch-all-uri" in self.myopts): return - sys.stderr.write("\n\n!!! Some fetch errors were " + \ - "encountered. Please see above for details.\n\n") + if self._background: + msg = "Some fetch errors were " + \ + "encountered. Please see %s for details." % \ + self._fetch_log + else: + msg = "Some fetch errors were " + \ + "encountered. Please see above for details." - for cpv in failed_fetches: - sys.stderr.write(" ") - sys.stderr.write(cpv) - sys.stderr.write("\n") + prefix = bad(" * ") + msg = "".join("%s%s\n" % (prefix, line) \ + for line in textwrap.wrap(msg, 70)) + writemsg_level(msg, level=logging.ERROR, noiselevel=-1) - sys.stderr.write("\n") + msg = [] + msg.append("") + for cpv in failed_fetches: + msg.append(" %s" % cpv) + msg.append("") + writemsg_level("".join("%s%s\n" % (prefix, line) \ + for line in msg), level=logging.ERROR, noiselevel=-1) def _is_restart_scheduled(self): """ -- 2.26.2