Adjust --fetchonly failure messages to work better with background mode.
authorZac Medico <zmedico@gentoo.org>
Tue, 22 Jul 2008 00:24:27 +0000 (00:24 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 22 Jul 2008 00:24:27 +0000 (00:24 -0000)
svn path=/main/trunk/; revision=11159

pym/_emerge/__init__.py

index 3ddb7be5f5a05220099333bfbf6cbb3b67525726..04037d6b92b91113ce1a4636a276ee04684e2d9c 100644 (file)
@@ -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):
                """