Bug 14807

Summary: oe.utils.ImageQAFailed is not BBHandled
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Ola Nilsson <ola.x.nilsson>
Component: configurationAssignee: Ola Nilsson <ola.x.nilsson>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: louis.rannou, richard.purdie
Version: 4.0.1   
Target Milestone: Future   
Hardware: All   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know

Description Ola Nilsson 2022-05-20 07:45:16 UTC
The code in meta/classes/image.bbclass do_image_qa indicates that image QA checks should raise oe.utils.ImageQAFailed exceptions when a problem is discovered.  

When the actual test function is executed by bb.utils.better_exec, there is no special handling for ImageQAFailed and better_exec will print the backtrace before forwarding the exception to do_image_qa to print the expected error messages. 

It's worth noting that the only image_qa_test in Poky -- license_qa_dead_symlink from meta/classes/license_image.bbclass -- does not use ImageQAException.  It uses bb.error instead.

The best solution might be to migrate to the oe.qa.handle_error function, except it might break existing image qa checks in other layers. 

Making ImageQAFailed inherit from BBHandledException would make better_exec ignore it.  But that would mean importing bb.utils into oe.utils which currently only imports standard library modules.  

Making better_exec aware of ImageQAFailed would reverse the import problem and better_exec should not need to know about image_qa specifics.

A more pythonic option might be to implement some kind of protocol where we make Exceptions indicate their bbhandled status with a object property somehow.
Comment 1 Richard Purdie 2022-05-26 12:59:12 UTC
I'd accept a patch to make ImageQAFailed inherit BBHandledException, that seems reasonable.

I also agree we should move to the oe.qa.handle_error function. I'm not too worried about backwards compatibility for this code.
Comment 2 Louis Rannou 2024-09-23 09:57:57 UTC
Fixed by 905e224849fbbed1719e0add231b00e2d570b3b4