Bug 15515 - Improve oe.qa.handle_error not to depend on whole ERROR_QA and WARN_QA value
Summary: Improve oe.qa.handle_error not to depend on whole ERROR_QA and WARN_QA value
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: oe-core other (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Medium+ normal
Target Milestone: 5.99
Assignee: Martin Jansa
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2024-06-13 12:01 UTC by Martin Jansa
Modified: 2024-09-03 10:47 UTC (History)
3 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Jansa 2024-06-13 12:01:53 UTC
13:48 < JaMa> would it make sense to implement something like DISTRO_FEATURES_FILTER_NATIVE from 
              https://git.openembedded.org/openembedded-core/commit/?id=731744d5538e315702be828e6f2bd556309dee07 but for ERROR_QA and WARN_QA? I 
              have DISTROs with different ERROR_QA and they don's share -native sstate, because do_recipe_qa is different

13:50 < JaMa> when it was only used in do_package_qa then it was fine (as it didn't affect -native), but now with 
              meta/classes-global/insane.bbclass:addtask do_recipe_qa before do_fetch do_package_qa do_build it affects everything

13:54 < JaMa> or change it similarly as DISTRO_FEATURES that it changes signature only when one of the currently used ones is or isn't in 
              ERROR_QA (currently it uses missing-metadata, missing-maintainer, src-uri-bad)

13:55 < RP> JaMa: the latter sounds more attractive
13:55 < JaMa> if error_class in (d.getVar("ERROR_QA") or "").split() replacing this with contains might help, right?
13:56 < JaMa> in meta/lib/oe/qa.py handle_error

13:56 < RP> JaMa: yes, that would be the right direction
13:56 < JaMa> ok, will add it to my TODO list
Comment 1 Martin Jansa 2024-06-19 17:13:09 UTC
I've updated 2 WIP commits in:
https://git.openembedded.org/openembedded-core-contrib/log/?h=jansa/master-qa

Unfortunately this still isn't enough, with this applied I still see
in bitbake-diffsigs output:
List of dependencies for variable ERROR_QA is []
List of dependencies for variable oe.qa.handle_error is ['ERROR_QA', 'oe.qa.write_error']
Variable ERROR_QA value is dev-so debug-deps
Variable oe.qa.handle_error value is

Need to debug the parser a bit to find why it still tracks whole ERROR_QA.
Comment 2 Martin Jansa 2024-06-21 10:07:35 UTC
With some debug output added to codeparser.py I've found that bb.utils.contains correctly ends in def visit_Call(self, node):
https://git.openembedded.org/bitbake/tree/lib/bb/codeparser.py?id=89712949de9476e4674864a8dcd6862fefe92eae#n261

                if name in self.containsfuncs and isinstance(node.args[1], ast.Constant):
                    if varname not in self.contains:
                        self.contains[varname] = set()
                    self.contains[varname].add(node.args[1].value)

But error_class variable isn't ast.Constant so it doesn't use this optimization and instead just adds whole ERROR_QA varname in:
https://git.openembedded.org/bitbake/tree/lib/bb/codeparser.py?id=89712949de9476e4674864a8dcd6862fefe92eae#n275

Not sure what we can do in this case without bigger changes to codeparser or how handle_error used (e.g. doing the contains first and then calling handle_error or handle_warn or handle_note, but that would make instane.bbclass terrible and won't even work in cases like:

meta/classes-global/insane.bbclass:        oe.qa.handle_error(w, warnings[w], d)
meta/classes-global/insane.bbclass:        oe.qa.handle_error(e, errors[e], d)

Please suggest if there is better way how to fix this (or to close as Won't Fix).
Comment 3 Randy MacLeod 2024-06-27 14:35:23 UTC
Richard will take a deeper look at this but maybe not for 5.1.
Comment 4 Richard Purdie 2024-08-28 12:11:05 UTC
I've added some code to bitbake which allows handle_error to be specially handled. This solves some of the issues in do_recipe_qa and do_populate_sysroot but we'll still have to rework insane to use string constants in the calls if we want things to work there.
Comment 6 Richard Purdie 2024-09-03 10:47:08 UTC
https://git.yoctoproject.org/poky/commit/?id=be6a4145ea02bc472688a1e4b38a1d0b1f3b0d50 and the preceding patches mean ERROR_QA no longer causes unnecessary task rebuilds.