commit: 2e572b9edc48a6d4623df1c2c46ba34316f7e72a Author: Sam James <sam <AT> gentoo <DOT> org> AuthorDate: Fri Sep 15 03:55:10 2023 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Fri Sep 15 10:36:47 2023 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=2e572b9e
elog: mod_echo: use binpkg coloring With the 'echo' elog module, we get messages like: ``` * Messages for package X * Log file: /var/log/portage/build/[...] ``` Colorize 'X' based on whether it's a binpkg or not, rather than always using green as if it was built from source. Bug: https://bugs.gentoo.org/914159 Signed-off-by: Sam James <sam <AT> gentoo.org> lib/portage/elog/mod_echo.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/portage/elog/mod_echo.py b/lib/portage/elog/mod_echo.py index a63939988a..e8a0d49fc4 100644 --- a/lib/portage/elog/mod_echo.py +++ b/lib/portage/elog/mod_echo.py @@ -22,7 +22,9 @@ def process(mysettings, key, logentries, fulltext): and "PORTAGE_LOG_FILE" in mysettings ): logfile = mysettings["PORTAGE_LOG_FILE"] - _items.append((mysettings["ROOT"], key, logentries, logfile)) + + binary = mysettings.configdict["pkg"]["MERGE_TYPE"] == "binary" + _items.append((mysettings["ROOT"], key, logentries, logfile, binary)) def finalize(): @@ -42,14 +44,17 @@ def finalize(): def _finalize(): global _items printer = EOutput() - for root, key, logentries, logfile in _items: + for root, key, logentries, logfile, binary in _items: + color = "PKG_BINARY_MERGE" if binary else "INFORM" + print() + if root == "/": - printer.einfo(_("Messages for package %s:") % colorize("INFORM", key)) + printer.einfo(_("Messages for package %s:") % colorize(color, key)) else: printer.einfo( _("Messages for package %(pkg)s merged to %(root)s:") - % {"pkg": colorize("INFORM", key), "root": root} + % {"pkg": colorize(color, key), "root": root} ) if logfile is not None: printer.einfo(_("Log file: %s") % colorize("INFORM", logfile))