doc: bitbake-user-manual-ref-variables: clarify BBMASK examples
cover doc: bitbake-user-manual-ref-variables: clarify BBMASK examples
Robert reported being confused by the leading slash inconsistencies in our BBMASK examples and wondered if it had any significance. After reading the code and testing, it does, so this tries to explain the difference and why you would want a leading slash in most cases.
It also explains that still with only a leading slash there could be involuntary matches, which one should be able to get rid of by using BBFILE_PATTERN from the layer they want to mask recipe or append files from.
While at it, update the meta-ti example such that it matches what's currently in the repo (migrated in kirkstone from a single meta-ti git repo layer to a meta-ti git repo with multiple layers, such as meta-ti-bsp).
---
Quentin Schulz (4):
doc: bitbake-user-manual-ref-variables: clarify BBMASK directory matching
doc: bitbake-user-manual-ref-variables: have directory examples be consistent
doc: bitbake-user-manual-ref-variables: clarify BBMASK matching patterns
doc: bitbake-user-manual-ref-variables: update BBMASK example with current meta-ti
.../bitbake-user-manual-ref-variables.rst | 30 +++++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-)
---
base-commit: af9dd012e7f4d16dccd1d6118be5da94ede68f85
change-id: 20260211-bbmask-slashes-7ea904bf6347
Best regards,
Signature · 1 line
Quentin Schulz <[email protected]>
PATCH 1/4 doc: bitbake-user-manual-ref-variables: clarify BBMASK directory matching
From: Quentin Schulz <[email protected]>
BBMASK matches files in the directories matching the regex, and also in their respective subdirectories, so make that clear in the wording leading to the example.
--- doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst +2 -2
@@ -1051,8 +1051,8 @@ overview of their function and contents. documentation at http://docs.python.org/3/library/re.html. The following example uses a complete regular expression to tell - BitBake to ignore all recipe and recipe append files in the - ``meta-ti/recipes-misc/`` directory:: + BitBake to ignore all recipe and recipe append files in + ``meta-ti/recipes-misc/`` directories (and their subdirectories):: BBMASK = "meta-ti/recipes-misc/"
Signature · 1 line
2.53.0
Re: [docs] [PATCH 1/4] doc: bitbake-user-manual-ref-variables: clarify BBMASK directory matching
Hi,
Quoted 16 lines · Quentin Schulz via lists.yoctoproject.org
From: Quentin Schulz <[email protected]>
BBMASK matches files in the directories matching the regex, and also in their respective subdirectories, so make that clear in the wording leading to the example.
Signed-off-by Quentin Schulz <[email protected]>--- doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst +0
-0
doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst overview of their function and contents. · line 1055
Quoted 7 lines
doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst +2
-2@@ -1051,8 +1051,8 @@ overview of their function and contents. documentation at http://docs.python.org/3/library/re.html. The following example uses a complete regular expression to tell - BitBake to ignore all recipe and recipe append files in the - ``meta-ti/recipes-misc/`` directory:: + BitBake to ignore all recipe and recipe append files in + ``meta-ti/recipes-misc/`` directories (and their subdirectories)::
If I follow: this will mask multiple occurrences "meta-ti/recipes-misc/". How could there be more than one in practice? How could this ever happen?
Wouldn't:
"""
The following example uses a complete regular expression to tell BitBake to ignore all recipe and recipe append files in the ``meta-ti/recipes-misc/`` directory and its subdirectories::
"""
be less confusing?
Antonin
Re: [docs] [PATCH 1/4] doc: bitbake-user-manual-ref-variables: clarify BBMASK directory matching
Hi Antonin,
Quoted 21 lines · Antonin Godard
Hi,
Quoted 18 lines · Quentin Schulz via lists.yoctoproject.org
From: Quentin Schulz <[email protected]>
BBMASK matches files in the directories matching the regex, and also in their respective subdirectories, so make that clear in the wording leading to the example.
Signed-off-by Quentin Schulz <[email protected]>--- doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst +0
-0@@ -1051,8 +1051,8 @@ overview of their function and contents. documentation at http://docs.python.org/3/library/re.html.
Quoted 9 lines
doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst overview of their function and contents. · line 1055
Quoted 5 lines
doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst +2
-2The following example uses a complete regular expression to tell - BitBake to ignore all recipe and recipe append files in the - ``meta-ti/recipes-misc/`` directory:: + BitBake to ignore all recipe and recipe append files in + ``meta-ti/recipes-misc/`` directories (and their subdirectories)::If I follow: this will mask multiple occurrences "meta-ti/recipes-misc/". How could there be more than one in practice? How could this ever happen?
It's simply a path. There are no rules as to which layer can be named something. It also doesn't have to match a layer if the directory has meta in the name (meta-ti isn't a layer for example). There are no naming rules for where to put your recipes. You could very much have BBFILES with ${LAYERDIR}/appends-for-meta-ti/recipes-misc/*.bbappend for example.
FYI, there are two meta-rockchip layers in the wild. One maintained by Rockchip themselves, one maintained by Trevor. So it's not **impossible** (both share the same BBFILE_COLLECTIONS so you won't be able to have both included if I'm not mistaken, so that doesn't really apply here).
Also, I have written a meta-bsp layer in my vendor meta-cherry-es git repo, I'm probably not the only one having done that. What matters is that there's no BBFILE_COLLECTIONS name clash I think?
I hope this is better explained starting patch 3?
Quoted 10 lines
Wouldn't:
"""
The following example uses a complete regular expression to tell BitBake to ignore all recipe and recipe append files in the ``meta-ti/recipes-misc/`` directory and its subdirectories::
"""be less confusing?
It's factually incorrect.
Cheers,
Quentin
PATCH 2/4 doc: bitbake-user-manual-ref-variables: have directory examples be consistent
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
It's a bit confusing to have a mix of paths with and without a leading slash. The behavior is actually different. The next commit will explain when/why to add a leading slash.
--- doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst +2 -2
@@ -1054,13 +1054,13 @@ overview of their function and contents. BitBake to ignore all recipe and recipe append files in ``meta-ti/recipes-misc/`` directories (and their subdirectories):: - BBMASK = "meta-ti/recipes-misc/" + BBMASK = "/meta-ti/recipes-misc/" If you want to mask out multiple directories or recipes, you can specify multiple regular expression fragments. This next example masks out multiple directories and individual recipes:: - BBMASK += "/meta-ti/recipes-misc/ meta-ti/recipes-ti/packagegroup/" + BBMASK += "/meta-ti/recipes-ti/packagegroup/" BBMASK += "/meta-oe/recipes-support/" BBMASK += "/meta-foo/.*/openldap" BBMASK += "opencv.*\.bbappend"
Signature · 1 line
2.53.0
PATCH 3/4 doc: bitbake-user-manual-ref-variables: clarify BBMASK matching patterns
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
The documentation doesn't explain the side-effect of putting a leading slash, only the trailing slash.
The leading slash is not for making the regular expression match an absolute path, but to force the match on the directory or file that exactly starts (and ends if there is a trailing slash) with the specified string.
Finally, this also explains that this still doesn't prevent more than the intended path to be caught up, specifically because it is NOT a regular expression matching an absolute path. For that though, the user can use BBFILE_PATTERN set for the layer they want to mask the recipe or append files to BitBake. This is typically a regex starting with ^${LAYERDIR}, making it an absolute path matching.
Let's document those limitations.
--- .../bitbake-user-manual-ref-variables.rst | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst +22 -0
@@ -1071,6 +1071,28 @@ overview of their function and contents. When specifying a directory name, use the trailing slash character to ensure you match just that directory name. + .. note:: + + The leading slash in a regular expression in :term:`BBMASK` does not + mean the path is absolute. It simply forces the directory to be named + exactly that. Take:: + + BBMASK = "meta-ti/recipes-bsp/" + + If you happen to have a directory ``my-meta-ti/recipes-bsp``, it will + be matched. + + Leading with a slash:: + + BBMASK = "/meta-ti/recipes-bsp/" + + makes sure that doesn't happen. However, this doesn't prevent matching a + directory ``meta-foo/meta-ti/recipes-bsp``. For that, use the + appropriate :term:`BBFILE_PATTERN` to only match a directory from one + specific layer:: + + BBMASK = "${BBFILE_PATTERN_meta-ti}/recipes-bsp/" + :term:`BBMULTICONFIG` Enables BitBake to perform multiple configuration builds and lists each separate configuration (multiconfig). You can use this variable
Signature · 1 line
2.53.0
Re: [docs] [PATCH 3/4] doc: bitbake-user-manual-ref-variables: clarify BBMASK matching patterns
Hi,
Quoted 44 lines · Quentin Schulz via lists.yoctoproject.org
From: Quentin Schulz <[email protected]>
The documentation doesn't explain the side-effect of putting a leading slash, only the trailing slash.
The leading slash is not for making the regular expression match an absolute path, but to force the match on the directory or file that exactly starts (and ends if there is a trailing slash) with the specified string.
Finally, this also explains that this still doesn't prevent more than the intended path to be caught up, specifically because it is NOT a regular expression matching an absolute path. For that though, the user can use
BBFILE_PATTERNset for the layer they want to mask the recipe or append files to BitBake. This is typically a regex starting with ^${LAYERDIR}, making it an absolute path matching.Let's document those limitations.
Reported-by Robert P. J. Day <[email protected]>Signed-off-by Quentin Schulz <[email protected]>--- .../bitbake-user-manual-ref-variables.rst | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst +11
-0@@ -1071,6 +1071,28 @@ overview of their function and contents. When specifying a directory name, use the trailing slash character to ensure you match just that directory name. + .. note:: + + The leading slash in a regular expression in :term:`BBMASK` does not + mean the path is absolute. It simply forces the directory to be named + exactly that. Take:: + + BBMASK = "meta-ti/recipes-bsp/" + + If you happen to have a directory ``my-meta-ti/recipes-bsp``, it will + be matched. +
doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst overview of their function and contents. · line 1094
Quoted 10 lines
doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst +10
-0+ Leading with a slash:: + + BBMASK = "/meta-ti/recipes-bsp/" + + makes sure that doesn't happen. However, this doesn't prevent matching a + directory ``meta-foo/meta-ti/recipes-bsp``. For that, use the + appropriate :term:`BBFILE_PATTERN` to only match a directory from one + specific layer:: + + BBMASK = "${BBFILE_PATTERN_meta-ti}/recipes-bsp/"
So this looks this is actually what most users want to do, right? Wouldn't it be better to put this forward instead of in a note, say, at the beginning of the definition?
For example, replacing the first example in the variable's definition by:
-The following example uses a complete regular expression to tell -BitBake to ignore all recipe and recipe append files in the -``meta-ti/recipes-misc/`` directory::
-
- BBMASK = "meta-ti/recipes-misc/"
+The following example uses a complete regular expression to tell BitBake to +ignore all recipe and recipe append files in the ``recipes-misc/`` directory +and subdirectories of the ``meta-ti`` layer::
+
+ BBMASK = "${BBFILE_PATTERN_meta-ti}/recipes-bsp/"
What do you think?
Antonin
Re: [docs] [PATCH 3/4] doc: bitbake-user-manual-ref-variables: clarify BBMASK matching patterns
Hi Antonin,
Quoted 65 lines · Antonin Godard
Hi,
Quoted 44 lines · Quentin Schulz via lists.yoctoproject.org
From: Quentin Schulz <[email protected]>
The documentation doesn't explain the side-effect of putting a leading slash, only the trailing slash.
The leading slash is not for making the regular expression match an absolute path, but to force the match on the directory or file that exactly starts (and ends if there is a trailing slash) with the specified string.
Finally, this also explains that this still doesn't prevent more than the intended path to be caught up, specifically because it is NOT a regular expression matching an absolute path. For that though, the user can use
BBFILE_PATTERNset for the layer they want to mask the recipe or append files to BitBake. This is typically a regex starting with ^${LAYERDIR}, making it an absolute path matching.Let's document those limitations.
Reported-by Robert P. J. Day <[email protected]>Signed-off-by Quentin Schulz <[email protected]>--- .../bitbake-user-manual-ref-variables.rst | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst +11
-0@@ -1071,6 +1071,28 @@ overview of their function and contents. When specifying a directory name, use the trailing slash character to ensure you match just that directory name. + .. note:: + + The leading slash in a regular expression in :term:`BBMASK` does not + mean the path is absolute. It simply forces the directory to be named + exactly that. Take:: + + BBMASK = "meta-ti/recipes-bsp/" + + If you happen to have a directory ``my-meta-ti/recipes-bsp``, it will + be matched. +doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst overview of their function and contents. · line 1094
Quoted 10 lines
doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst +10
-0+ Leading with a slash:: + + BBMASK = "/meta-ti/recipes-bsp/" + + makes sure that doesn't happen. However, this doesn't prevent matching a + directory ``meta-foo/meta-ti/recipes-bsp``. For that, use the + appropriate :term:`BBFILE_PATTERN` to only match a directory from one + specific layer:: + + BBMASK = "${BBFILE_PATTERN_meta-ti}/recipes-bsp/"So this looks this is actually what most users want to do, right? Wouldn't it be better to put this forward instead of in a note, say, at the beginning of the definition?
For example, replacing the first example in the variable's definition by:
Review
Quoted 10 lines
(quoted diff) +5
-5-The following example uses a complete regular expression to tell -BitBake to ignore all recipe and recipe append files in the -``meta-ti/recipes-misc/`` directory:: - - BBMASK = "meta-ti/recipes-misc/" +The following example uses a complete regular expression to tell BitBake to +ignore all recipe and recipe append files in the ``recipes-misc/`` directory +and subdirectories of the ``meta-ti`` layer:: + + BBMASK = "${BBFILE_PATTERN_meta-ti}/recipes-bsp/"
Yeah I was conflicted... not sure what's best. This does also rely on BBFILE_PATTERN_meta-ti starting with ^ otherwise we have another potential name clash and we don't actually mention that in the documentation of BBFILE_PATTERN (though it is set like that when creating a layer with bitbake-layers create-layer).
If for some reason you have:
/layers/meta-ti/recipes-bsp /downstream/my-layer/appends/layers/meta-ti/recipes-bsp
then both would be matched (I assume, I haven't checked). That is very much a corner case.
I'm also pretty sure nobody actually does that. The only layer I have in my pool of cloned layers which uses BBMASK is meta-lts-mixins and then doesn't even have the layer name in the paths so /me shrugs.
Quoted 2 lines
What do you think?
We could start with the BBFILE_PATTERN thingy, then explain there are other less restrictive ways to match multiple recipes or directories from different locations later on. Not sure what's best.
Cheers,
Quentin
Re: [docs] [PATCH 3/4] doc: bitbake-user-manual-ref-variables: clarify BBMASK matching patterns
Hi,
On Thu Feb 12, 2026 at 12:38 PM CET, Quentin Schulz via lists.yoctoproject.org wrote:
[...]
Quoted 36 lines
Quoted 7 lines
So this looks this is actually what most users want to do, right? Wouldn't it be better to put this forward instead of in a note, say, at the beginning of the definition?
For example, replacing the first example in the variable's definition by:
Review
Quoted 10 lines
(quoted diff) +5
-5-The following example uses a complete regular expression to tell -BitBake to ignore all recipe and recipe append files in the -``meta-ti/recipes-misc/`` directory:: - - BBMASK = "meta-ti/recipes-misc/" +The following example uses a complete regular expression to tell BitBake to +ignore all recipe and recipe append files in the ``recipes-misc/`` directory +and subdirectories of the ``meta-ti`` layer:: + + BBMASK = "${BBFILE_PATTERN_meta-ti}/recipes-bsp/"Yeah I was conflicted... not sure what's best. This does also rely on BBFILE_PATTERN_meta-ti starting with ^ otherwise we have another potential name clash and we don't actually mention that in the documentation of
BBFILE_PATTERN(though it is set like that when creating a layer with bitbake-layers create-layer).If for some reason you have:
/layers/meta-ti/recipes-bsp /downstream/my-layer/appends/layers/meta-ti/recipes-bsp
then both would be matched (I assume, I haven't checked). That is very much a corner case.
I'm also pretty sure nobody actually does that. The only layer I have in my pool of cloned layers which uses BBMASK is meta-lts-mixins and then doesn't even have the layer name in the paths so /me shrugs.
Quoted 6 lines
Quoted 2 lines
What do you think?
We could start with the
BBFILE_PATTERNthingy, then explain there are other less restrictive ways to match multiple recipes or directories from different locations later on.
Yes, I think we should do that
Antonin
PATCH 4/4 doc: bitbake-user-manual-ref-variables: update BBMASK example with current meta-ti
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
meta-ti git repo now has multiple layers in it since kirkstone, so let's update the examples to match the current state of meta-ti by using meta-ti-bsp.
--- .../bitbake-user-manual-ref-variables.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst +8 -8
@@ -1052,15 +1052,15 @@ overview of their function and contents. The following example uses a complete regular expression to tell BitBake to ignore all recipe and recipe append files in - ``meta-ti/recipes-misc/`` directories (and their subdirectories):: + ``meta-ti-bsp/recipes-ti/`` directories (and their subdirectories):: - BBMASK = "/meta-ti/recipes-misc/" + BBMASK = "/meta-ti-bsp/recipes-ti/" If you want to mask out multiple directories or recipes, you can specify multiple regular expression fragments. This next example masks out multiple directories and individual recipes:: - BBMASK += "/meta-ti/recipes-ti/packagegroup/" + BBMASK += "/meta-ti-bsp/recipes-graphics/powervr-umlibs/" BBMASK += "/meta-oe/recipes-support/" BBMASK += "/meta-foo/.*/openldap" BBMASK += "opencv.*\.bbappend"
@@ -1077,21 +1077,21 @@ overview of their function and contents. mean the path is absolute. It simply forces the directory to be named exactly that. Take:: - BBMASK = "meta-ti/recipes-bsp/" + BBMASK = "meta-ti-bsp/recipes-ti/" - If you happen to have a directory ``my-meta-ti/recipes-bsp``, it will + If you happen to have a directory ``my-meta-ti-bsp/recipes-ti``, it will be matched. Leading with a slash:: - BBMASK = "/meta-ti/recipes-bsp/" + BBMASK = "/meta-ti-bsp/recipes-ti/" makes sure that doesn't happen. However, this doesn't prevent matching a - directory ``meta-foo/meta-ti/recipes-bsp``. For that, use the + directory ``meta-foo/meta-ti-bsp/recipes-ti``. For that, use the appropriate :term:`BBFILE_PATTERN` to only match a directory from one specific layer:: - BBMASK = "${BBFILE_PATTERN_meta-ti}/recipes-bsp/" + BBMASK = "${BBFILE_PATTERN_meta-ti-bsp}/recipes-bsp/" :term:`BBMULTICONFIG` Enables BitBake to perform multiple configuration builds and lists
Signature · 1 line
2.53.0
Quoted 5 lines · Quentin Schulz via lists.yoctoproject.org
Robert reported being confused by the leading slash inconsistencies in our BBMASK examples and wondered if it had any significance. After reading the code and testing, it does, so this tries to explain the difference and why you would want a leading slash in most cases.
thanks, quentin, for tolerating my relentless whining about stuff
and proceeding to resolve it. i will try to get back to contributing some of my own stuff in the near future. i already have plenty of ideas for docs improvement.
rday