From: Joao Marcos Costa <joaomarcos.costa@bootlin.com>
To: quentin.schulz@cherry.de, openembedded-core@lists.openembedded.org
Cc: thomas.petazzoni@bootlin.com
Subject: Re: [OE-core] [PATCH] meta: simplify conditional operations with bb.utils.filter
Date: Mon, 27 Apr 2026 10:38:17 +0200 [thread overview]
Message-ID: <d34abdf5-0ea6-4aae-a334-14f85e12449c@bootlin.com> (raw)
In-Reply-To: <f038565f-4a53-426b-990f-d41e9d1e3732@cherry.de>
Hello, Quentin
On 4/24/26 17:40, Quentin Schulz via lists.openembedded.org wrote:
> Hi João,
>
> On 4/24/26 5:17 PM, Joao Marcos Costa via lists.openembedded.org wrote:
>> Some recipes and configuration files use bb.utils.contains to check for
>> a string inside a variable, and return the exact same string if true.
>>
>> This can be simplified by a call to bb.utils.filter, since the result is
>> the same, and the inline is shorter.
>>
>> Replace "bb.utils.contains(A, 'a', 'a', '', d)" by "bb.utils.filter(A,
>> 'a', d)".
>>
>> Signed-off-by: João Marcos Costa <joaomarcos.costa@bootlin.com>
>> ---
(...)
> I'm pretty sure your changes in the conf files won't work, but maybe I'm
> wrong?
>
> Before, we only added a space if there was a new tune to add. Now, it's
> always added.
>
> Considering TUNE_CCARGS_MFPU can now possibly contain only spaces, the
> check if TUNE_CCARGS_MFPU is not the empty string to access the last
> element in the list returned by split(), which will now be the empty
> list, will raise an IndexError exception.
>
> You need to adapt anything that's using this variable to check if it
> only contains spaces or at least remove spurious ones, possibly with
> str.strip() for example. Unfortunately, if TUNE_CCARGS_MFPU doesn't
> exist, d.getVar() will return None and you cannot strip() on None. Of
> course, considering TUNE_CCARGS_MFPU is declared just above in the file,
> it'll always be defined, so maybe that's fine to not check for None.
>
> If the space didn't matter, we probably would have used += instead of
> .=, so I'm wary of this change (the rest looks fine).
>
> Cheers,
> Quentin
Thanks for your review. And yes, I'm looking at this part of the patch
again, and I'm considering two things:
a) Add the strip() as you said, here, and keep my changes:
-TUNE_CCARGS .= "${@ (' -mfpu=%s' %
d.getVar('TUNE_CCARGS_MFPU').split()[-1]) if
(d.getVar('TUNE_CCARGS_MFPU') != '') else ''}"
+TUNE_CCARGS .= "${@ (' -mfpu=%s' %
d.getVar('TUNE_CCARGS_MFPU').split()[-1]) if
(d.getVar('TUNE_CCARGS_MFPU').strip() != '') else ''}"
# The following deals with both vfpv3-d16 and vfpv4-d16
-ARMPKGSFX_FPU = "${@ ('-%s' %
d.getVar('TUNE_CCARGS_MFPU').split()[-1].replace('-d16', 'd16')) if
(d.getVar('TUNE_CCARGS_MFPU') != '') else ''}"
+ARMPKGSFX_FPU = "${@ ('-%s' %
d.getVar('TUNE_CCARGS_MFPU').split()[-1].replace('-d16', 'd16')) if
(d.getVar('TUNE_CCARGS_MFPU').strip() != '') else ''}"
b) Simply remove those changes, then send another patch keeping only the
changes in recipes.
What do you think?
--
Best regards,
João Marcos Costa
next prev parent reply other threads:[~2026-04-27 8:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-24 15:17 [PATCH] meta: simplify conditional operations with bb.utils.filter João Marcos Costa
2026-04-24 15:40 ` [OE-core] " Quentin Schulz
2026-04-27 8:38 ` Joao Marcos Costa [this message]
2026-04-27 10:45 ` Quentin Schulz
2026-04-27 10:53 ` Joao Marcos Costa
2026-04-27 8:49 ` ChenQi
2026-04-27 9:30 ` Joao Marcos Costa
2026-04-27 10:05 ` ChenQi
2026-04-27 11:01 ` Joao Marcos Costa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d34abdf5-0ea6-4aae-a334-14f85e12449c@bootlin.com \
--to=joaomarcos.costa@bootlin.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=quentin.schulz@cherry.de \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox