public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/elog/
Date: Fri, 15 Sep 2023 10:36:50 +0000 (UTC)	[thread overview]
Message-ID: <1694774207.2e572b9edc48a6d4623df1c2c46ba34316f7e72a.sam@gentoo> (raw)

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))


             reply	other threads:[~2023-09-15 10:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-15 10:36 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-09-16  9:47 [gentoo-commits] proj/portage:master commit in: lib/portage/elog/ Sam James
2020-08-06  7:02 Zac Medico
2020-08-06  7:02 Zac Medico
2020-08-03 21:42 Zac Medico

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1694774207.2e572b9edc48a6d4623df1c2c46ba34316f7e72a.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox