diff mbox series

[3/4] insane: Explicitly fail parsing if QA errors were raised

Message ID 20250728095936.1495441-4-philip.lorenz@bmw.de
State New
Headers show
Series Improve handling of build qa issues | expand

Commit Message

Philip Lorenz July 28, 2025, 9:59 a.m. UTC
So far, failing the build when a QA error was raised happened implicitly
when another (unrelated) caller called `exit_if_errors` (e.g.
insane.bbclass's anonymous Python function). This is error prone and may
also lead to inconsistent abortion behaviour when parsing QA errors are
only raised later.

Fix this by introducing an explicit call to `exit_if_errors` once recipe
parsing has finished.

Currently code in the following .bbclasses relies on insane.bbclass to
call `exit_if_errors`:
* license.bbclass
* yocto-check-layer.bbclass

Signed-off-by: Philip Lorenz <philip.lorenz@bmw.de>
---
 meta/classes-global/base.bbclass   | 4 ++++
 meta/classes-global/insane.bbclass | 2 --
 2 files changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/meta/classes-global/base.bbclass b/meta/classes-global/base.bbclass
index 6be1f5c2df2..6fe37755ffa 100644
--- a/meta/classes-global/base.bbclass
+++ b/meta/classes-global/base.bbclass
@@ -348,6 +348,10 @@  python base_eventhandler() {
                     profprov = d.getVar("PREFERRED_PROVIDER_" + p)
                     if profprov and pn != profprov:
                         raise bb.parse.SkipRecipe("PREFERRED_PROVIDER_%s set to %s, not %s" % (p, profprov, pn))
+
+        # Bail out early if parsing raised any QA errors
+        oe.qa.exit_if_errors(d)
+
 }
 
 CONFIGURESTAMPFILE = "${WORKDIR}/configure.sstate"
diff --git a/meta/classes-global/insane.bbclass b/meta/classes-global/insane.bbclass
index fed8163c3e0..f0b7f83e51d 100644
--- a/meta/classes-global/insane.bbclass
+++ b/meta/classes-global/insane.bbclass
@@ -1627,6 +1627,4 @@  python () {
                 if broken_order:
                     oe.qa.handle_error("native-last", "%s: native/nativesdk class is not inherited last, this can result in unexpected behaviour. "
                                              "Classes inherited after native/nativesdk: %s" % (pn, " ".join(broken_order)), d)
-
-    oe.qa.exit_if_errors(d)
 }