From: Quentin Schulz <quentin.schulz@cherry.de>
To: "João Marcos Costa" <joaomarcos.costa@bootlin.com>,
openembedded-core@lists.openembedded.org
Cc: thomas.petazzoni@bootlin.com, qi.chen@windriver.com
Subject: Re: [PATCH v2 1/3] meta: simplify conditional operations with bb.utils.filter
Date: Mon, 27 Apr 2026 16:13:05 +0200 [thread overview]
Message-ID: <6a648389-c229-473e-9eed-02fe3d3a2fea@cherry.de> (raw)
In-Reply-To: <20260427130846.96013-2-joaomarcos.costa@bootlin.com>
Hi João,
On 4/27/26 3:08 PM, João Marcos Costa wrote:
> Some recipes 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>
> ---
> meta/recipes-connectivity/connman/connman_2.0.bb | 2 +-
> meta/recipes-core/coreutils/coreutils_9.10.bb | 2 +-
> meta/recipes-core/ovmf/ovmf_git.bb | 2 +-
> meta/recipes-extended/at/at_3.2.5.bb | 2 +-
> meta/recipes-graphics/libglvnd/libglvnd_1.7.0.bb | 2 +-
> meta/recipes-graphics/waffle/waffle_1.8.1.bb | 2 +-
> .../gstreamer/gstreamer1.0-plugins-bad_1.28.2.bb | 2 +-
> 7 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/meta/recipes-connectivity/connman/connman_2.0.bb b/meta/recipes-connectivity/connman/connman_2.0.bb
> index 6f7093301b..e9873f3163 100644
> --- a/meta/recipes-connectivity/connman/connman_2.0.bb
> +++ b/meta/recipes-connectivity/connman/connman_2.0.bb
> @@ -169,7 +169,7 @@ FILES:${PN}-tools = "${bindir}/wispr"
> RDEPENDS:${PN}-tools = "${PN}"
>
> FILES:${PN}-tests = "${bindir}/*-test"
> -RDEPENDS:${PN}-tests = "${@bb.utils.contains('PACKAGECONFIG', 'iptables', 'iptables', '', d)}"
> +RDEPENDS:${PN}-tests = "${@bb.utils.filter('PACKAGECONFIG', 'iptables', d)}"
>
> FILES:${PN}-client = "${bindir}/connmanctl"
> RDEPENDS:${PN}-client = "${PN}"
> diff --git a/meta/recipes-core/coreutils/coreutils_9.10.bb b/meta/recipes-core/coreutils/coreutils_9.10.bb
> index 984c5b5292..744d930272 100644
> --- a/meta/recipes-core/coreutils/coreutils_9.10.bb
> +++ b/meta/recipes-core/coreutils/coreutils_9.10.bb
> @@ -222,6 +222,6 @@ do_install_ptest:append:libc-musl () {
> }
>
> RDEPENDS:${PN}-ptest += "xz \
> - ${@bb.utils.contains('PACKAGECONFIG', 'acl', 'acl', '', d)} \
> + ${@bb.utils.filter('PACKAGECONFIG', 'acl', d)} \
> ${@bb.utils.contains('PACKAGECONFIG', 'xattr', 'attr', '', d)}"
> FILES:${PN}-ptest += "${bindir}/getlimits"
> diff --git a/meta/recipes-core/ovmf/ovmf_git.bb b/meta/recipes-core/ovmf/ovmf_git.bb
> index d731bca7f2..38d5d090b4 100644
> --- a/meta/recipes-core/ovmf/ovmf_git.bb
> +++ b/meta/recipes-core/ovmf/ovmf_git.bb
> @@ -10,7 +10,7 @@ LIC_FILES_CHKSUM = "file://OvmfPkg/License.txt;md5=06357ddc23f46577c2aeaeaf7b776
> # compiling OVMF twice, so it is disabled by default. Distros
> # may change that default.
> PACKAGECONFIG ??= ""
> -PACKAGECONFIG += "${@bb.utils.contains('MACHINE_FEATURES', 'tpm', 'tpm', '', d)}"
> +PACKAGECONFIG += "${@bb.utils.filter('MACHINE_FEATURES', 'tpm', d)}"
> PACKAGECONFIG += "${@bb.utils.contains('MACHINE_FEATURES', 'tpm2', 'tpm', '', d)}"
I believe we could actually use
bb.utils.contains_any('MACHINE_FEATURES', 'tpm tpm2', 'tpm', '', d)
to merge the two tpm MACHINE_FEATURES that enable the same PACKAGECONFIG.
It also irks me that we're using += here instead of
PACKAGECONFIG ?= "${@bb.utils.contains_any('MACHINE_FEATURES', 'tpm
tpm2', 'tpm', '', d)}"
(or ??=), but maybe that's fine (or in a separate commit anyway).
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Thanks!
Quentin
next prev parent reply other threads:[~2026-04-27 14:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-27 13:08 [PATCH v2 0/3] Simplify conditional operations with bb.utils.filter João Marcos Costa
2026-04-27 13:08 ` [PATCH v2 1/3] meta: simplify " João Marcos Costa
2026-04-27 14:13 ` Quentin Schulz [this message]
2026-04-27 13:08 ` [PATCH v2 2/3] classes-global: insane.bbclass : " João Marcos Costa
2026-04-27 14:15 ` Quentin Schulz
2026-04-27 13:08 ` [PATCH v2 3/3] machine: include: arm: " João Marcos Costa
2026-04-27 14:21 ` Quentin Schulz
2026-05-04 8:36 ` [OE-core] " Richard Purdie
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=6a648389-c229-473e-9eed-02fe3d3a2fea@cherry.de \
--to=quentin.schulz@cherry.de \
--cc=joaomarcos.costa@bootlin.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=qi.chen@windriver.com \
--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