All of lore.kernel.org
 help / color / mirror / Atom feed
From: Antonin Godard <antonin.godard@bootlin.com>
To: bitbake-devel@lists.openembedded.org
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	 docs@lists.yoctoproject.org,
	Antonin Godard <antonin.godard@bootlin.com>
Subject: [PATCH 2/4] msg: add a helper to show warnings in red color
Date: Tue, 13 Oct 2026 14:13:35 +0200	[thread overview]
Message-ID: <20261013-warn-as-errors-v1-2-ab3658758ceb@bootlin.com> (raw)
In-Reply-To: <20261013-warn-as-errors-v1-0-ab3658758ceb@bootlin.com>

In preparation for the next commit, add a helper that changes the
warning color to be red, when warnings should be treated as errors. This
helps users recognizing that the -W argument was passed while still
being able to differentiate between warning and error messages (thanks
to their levelname).

Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
---
 lib/bb/msg.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib/bb/msg.py b/lib/bb/msg.py
index 4f616ff42e7..02728c44bba 100644
--- a/lib/bb/msg.py
+++ b/lib/bb/msg.py
@@ -102,6 +102,14 @@ class BBLogFormatter(logging.Formatter):
     def enable_color(self):
         self.color_enabled = True
 
+    def set_warn_color_red(self):
+        """
+        Changes the warning messages color to red. Should be
+        used when treating warnings as errors.
+        """
+        self.COLORS[self.WARNING] = self.RED
+        self.COLORS[self.WARNONCE] = self.RED
+
     def __repr__(self):
         return "%s fmt='%s' color=%s" % (self.__class__.__name__, self._fmt, "True" if self.color_enabled else "False")
 

-- 
2.55.0



  parent reply	other threads:[~2026-10-13 12:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-13 12:13 [PATCH 0/4] Add -W to treat warnings as errors Antonin Godard
2026-10-13 12:13 ` [PATCH 1/4] main: add an argument for showing " Antonin Godard
2026-10-13 12:13 ` Antonin Godard [this message]
2026-10-13 12:13 ` [PATCH 3/4] knotty: convert warnings to errors when -W is passed Antonin Godard
2026-10-15  8:58   ` [bitbake-devel] " Richard Purdie
2026-10-15 10:25     ` [docs] " Antonin Godard
2026-10-15 11:49       ` Richard Purdie
2026-10-15 12:23         ` Antonin Godard
2026-10-15 13:04           ` Richard Purdie
2026-10-15 14:07             ` Antonin Godard
2026-10-13 12:13 ` [PATCH 4/4] doc/bitbake-user-manual-intro.rst: refresh bitbake's help message Antonin Godard

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=20261013-warn-as-errors-v1-2-ab3658758ceb@bootlin.com \
    --to=antonin.godard@bootlin.com \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=docs@lists.yoctoproject.org \
    --cc=thomas.petazzoni@bootlin.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.