kwargs.pop("short_msg", None)
emergelog(self.xterm_titles, *pargs, **kwargs)
+ class _failed_pkg(SlotObject):
+ __slots__ = ("log_path", "pkg", "returncode")
+
def __init__(self, settings, trees, mtimedb, myopts,
spinner, mergelist, favorites, digraph):
PollScheduler.__init__(self)
if not failed_pkgs:
break
- for failed_pkg, returncode in failed_pkgs:
- mergelist.remove(list(failed_pkg))
+ for failed_pkg in failed_pkgs:
+ mergelist.remove(list(failed_pkg.pkg))
self._failed_pkgs_all.extend(failed_pkgs)
del failed_pkgs[:]
def _eerror(lines):
for l in lines:
- eerror(l, phase="other", key=failed_pkg.cpv)
+ eerror(l, phase="other", key=failed_pkg.pkg.cpv)
msg = []
msg.append("One or more packages have been " + \
self._logger.log(" *** Finished. Cleaning up...")
+ if failed_pkgs:
+ self._failed_pkgs_all.extend(failed_pkgs)
+ del failed_pkgs[:]
+
background = self._background
- if self._failed_pkgs_all and background and \
+ failure_log_shown = False
+ if background and len(self._failed_pkgs_all) == 1:
+ # If only one package failed then just show it's
+ # whole log for easy viewing.
+ failed_pkg = self._failed_pkgs_all[-1]
+ log_path = failed_pkg.log_path
+ if log_path is not None:
+ try:
+ log_file = open(log_path, 'rb')
+ except IOError:
+ pass
+ else:
+ try:
+ for line in log_file:
+ writemsg_level(line, noiselevel=-1)
+ finally:
+ log_file.close()
+ failure_log_shown = True
+
+ if background and not failure_log_shown and \
+ self._failed_pkgs_all and \
self._failed_pkgs_die_msgs and \
not _flush_elog_mod_echo():
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:
+ for failed_pkg in self._failed_pkgs_all:
writemsg("%s\t%s\n" % (prefix,
- colorize("INFORM", str(pkg))),
+ colorize("INFORM", str(failed_pkg.pkg))),
noiselevel=-1)
writemsg(prefix + "\n", noiselevel=-1)
def _do_merge_exit(self, merge):
pkg = merge.merge.pkg
if merge.returncode != os.EX_OK:
- self._failed_pkgs.append((pkg, merge.returncode))
+ log_path = merge.merge.settings.get("PORTAGE_LOG_FILE")
+ self._failed_pkgs.append(self._failed_pkg(
+ log_path=log_path, pkg=pkg, returncode=merge.returncode))
self._status_display.failed = len(self._failed_pkgs)
return
self._task_queues.merge.add(merge)
self._status_display.merges = len(self._task_queues.merge)
else:
- self._failed_pkgs.append((build.pkg, build.returncode))
+ log_path = build.settings.get("PORTAGE_LOG_FILE")
+ self._failed_pkgs.append(self._failed_pkg(
+ log_path=log_path, pkg=build.pkg, returncode=build.returncode))
self._status_display.failed = len(self._failed_pkgs)
self._deallocate_config(build.settings)
self._jobs -= 1
self._main_loop_cleanup()
portage.elog._emerge_elog_listener = None
if failed_pkgs:
- pkg, rval = failed_pkgs[-1]
+ rval = failed_pkgs[-1].returncode
return rval