Skip to contentSkip to conversation

doc: bitbake-user-manual-metadata: misc improvements on sharing functionality

PATCH In review Quentin Schulz 2 participants 10 messages Jan 12 – Jan 13

lore
Share & tools
lore
#0 lore raw

cover doc: bitbake-user-manual-metadata: misc improvements on sharing functionality

This expands on the include_all directive by providing an example and highlighting the difference with the include directive.

It fixes some highlighting and cross-referencing inconsistencies as well as the wrong path in the examples.

---
Quentin Schulz (8):
doc: bitbake-user-manual-metadata: list (in order) all sharing directives
doc: bitbake-user-manual-metadata: highlight configuration fragment differently
doc: bitbake-user-manual-metadata: use a cross-reference for addfragments
doc: bitbake-user-manual-metadata: specify that current dir won't be searched for include_all
doc: bitbake-user-manual-metadata: add missing highlight for BBPATH and PATH
doc: bitbake-user-manual-metadata: fix incorrect path in example for locating files
doc: bitbake-user-manual-metadata: expand on search paths for include directive
doc: bitbake-user-manual-metadata: expand locating files example for include_all directive

 .../bitbake-user-manual-metadata.rst               | 65 ++++++++++++++++++----
 1 file changed, 54 insertions(+), 11 deletions(-)

---
base-commit: f23e186a75e71ba885b9b53a1dfda99af29c67b0
change-id: 20260112-doc-directives-6e42bc047525

Best regards,

Signature · 1 line
Quentin Schulz <[email protected]>
#1 lore raw

PATCH 1/8 doc: bitbake-user-manual-metadata: list (in order) all sharing directives

From: Quentin Schulz <[email protected]>

The Sharing Functionality section has multiple subsections each representing a way to share code.

Let's list all directives listed in the subsections (we were missing inherit_defer and include_all) and provide a link for each subsection.

This also fixes the link to INHERIT to point to the subsection where it is explained instead of to the variable glossary.

---
 doc/bitbake-user-manual/bitbake-user-manual-metadata.rst | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
doc/bitbake-user-manual/bitbake-user-manual-metadata.rst +6 -1
index ef401d4ab..0c5466943 100644
@@ -753,7 +753,12 @@ share the task.
 
 This section presents the mechanisms BitBake provides to allow you to
 share functionality between recipes. Specifically, the mechanisms
-include ``include``, ``inherit``, :term:`INHERIT`, and ``require``
+include :ref:`inherit<ref-bitbake-user-manual-metadata-inherit>`,
+:ref:`inherit_defer<ref-bitbake-user-manual-metadata-inherit-defer>`,
+:ref:`include<ref-include-directive>`,
+:ref:`include_all<ref-include-all-directive>`,
+:ref:`require<require-inclusion>` and
+:ref:`INHERIT<bitbake-user-manual/bitbake-user-manual-metadata:\`\`INHERIT\`\` configuration directive>`
 directives. There is also a higher-level abstraction called
 ``configuration fragments`` that is enabled with ``addfragments``
 directive.
Signature · 1 line
2.52.0
#2 lore raw

PATCH 2/8 doc: bitbake-user-manual-metadata: highlight configuration fragment differently

In reply to Quentin Schulz

From: Quentin Schulz <[email protected]>

We typically reserve the monospace font (used when highlighting with two tick quotes) for inline code examples or non-English words, but "configuration fragments" is neither. Instead, let's assume the intended style effect was to highlight the term as a two-word term and only use single tick quotes to make the text look italic.

---
 doc/bitbake-user-manual/bitbake-user-manual-metadata.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
doc/bitbake-user-manual/bitbake-user-manual-metadata.rst +1 -1
index 0c5466943..3ac2cb755 100644
@@ -760,7 +760,7 @@ include :ref:`inherit<ref-bitbake-user-manual-metadata-inherit>`,
 :ref:`require<require-inclusion>` and
 :ref:`INHERIT<bitbake-user-manual/bitbake-user-manual-metadata:\`\`INHERIT\`\` configuration directive>`
 directives. There is also a higher-level abstraction called
-``configuration fragments`` that is enabled with ``addfragments``
+`configuration fragments` that is enabled with ``addfragments``
 directive.
 
 .. _ref-bitbake-user-manual-metadata-inherit:
Signature · 1 line
2.52.0
#3 lore raw

PATCH 3/8 doc: bitbake-user-manual-metadata: use a cross-reference for addfragments

In reply to Quentin Schulz

From: Quentin Schulz <[email protected]>

We use cross-reference links for all but addfragments so let's fix that inconsistency.

---
 doc/bitbake-user-manual/bitbake-user-manual-metadata.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
doc/bitbake-user-manual/bitbake-user-manual-metadata.rst +2 -2
index 3ac2cb755..9233c4555 100644
@@ -760,8 +760,8 @@ include :ref:`inherit<ref-bitbake-user-manual-metadata-inherit>`,
 :ref:`require<require-inclusion>` and
 :ref:`INHERIT<bitbake-user-manual/bitbake-user-manual-metadata:\`\`INHERIT\`\` configuration directive>`
 directives. There is also a higher-level abstraction called
-`configuration fragments` that is enabled with ``addfragments``
-directive.
+`configuration fragments` that is enabled with the
+:ref:`bitbake-user-manual/bitbake-user-manual-metadata:\`\`addfragments\`\` directive`.
 
 .. _ref-bitbake-user-manual-metadata-inherit:
 
Signature · 1 line
2.52.0
#4 lore raw

PATCH 4/8 doc: bitbake-user-manual-metadata: specify that current dir won't be searched for include_all

In reply to Quentin Schulz

From: Quentin Schulz <[email protected]>

We've forgotten to make it explicit that include_all differs from the include directive also by the fact it doesn't look for the file relatively to the file with the include_all directive, so let's make that clear.

---
 doc/bitbake-user-manual/bitbake-user-manual-metadata.rst | 4 ++++
 1 file changed, 4 insertions(+)
doc/bitbake-user-manual/bitbake-user-manual-metadata.rst +4 -0
index 9233c4555..d7335f29e 100644
@@ -910,6 +910,10 @@ The ``include_all`` directive works like the :ref:`include
 directive but will include *all* of the files that match the specified path in
 the enabled layers (layers part of :term:`BBLAYERS`).
 
+Note that only :term:`BBPATH` will be searched, the parent directory of the file
+with the ``include_all`` directive will not be searched (unlike for the
+``include`` directive).
+
 .. note::
 
    This behaviour is rarely what you want in normal operation, and should
Signature · 1 line
2.52.0
#5 lore raw

PATCH 5/8 doc: bitbake-user-manual-metadata: add missing highlight for BBPATH and PATH

In reply to Quentin Schulz

From: Quentin Schulz <[email protected]>

We typically highlight (via a :term: directive or with double tick quotes if there's no entry in the glossary or it is inappropriate) variables, and here it was missed so let's fix that oversight.

---
 doc/bitbake-user-manual/bitbake-user-manual-metadata.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
doc/bitbake-user-manual/bitbake-user-manual-metadata.rst +1 -1
index d7335f29e..44a1e519b 100644
@@ -1070,7 +1070,7 @@ BitBake also uses the :term:`BBPATH` variable.
 
 .. note::
 
-   The BBPATH variable is analogous to the environment variable PATH.
+   The :term:`BBPATH` variable is analogous to the environment variable ``PATH``.
 
 For these two directives, BitBake includes the first file it finds.
 
Signature · 1 line
2.52.0
#6 lore raw

PATCH 6/8 doc: bitbake-user-manual-metadata: fix incorrect path in example for locating files

In reply to Quentin Schulz

From: Quentin Schulz <[email protected]>

The paths listed in the example are missing an "example" subdirectory to match the searched paths in the example, let's fix this oversight.

Fixes 7bd36f6c6d33 ("doc: extend classes and include/require documentation")
---
 doc/bitbake-user-manual/bitbake-user-manual-metadata.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
doc/bitbake-user-manual/bitbake-user-manual-metadata.rst +2 -2
index 44a1e519b..719689150 100644
@@ -1080,11 +1080,11 @@ For these two directives, BitBake includes the first file it finds.
    with the :ref:`include_all <ref-include-all-directive>` directive.
 
 Let's consider the following statement called from a recipe file located in
-``/layers/meta-custom2/recipes-example/example_0.1.bb``::
+``/layers/meta-custom2/recipes-example/example/example_0.1.bb``::
 
    require myfile.inc
 
-Where ``myfile.inc`` is located in ``/layers/meta-custom2/recipes-example/``.
+Where ``myfile.inc`` is located in ``/layers/meta-custom2/recipes-example/example``.
 
 And let's assume that the value of :term:`BBPATH` is
 ``/layers/meta-custom1:/layers/meta-custom2``. Then BitBake will try to find
Signature · 1 line
2.52.0
#7 lore raw

PATCH 7/8 doc: bitbake-user-manual-metadata: expand on search paths for include directive

In reply to Quentin Schulz

From: Quentin Schulz <[email protected]>

While it is made somewhat explicit in the require and include directive sections, I believe we should provide an example as to which relative directory the include/require directives apply to when in a bbappend.

Let's provide some example to make this even clearer as it wasn't what I thought would happen.

---
 doc/bitbake-user-manual/bitbake-user-manual-metadata.rst | 12 ++++++++++++
 1 file changed, 12 insertions(+)
doc/bitbake-user-manual/bitbake-user-manual-metadata.rst +12 -0
index 719689150..cbad4df99 100644
@@ -1112,6 +1112,18 @@ In this case, the following paths would be searched::
 
 This time, the second item of this list would be matched.
 
+Note that the first path is based on the location of the file with the
+``require`` (or ``include``) directive. Imagine there's a
+``/layers/meta-custom2/recipes-bbappend/example/example_0.1.bbappend`` with::
+
+   require myappend.inc
+
+In this case, the following paths would be searched::
+
+   /layers/meta-custom2/recipes-bbappend/example/myappend.inc
+   /layers/meta-custom1/myappend.inc
+   /layers/meta-custom2/myappend.inc
+
 .. note::
 
    In the above examples, the exact same search order applies for the
Signature · 1 line
2.52.0
#8 lore raw

PATCH 8/8 doc: bitbake-user-manual-metadata: expand locating files example for include_all directive

In reply to Quentin Schulz

From: Quentin Schulz <[email protected]>

This adds a separate example for the include_all directive which also highlights that the current directory isn't searched (unlike when using the include or require directive).

---
 .../bitbake-user-manual-metadata.rst               | 32 ++++++++++++++++++----
 1 file changed, 27 insertions(+), 5 deletions(-)
doc/bitbake-user-manual/bitbake-user-manual-metadata.rst +27 -5
index cbad4df99..18f293f4b 100644
@@ -1074,11 +1074,6 @@ BitBake also uses the :term:`BBPATH` variable.
 
 For these two directives, BitBake includes the first file it finds.
 
-.. note::
-
-   It is also possible to include *all* occurences of a file with the same name
-   with the :ref:`include_all <ref-include-all-directive>` directive.
-
 Let's consider the following statement called from a recipe file located in
 ``/layers/meta-custom2/recipes-example/example/example_0.1.bb``::
 
@@ -1129,6 +1124,33 @@ In this case, the following paths would be searched::
    In the above examples, the exact same search order applies for the
    :ref:`include <ref-include-directive>` directive.
 
+It is also possible to include *all* occurences of a file with the same name
+with the :ref:`include_all <ref-include-all-directive>` directive.
+
+Let's consider the following statement called from a recipe file located in
+``/layers/meta-custom2/recipes-example/example/exampleall_0.1.bb``::
+
+   include_all all.inc
+
+Where multiple ``all.inc`` are in located in ``/layers/meta-custom2`` and
+``/layers/meta-custom1``.
+
+And let's assume that the value of :term:`BBPATH` is
+``/layers/meta-custom1:/layers/meta-custom2``. Then BitBake will try to include
+all ``all.inc`` in this order::
+
+   /layers/meta-custom1/all.inc
+   /layers/meta-custom2/all.inc
+
+In this case the first ``/layers/meta-custom1/all.inc`` would be included, and
+then ``/layers/meta-custom2/all.inc`` if both are found.
+
+.. note::
+
+   The same logic as for the :ref:`ref-include-directive` applies, except that
+   the path relative to the file where the directive is specified is not
+   searched when using the ``include_all`` directive.
+
 Locating Class Files
 --------------------
 
Signature · 1 line
2.52.0
Reviewed-by on the v1 series
#9 lore raw
In reply to Quentin Schulz
Quoted 18 lines · Quentin Schulz

This expands on the include_all directive by providing an example and highlighting the difference with the include directive.

It fixes some highlighting and cross-referencing inconsistencies as well as the wrong path in the examples.

---
Quentin Schulz (8):
doc: bitbake-user-manual-metadata: list (in order) all sharing directives
doc: bitbake-user-manual-metadata: highlight configuration fragment differently
doc: bitbake-user-manual-metadata: use a cross-reference for addfragments
doc: bitbake-user-manual-metadata: specify that current dir won't be searched for include_all
doc: bitbake-user-manual-metadata: add missing highlight for BBPATH and PATH
doc: bitbake-user-manual-metadata: fix incorrect path in example for locating files
doc: bitbake-user-manual-metadata: expand on search paths for include directive
doc: bitbake-user-manual-metadata: expand locating files example for include_all directive

Quoted 7 lines
 .../bitbake-user-manual-metadata.rst               | 65 ++++++++++++++++++----
 1 file changed, 54 insertions(+), 11 deletions(-)

---
base-commit: f23e186a75e71ba885b9b53a1dfda99af29c67b0
change-id: 20260112-doc-directives-6e42bc047525

Best regards,

Great improvements over what I wrote a while back! I'm glad we have a detailed explanation on all of these directives now.

Thanks!
Antonin

Signature · 3 lines
Antonin Godard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com