* [PATCH v3 1/3] doc: bitbake-user-manual-metadata: remove incorrect claim
2026-05-09 10:43 [PATCH v3 0/3] doc: bitbake-user-manual-metadata: clarify inherit_defer documentation Dawid Bijak
@ 2026-05-09 10:43 ` Dawid Bijak
2026-05-09 10:43 ` [PATCH v3 2/3] doc: bitbake-user-manual-metadata: remove invalid anonymous Python example Dawid Bijak
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Dawid Bijak @ 2026-05-09 10:43 UTC (permalink / raw)
To: bitbake-devel; +Cc: docs, quentin.schulz, richard.purdie, Dawid Bijak
The documentation for inherit_defer contained the claim
"If VARNAME is going to be set, it needs to be set before the
inherit_defer statement is parsed"
which is incorrect and contradicts the purpose of inherit_defer.
Drop the incorrect statement.
Signed-off-by: Dawid Bijak <bijak.dawid@gmail.com>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
---
doc/bitbake-user-manual/bitbake-user-manual-metadata.rst | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
index 40cae6b05..ee6919dc4 100644
--- a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
+++ b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
@@ -829,9 +829,7 @@ Here is an example::
inherit_defer ${VARNAME}
-If ``VARNAME`` is
-going to be set, it needs to be set before the ``inherit_defer`` statement is
-parsed. One way to achieve a conditional inherit in this case is to use
+One way to achieve a conditional inherit in this case is to use
overrides::
VARIABLE = ""
--
2.48.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH v3 2/3] doc: bitbake-user-manual-metadata: remove invalid anonymous Python example
2026-05-09 10:43 [PATCH v3 0/3] doc: bitbake-user-manual-metadata: clarify inherit_defer documentation Dawid Bijak
2026-05-09 10:43 ` [PATCH v3 1/3] doc: bitbake-user-manual-metadata: remove incorrect claim Dawid Bijak
@ 2026-05-09 10:43 ` Dawid Bijak
2026-05-09 10:43 ` [PATCH v3 3/3] doc: bitbake-user-manual-metadata: explain inherit_defer example Dawid Bijak
2026-05-11 12:39 ` [docs] [PATCH v3 0/3] doc: bitbake-user-manual-metadata: clarify inherit_defer documentation Mathieu Dubois-Briand
3 siblings, 0 replies; 5+ messages in thread
From: Dawid Bijak @ 2026-05-09 10:43 UTC (permalink / raw)
To: bitbake-devel; +Cc: docs, quentin.schulz, richard.purdie, Dawid Bijak
The documentation for inherit_defer suggested that conditional inheritance
can be achieved by setting a variable inside an anonymous python function
and then referencing it from inherit_defer.
This does not work: inherit_defer is resolved before the anonymous Python
functions run.
Replace the example with a warning explaining that anonymous Python
functions cannot be used to drive inherit_defer, since they run after
the directive has already been resolved.
Suggested-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Dawid Bijak <bijak.dawid@gmail.com>
---
.../bitbake-user-manual-metadata.rst | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
index ee6919dc4..52a9e7fa7 100644
--- a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
+++ b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
@@ -835,17 +835,6 @@ overrides::
VARIABLE = ""
VARIABLE:someoverride = "myclass"
-Another method is by using :ref:`anonymous Python
-<bitbake-user-manual/bitbake-user-manual-metadata:Anonymous Python Functions>`.
-Here is an example::
-
- python () {
- if condition == value:
- d.setVar('VARIABLE', 'myclass')
- else:
- d.setVar('VARIABLE', '')
- }
-
Alternatively, you could use an inline Python expression in the
following form::
@@ -859,6 +848,14 @@ In all cases, if the expression evaluates to an
empty string, the statement does not trigger a syntax error because it
becomes a no-op.
+.. warning::
+
+ Setting or modifying variables within an :ref:`anonymous Python function
+ <bitbake-user-manual/bitbake-user-manual-metadata:Anonymous Python Functions>`
+ will have no impact on the value of that variable in an
+ :ref:`inherit_defer <ref-bitbake-user-manual-metadata-inherit-defer>` directive
+ as the function is run after the directive is resolved.
+
See also :term:`BB_DEFER_BBCLASSES` for automatically promoting classes
``inherit`` calls to ``inherit_defer``.
--
2.48.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH v3 3/3] doc: bitbake-user-manual-metadata: explain inherit_defer example
2026-05-09 10:43 [PATCH v3 0/3] doc: bitbake-user-manual-metadata: clarify inherit_defer documentation Dawid Bijak
2026-05-09 10:43 ` [PATCH v3 1/3] doc: bitbake-user-manual-metadata: remove incorrect claim Dawid Bijak
2026-05-09 10:43 ` [PATCH v3 2/3] doc: bitbake-user-manual-metadata: remove invalid anonymous Python example Dawid Bijak
@ 2026-05-09 10:43 ` Dawid Bijak
2026-05-11 12:39 ` [docs] [PATCH v3 0/3] doc: bitbake-user-manual-metadata: clarify inherit_defer documentation Mathieu Dubois-Briand
3 siblings, 0 replies; 5+ messages in thread
From: Dawid Bijak @ 2026-05-09 10:43 UTC (permalink / raw)
To: bitbake-devel; +Cc: docs, quentin.schulz, richard.purdie, Dawid Bijak
Add a short paragraph describing how the inherit_defer makes use of override
syntax to achieve conditional inheritance, and rename VARNAME to
VARIABLE to assure consistent naming throughout the documentation.
Signed-off-by: Dawid Bijak <bijak.dawid@gmail.com>
---
doc/bitbake-user-manual/bitbake-user-manual-metadata.rst | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
index 52a9e7fa7..59216f69a 100644
--- a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
+++ b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
@@ -827,7 +827,7 @@ the variable after the line is parsed will take effect. With the :ref:`inherit
Here is an example::
- inherit_defer ${VARNAME}
+ inherit_defer ${VARIABLE}
One way to achieve a conditional inherit in this case is to use
overrides::
@@ -835,6 +835,11 @@ overrides::
VARIABLE = ""
VARIABLE:someoverride = "myclass"
+:ref:`inherit_defer <ref-bitbake-user-manual-metadata-inherit-defer>`
+defers the evaluation of ``${VARIABLE}`` until the end of
+parsing. Assuming ``someoverride`` is in :term:`OVERRIDES`, ``${VARIABLE}``
+expands to ``myclass``, which is then inherited.
+
Alternatively, you could use an inline Python expression in the
following form::
--
2.48.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [docs] [PATCH v3 0/3] doc: bitbake-user-manual-metadata: clarify inherit_defer documentation
2026-05-09 10:43 [PATCH v3 0/3] doc: bitbake-user-manual-metadata: clarify inherit_defer documentation Dawid Bijak
` (2 preceding siblings ...)
2026-05-09 10:43 ` [PATCH v3 3/3] doc: bitbake-user-manual-metadata: explain inherit_defer example Dawid Bijak
@ 2026-05-11 12:39 ` Mathieu Dubois-Briand
3 siblings, 0 replies; 5+ messages in thread
From: Mathieu Dubois-Briand @ 2026-05-11 12:39 UTC (permalink / raw)
To: bijak.dawid, bitbake-devel; +Cc: docs, quentin.schulz, richard.purdie
On Sat May 9, 2026 at 12:43 PM CEST, Dawid Bijak via lists.yoctoproject.org wrote:
> v3 of a series addressing a few inaccuracies I came across while reading the inherit_defer documentation.
>
Hi Dawid,
Thanks for the new version.
I believe most of the v2 was merged. Can you rebase on top of master?
Thanks,
Mathieu
--
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 5+ messages in thread