public inbox for docs@lists.yoctoproject.org
 help / color / mirror / Atom feed
From: "Antonin Godard" <antonin.godard@bootlin.com>
To: "Quentin Schulz" <quentin.schulz@cherry.de>,
	<bitbake-devel@lists.openembedded.org>
Cc: <docs@lists.yoctoproject.org>,
	"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
	"Yoann Congal" <yoann.congal@smile.fr>
Subject: Re: [bitbake-devel] [bitbake-devel PATCH] doc: bitbake-user-manual: document inherit_defer
Date: Mon, 18 Nov 2024 17:04:02 +0100	[thread overview]
Message-ID: <D5PFK80N8GYJ.1Y0G9NNHOYOGW@bootlin.com> (raw)
In-Reply-To: <672b93e1-54d4-4af8-84e3-de0912770b7d@cherry.de>

Hi Quentin,

On Mon Nov 18, 2024 at 4:44 PM CET, Quentin Schulz wrote:
[...]
>> +``inherit_defer`` Directive
>> +~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> +
>> +The ``inherit_defer`` directive works like the ``inherit`` directive, except
>
> add a ref here to the inherit directive section?

Yes, thanks.

>> +that it is only evaluated at the end of parsing. Its usage is recommended when a
>> +conditional expression is used. For example::
>> +
>> +   inherit_defer ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python3targetconfig', '', d)}
>> +
>> +This allows conditional expressions to be evaluated "late", meaning changes
>> +to the variable after the line is parsed will take effect. With the ``inherit``
>> +directive this is not the case.
>> +
>
> OK so I don't know if this wouldn't also typically apply to "inherit 
> ${VARIABLE}" if VARIABLE is set after the inherit?
>
> Ahah, I believe this is actually specified in the inherit directive section!
>
> """
> An advantage with the inherit directive as compared to both the include 
> and require directives is that you can inherit class files 
> conditionally. You can accomplish this by using a variable expression 
> after the inherit statement. Here is an example:
>
> inherit ${VARNAME}
>
> If VARNAME is going to be set, it needs to be set before the inherit 
> statement is parsed.
> """
>
> Also, I believe we very likely want to remove the last few paragraphs of 
> the inherit directive section?
>
> i.e. from
> """
> One way to achieve a conditional inherit in this case is to use overrides:
> """
> to the end of the section.
>
> I guess we could replace it with "if you want to conditionally inherit, 
> please use :ref:`inherit_defer`".
>
> or something along those lines.
>
> What do you think?

And so the documentation would advise to always use `inherit_defer` for
conditional inherits. As far as I understand the purpose of inherit_defer, this
is fine to me (and error-safe), so I agree with you on removing the conditional
case from the inherit directive section and redirecting towards inherit_defer.

This makes me wonder why inherit_defer isn't merged into inherit then (i.e.
inherit would behave like inherit_defer by default). But I guess there are other
stakes that go beyond my knowledge on this. :)

Cheers,
Antonin

-- 
Antonin Godard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


      reply	other threads:[~2024-11-18 16:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-18 15:36 [bitbake-devel PATCH] doc: bitbake-user-manual: document inherit_defer Antonin Godard
2024-11-18 15:44 ` [bitbake-devel] " Quentin Schulz
2024-11-18 16:04   ` Antonin Godard [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=D5PFK80N8GYJ.1Y0G9NNHOYOGW@bootlin.com \
    --to=antonin.godard@bootlin.com \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=docs@lists.yoctoproject.org \
    --cc=quentin.schulz@cherry.de \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=yoann.congal@smile.fr \
    /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