Re: [OE-core] [PATCH] meta: simplify conditional operations with bb.utils.filter

Joao Marcos Costa
2026-04-27T09:31:09Z

Hello, Chen

On 4/27/26 10:49, Chen Qi via lists.openembedded.org wrote:
> When using filter for two different things, isn't it a little strange?
>
> Take the first change you made as an example:
>
> -ERROR_QA:append ="${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '
> usrmerge', '', d)}"
> +ERROR_QA:append = " ${@bb.utils.filter('DISTRO_FEATURES', 'usrmerge', d)}"
>
> Previously, the line is very clear. It reads like: if DISTRO_FEATURES
> contains 'usrmerge', append ' usrmerge' to ERROR_QA.

So far, this applies to bb.utils.filter() as a whole. Unless your point
is about the space in ' usrmerge'.

> After the change, it reads like: filter usrmerge from DISTRO_FEATRUES to
> ERROR_QA.
> By doing this, you're connecting these two variables (DISTRO_FEATURES &
> ERROR_QA) conceptually.

I'm not sure I interpret/read this line the same way you do. Once again,
unless I misunderstood your point, the way you read bb.utils.filter()
applies to every use of such helper.

How different is this ERROR_QA case from the other occurences of
bb.utils.filter() in my patch (i.e., in the *.bb), or even in oe-core?

> And the leading space is also a tiny problem.

After Quentin's comment, I double-checked and ERROR_QA is not handled in
the same way as TUNE_CCARGS_MFPU, so the extra leading space should be
fine. I agree, however, that it's not very nice to add it unconditionally.

One more thing: could you please clarify what you mean by "two different
things"? I'm not sure to follow, even with the example. The use case is
still one and only: check if the string is in the variable, and if so,
return it.

> Regards,
> Qi

Thanks!

--
Best regards,
João Marcos Costa