Bug 14807 - oe.utils.ImageQAFailed is not BBHandled
Summary: oe.utils.ImageQAFailed is not BBHandled
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: configuration (show other bugs)
Version: 4.0.1
Hardware: All Multiple
: Medium normal
Target Milestone: Future
Assignee: Ola Nilsson
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2022-05-20 07:45 UTC by Ola Nilsson
Modified: 2024-09-23 09:57 UTC (History)
2 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Don't know


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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