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 3/4] knotty: convert warnings to errors when -W is passed
Date: Tue, 13 Oct 2026 14:13:36 +0200 [thread overview]
Message-ID: <20261013-warn-as-errors-v1-3-ab3658758ceb@bootlin.com> (raw)
In-Reply-To: <20261013-warn-as-errors-v1-0-ab3658758ceb@bootlin.com>
When -W is passed, modify the handlers to show warnings in red and set
the return value to 1. Add a summary line informing the user that the -W
option was used as it might not be obvious when looking at the bottom
the end of the console log.
Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
---
lib/bb/ui/knotty.py | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/lib/bb/ui/knotty.py b/lib/bb/ui/knotty.py
index 1a3198b5c02..a3a5c374a35 100644
--- a/lib/bb/ui/knotty.py
+++ b/lib/bb/ui/knotty.py
@@ -662,6 +662,14 @@ def main(server, eventHandler, params, tf = TerminalFilter):
# terminal handler
console_handlers = [h for h in conf.config['handlers'].values() if getattr(h, 'is_console', False)]
+ if params.werror:
+ # Change the color of warning/warnonce messages to red when -W is passed
+ for h in console_handlers:
+ try:
+ h.formatter.set_warn_color_red()
+ except AttributeError:
+ pass
+
bb.utils.set_process_name("KnottyUI")
if params.options.remote_server and params.options.kill_server:
@@ -782,6 +790,8 @@ def main(server, eventHandler, params, tf = TerminalFilter):
return_value = 1
elif event.levelno == bb.msg.BBLogFormatter.WARNING:
warnings = warnings + 1
+ if params.werror:
+ return_value = 1
if event.taskpid != 0:
# For "normal" logging conditions, don't show note logs from tasks
@@ -1054,6 +1064,10 @@ def main(server, eventHandler, params, tf = TerminalFilter):
if return_value and errors:
summary += pluralise("\nSummary: There was %s ERROR message, returning a non-zero exit code.",
"\nSummary: There were %s ERROR messages, returning a non-zero exit code.", errors)
+
+ if params.werror and warnings:
+ summary += "\nSummary: Warnings were treated as errors (-W)."
+
if summary and params.options.quiet == 0:
print(summary)
--
2.55.0
next prev 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 ` [PATCH 2/4] msg: add a helper to show warnings in red color Antonin Godard
2026-10-13 12:13 ` Antonin Godard [this message]
2026-10-15 8:58 ` [bitbake-devel] [PATCH 3/4] knotty: convert warnings to errors when -W is passed 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-3-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.