From: Paul Barker <paul@pbarker.dev>
To: Jose Quaresma <quaresma.jose@gmail.com>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [OE-core] [PATCH v3 2/4] meta: Support opting out of any distro features
Date: Thu, 23 Apr 2026 10:11:55 +0100 [thread overview]
Message-ID: <b44d65517593ec7279aef2618f49e00908eb938c.camel@pbarker.dev> (raw)
In-Reply-To: <CANPvuRmjv0YyiPqACX6JuhUfxSTYsiCQfstHxA+kFmE0sny+bg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 4310 bytes --]
On Wed, 2026-04-22 at 21:26 +0100, Jose Quaresma wrote:
> Jose Quaresma via lists.openembedded.org <quaresma.jose=
> gmail.com@lists.openembedded.org> escreveu (quarta, 22/04/2026 à(s) 15:45):
>
> > Hi Paul,
> >
> > I think I found a bug that is somehow related to DISTRO_FEATURES_DEFAULTS.
> > I don't understand why, but the variables in
> > DISTRO_FEATURES_DEFAULTS cannot
> > be used in inherit or inherit_defer.
> >
> > Let's use the following recipe as an example:
> >
> > -------------------------------------------------------------------------------------------------------------------
> > mkdir -p recipes-test/inherit
> > cat <<'EOF' >recipes-test/inherit/inherit.bb
> >
> > LICENSE = "MIT"
> >
> > # FAIL
> > PACKAGECONFIG ??= " \
> > ${@bb.utils.contains('DISTRO_FEATURES',
> > 'gobject-introspection-data', 'ccache', '', d)} \
> > ${@bb.utils.contains('DISTRO_FEATURES',
> > 'gobject-introspection-data', 'vala', '', d)} \
> > "
> >
> > # OK
> > #PACKAGECONFIG ??= " \
> > # ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'ccache', '',
> > d)} \
> > # ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'vala', '',
> > d)} \
> > #"
> >
> > # get PACKAGECONFIG
> > # bitbake-getvar -r inherit PACKAGECONFIG
> >
> > # get CCACHE_TOP_DIR
> > # bitbake-getvar -r inherit CCACHE_TOP_DIR
> > inherit_defer ${@bb.utils.filter('PACKAGECONFIG', 'ccache', d)}
> >
> > # get VALADEPENDS
> > # bitbake-getvar -r inherit VALADEPENDS
> > inherit_defer ${@bb.utils.filter('PACKAGECONFIG', 'vala', d)}
> > EOF
> >
> > -------------------------------------------------------------------------------------------------------------------
> >
>
> A clearer way to replicate the problem:
>
> #
> -------------------------------------------------------------------------------------------------------------------
> mkdir -p recipes-test/inherit
> cat <<'EOF' >recipes-test/inherit/inherit.bb
> LICENSE = "MIT"
>
> DISTRO_FEATURES_DEFAULTS += "aaa"
> DISTRO_FEATURES += "bbb"
>
> PACKAGECONFIG = " \
> ${@bb.utils.contains('DISTRO_FEATURES', 'aaa', 'ccache', '', d)} \
> ${@bb.utils.contains('DISTRO_FEATURES', 'bbb', 'vala', '', d)} \
> "
>
> inherit_defer ${@bb.utils.filter('PACKAGECONFIG', 'ccache', d)}
>
> inherit_defer ${@bb.utils.filter('PACKAGECONFIG', 'vala', d)}
> EOF
> #
> -------------------------------------------------------------------------------------------------------------------
> bitbake-getvar --value -r inherit PACKAGECONFIG
> bitbake-getvar --value -r inherit CCACHE_TOP_DIR
> bitbake-getvar --value -r inherit VALADEPENDS
> #
> -------------------------------------------------------------------------------------------------------------------
>
>
> The DISTRO_FEATURES is mapped to inherit/inherit_defer as follows:
> 'aaa' maps to 'ccache'
> 'bbb' maps to 'vala'
>
> I chose these two classes, but it could be any others. The idea is to see
> if they were inherited by looking at the class variables.
> The ccache.bbclass was not inherit and so the variable 'CCACHE_TOP_DIR' is
> not defined.
>
>
> Hence my conclusion that DISTRO_FEATURES_DEFAULTS doesn't work for these
> cases, which in my opinion is not expected.
>
> I encountered this problem while debugging the patch
> https://lists.openembedded.org/g/openembedded-devel/topic/118939974.
>
> Best regards,
> Jose
>
Hi Jose,
We can simplify this even further to demonstrate what bitbake is doing:
LICENSE = "MIT"
python () {
d.setVar('MAYBE_VALA', 'vala')
}
inherit_defer ${@bb.utils.filter('MAYBE_VALA', 'vala', d)}
Looking at the output of `bitbake -e`, MAYBE_VALA is set to "vala" but
the vala bbclass is not included.
If we simplify the last line to `inherit_defer ${MAYBE_VALA}` we get a
parse error. It also doesn't work with plain inherit.
This contadicts the example in the bitbake docs [1], which suggests that
a variable assigned in an anonymous Python block can be used with
inherit_defer.
[1]: https://docs.yoctoproject.org/bitbake/dev/bitbake-user-manual/bitbake-user-manual-metadata.html#inherit-defer-directive
I will investigate further!
Best regards,
--
Paul Barker
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 252 bytes --]
next prev parent reply other threads:[~2026-04-23 9:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-01 17:41 [PATCH v3 0/4] Support opt-out of any default machine and distro features Paul Barker
2026-04-01 17:41 ` [PATCH v3 1/4] oelib: utils: Support filtering default features Paul Barker
2026-04-01 17:41 ` [PATCH v3 2/4] meta: Support opting out of any distro features Paul Barker
2026-04-22 14:45 ` [OE-core] " Jose Quaresma
[not found] ` <18A8B511426C8EDA.1516946@lists.openembedded.org>
2026-04-22 20:26 ` Jose Quaresma
2026-04-23 9:11 ` Paul Barker [this message]
2026-04-23 9:42 ` Jose Quaresma
[not found] ` <18A8F319FD743690.2028604@lists.openembedded.org>
2026-04-24 8:44 ` Jose Quaresma
2026-04-01 17:41 ` [PATCH v3 3/4] meta: Support opting out of any machine features Paul Barker
2026-04-01 17:41 ` [PATCH v3 4/4] lib: oe: Drop backfill support Paul Barker
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=b44d65517593ec7279aef2618f49e00908eb938c.camel@pbarker.dev \
--to=paul@pbarker.dev \
--cc=openembedded-core@lists.openembedded.org \
--cc=quaresma.jose@gmail.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