Openembedded Bitbake Development
 help / color / mirror / Atom feed
From: Quentin Schulz <quentin.schulz@cherry.de>
To: Dawid Bijak <bijak.dawid@gmail.com>,
	bitbake-devel@lists.openembedded.org
Cc: docs@lists.yoctoproject.org, richard.purdie@linuxfoundation.org
Subject: Re: [PATCH v2 4/4] doc: bitbake-user-manual-metadata: move inline python examples to inherit section
Date: Thu, 7 May 2026 16:05:47 +0200	[thread overview]
Message-ID: <7558cb67-4ee0-4cde-9d43-4ce2b8d1ef5f@cherry.de> (raw)
In-Reply-To: <20260501091418.76994-5-bijak.dawid@gmail.com>

Hi Dawid,

On 5/1/26 11:14 AM, Dawid Bijak wrote:
> The two inline Python examples,
> 
>    inherit_defer ${@'classname' if condition else ''}
>    inherit_defer ${@bb.utils.contains('VARIABLE', 'something', 'classname', '', d)}
> 
> are presented as inherit_defer-specific techniques, but they work
> with plain inherit too. Their placement under
> inherit_defer suggests deferred evaluation is required, which is
> not the case: the ${@...} expression is evaluated when the
> inherit line is parsed in both forms.
> 
> Move the inline Python expression examples from the inherit_defer section
> up to the inherit section, since they apply to both directives.
> 

As said in V1 and in this form: NACK.

What's the raison d'être of inherit_defer if inherit "works just as well"?

To quote Richard in v1:

"""
It works, as long as you are sure that COND won't be changed after the
inherit. When mutliple files altering the variables are involved, that
is often unclear. I think the doc's intent is therefore to recommend
anything with variable accesses is therefore deferred, unless the user
is sure they know what they're doing.
"""

The commit introducing inherit_defer in BitBake is also pretty explicit 
why it was added, see 5c2e840eafeb ("ast/BBHandler: Add inherit_defer
support").

So it may appear to work for you in your specific usecase, but it 
doesn't always. We are very careful to not add unnecessary complexity, 
be it operators or directives so I trust Richard to not have merged 
something that does nothing that isn't already supported by another 
directive or operator. Yes, inherit_defer is useful for the native class 
which we always want to be last, but it's not why this directive was 
added in the first place, it's only piggy-backing there.

So, as said in v1, we are not using footguns as examples. We can however 
say that something may appear to work but is a footgun, as suggested in 
v1 where I said "You can provide an example if you really want to in the 
inherit section, and add a big fat warning after it that it'll break in 
some scenario so you really shouldn't do that and instead use 
inherit_defer.".

Cheers,
Quentin


      reply	other threads:[~2026-05-07 14:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-01  9:14 [PATCH v2 0/4] doc: bitbake-user-manual-metadata: clarify inherit_defer documentation Dawid Bijak
2026-05-01  9:14 ` [PATCH v2 1/4] doc: bitbake-user-manual-metadata: remove incorrect claim Dawid Bijak
2026-05-07 13:48   ` Quentin Schulz
2026-05-07 19:04     ` Dawid Bijak
2026-05-01  9:14 ` [PATCH v2 2/4] doc: bitbake-user-manual-metadata: remove invalid anonymous Python example Dawid Bijak
2026-05-07 13:52   ` Quentin Schulz
2026-05-01  9:14 ` [PATCH v2 3/4] doc: bitbake-user-manual-metadata: explain inherit_defer example Dawid Bijak
2026-05-07 13:56   ` Quentin Schulz
2026-05-01  9:14 ` [PATCH v2 4/4] doc: bitbake-user-manual-metadata: move inline python examples to inherit section Dawid Bijak
2026-05-07 14:05   ` Quentin Schulz [this message]

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=7558cb67-4ee0-4cde-9d43-4ce2b8d1ef5f@cherry.de \
    --to=quentin.schulz@cherry.de \
    --cc=bijak.dawid@gmail.com \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=docs@lists.yoctoproject.org \
    --cc=richard.purdie@linuxfoundation.org \
    /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