commit: cdc8191e17e7dd1a6af1579ee2514a69811cf97b Author: Benjamin Gordon <bmgordon <AT> chromium <DOT> org> AuthorDate: Tue Feb 4 18:40:13 2020 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Sat Feb 18 00:00:12 2023 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=cdc8191e
emerge: Log completion of package installs The log currently shows Emerging/Installing progress messages, but it doesn't indicate when a package finishes. Since there can be dozens of installs in flight at once, this makes it nearly impossible to determine how long an individual package took. This adds a similar "Completed" line when the package merge completes. Closes: https://github.com/gentoo/portage/pull/987 Reviewed-by: Mike Frysinger <vapier <AT> chromium.org> Reviewed-by: Chris McDonald <cjmcdonald <AT> chromium.org> Signed-off-by: Benjamin Gordon <bmgordon <AT> chromium.org> Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org> Signed-off-by: Sam James <sam <AT> gentoo.org> NEWS | 2 ++ lib/_emerge/PackageMerge.py | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/NEWS b/NEWS index fbc847c37..8a4d95144 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,8 @@ Features: * install-qa-check.d: 60pkgconfig: add opt-in QA_PKGCONFIG_VERSION check +* emerge: Log completion of package installs. + Bug fixes: * gpkg: Handle out-of-space errors (bug #891391). diff --git a/lib/_emerge/PackageMerge.py b/lib/_emerge/PackageMerge.py index f9e6bf8fe..82725c66a 100644 --- a/lib/_emerge/PackageMerge.py +++ b/lib/_emerge/PackageMerge.py @@ -58,5 +58,25 @@ class PackageMerge(CompositeTask): def _install_exit(self, task): self.postinst_failure = getattr(task, "postinst_failure", None) + + pkg = self.merge.pkg + pkg_count = self.merge.pkg_count + + if self.postinst_failure: + action_desc = "Failed" + preposition = "in" + counter_str = "" + else: + action_desc = "Completed" + preposition = "to" + counter_str = "({} of {}) ".format( + colorize("MERGE_LIST_PROGRESS", str(pkg_count.curval)), + colorize("MERGE_LIST_PROGRESS", str(pkg_count.maxval)), + ) + + if self._should_show_status(): + msg = self._make_msg(pkg, action_desc, preposition, counter_str) + self.merge.statusMessage(msg) + self._final_exit(task) self.wait()
