[honister,04/17] sstate: Improve failure to obtain archive message/handling

Message ID 25a7e8dae10dde6073dcdd80f1e2448b59dc9d1a.1643983711.git.anuj.mittal@intel.com
State Accepted, archived
Commit 25a7e8dae10dde6073dcdd80f1e2448b59dc9d1a
Headers show
Series [honister,01/17] kernel: introduce python3-dtschema-wrapper | expand

Commit Message

Mittal, Anuj Feb. 4, 2022, 2:12 p.m. UTC
From: Richard Purdie <richard.purdie@linuxfoundation.org>

The bb.fatal() case where sstate failed to find/use an archive in setcene tasks
is suboptimal. Bitbakes handling of setscene tasks will be to warn but the fatal
will turn this into an error, despite the real task being rerun.

In these failure cases other messages would usually have been printed so turn
this into a warning and raise a handled exception status so that bitbake knows
to fail the task but not print more messages.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 7875baeca7a3ed216b2442fb8771e51efbfa5a4f)
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
---
 meta/classes/sstate.bbclass | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Patch

diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index 566a58dafb..103de01264 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -788,7 +788,9 @@  def sstate_setscene(d):
     shared_state = sstate_state_fromvars(d)
     accelerate = sstate_installpkg(shared_state, d)
     if not accelerate:
-        bb.fatal("No suitable staging package found")
+        msg = "No sstate archive obtainable, will run full task instead."
+        bb.warn(msg)
+        raise bb.BBHandledException(msg)
 
 python sstate_task_prefunc () {
     shared_state = sstate_state_fromvars(d)