When there is more than one failure, show a summary packages that failed to
authorZac Medico <zmedico@gentoo.org>
Tue, 15 Jul 2008 08:58:05 +0000 (08:58 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 15 Jul 2008 08:58:05 +0000 (08:58 -0000)
build or install. This is especially useful when using --jobs or --keep-going
since there can be multiple failures.

svn path=/main/trunk/; revision=11055

pym/_emerge/__init__.py

index 7fd2c27640b5012f2f118278ad98f51d062a4a0f..786824790ea79cce122dd0c8bd9db530955a214b 100644 (file)
@@ -8390,6 +8390,7 @@ class Scheduler(PollScheduler):
                self._pkg_queue = []
                self._completed_tasks = set()
                self._failed_pkgs = []
+               self._failed_pkgs_all = []
                self._failed_fetches = []
                self._parallel_fetch = False
                merge_count = len([x for x in mergelist \
@@ -8813,6 +8814,7 @@ class Scheduler(PollScheduler):
                        for failed_pkg, returncode in failed_pkgs:
                                mergelist.remove(list(failed_pkg))
 
+                       self._failed_pkgs_all.extend(failed_pkgs)
                        del failed_pkgs[:]
 
                        if not mergelist:
@@ -8845,6 +8847,22 @@ class Scheduler(PollScheduler):
 
                self._logger.log(" *** Finished. Cleaning up...")
 
+               if len(self._failed_pkgs_all) > 1:
+                       _flush_elog_mod_echo()
+                       msg = "The following packages have " + \
+                               "failed to build or install:"
+                       prefix = bad(" * ")
+                       writemsg(prefix + "\n", noiselevel=-1)
+                       from textwrap import wrap
+                       for line in wrap(msg, 72):
+                               writemsg("%s%s\n" % (prefix, line), noiselevel=-1)
+                       writemsg(prefix + "\n", noiselevel=-1)
+                       for pkg, returncode in self._failed_pkgs_all:
+                               writemsg("%s\t%s\n" % (prefix,
+                                       colorize("INFORM", str(pkg))),
+                                       noiselevel=-1)
+                       writemsg(prefix + "\n", noiselevel=-1)
+
                return rval
 
        def _add_packages(self):
@@ -9883,6 +9901,18 @@ def display_news_notification(trees):
                print "Use " + colorize("GOOD", "eselect news") + " to read news items."
                print
 
+def _flush_elog_mod_echo():
+       """
+       Dump the mod_echo output now so that our other
+       notifications are shown last.
+       """
+       try:
+               from portage.elog import mod_echo
+       except ImportError:
+               pass # happens during downgrade to a version without the module
+       else:
+               mod_echo.finalize()
+
 def post_emerge(trees, mtimedb, retval):
        """
        Misc. things to run at the end of a merge session.
@@ -9929,14 +9959,7 @@ def post_emerge(trees, mtimedb, retval):
                exit_msg = " *** exiting unsuccessfully with status '%s'." % retval
        emergelog("notitles" not in settings.features, exit_msg)
 
-       # Dump the mod_echo output now so that our other notifications are shown
-       # last.
-       try:
-               from portage.elog import mod_echo
-       except ImportError:
-               pass # happens during downgrade to a version without the module
-       else:
-               mod_echo.finalize()
+       _flush_elog_mod_echo()
 
        vdb_path = os.path.join(target_root, portage.VDB_PATH)
        portage.util.ensure_dirs(vdb_path)