public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "'Schwarz, Konrad' via isar-users" <isar-users@googlegroups.com>
To: "isar-users@googlegroups.com" <isar-users@googlegroups.com>
Cc: "Schwarz, Konrad" <konrad.schwarz@siemens.com>
Subject: [PATCH] Bitbake: use LAYERDIR_RE when setting BBFILE_PATTERN_x
Date: Mon, 12 Jan 2026 16:06:19 +0000	[thread overview]
Message-ID: <20260112160613.40413-1-konrad.schwarz@siemens.com> (raw)

From: Konrad Schwarz <konrad.schwarz@siemens.com>

The `BBFILE_PATTERN_x` variables are regular expressions.
Hence, regular expression special characters such as `.`
need to be protected if intended to be used literally.

Bitbake facilitates this by automatically poviding a variant of the
`LAYERDIR` variable, `LAYERDIR_RE`, in which all regex special characters
are escaped (and are thus interpreted as ordinary characters).
`LAYERDIR_RE` should be used instead of `LAYERDIR` in the value
of `BBFILE_PATTERN_x`.

The Bitbake User Manual consistenly uses `LAYERDIR_RE` when assigning
to `BBFILE_PATTERN_x`.  see Chapters 7 [1], "Variables Glossary",
and 9.4 [2], "The Hello World Example".

[1]: https://docs.yoctoproject.org/bitbake/bitbake-user-manual/bitbake-user-manual-ref-variables.html#
[2]: https://docs.yoctoproject.org/bitbake/bitbake-user-manual/bitbake-user-manual-hello.html#the-hello-world-example

Note that this is a systematic mistake.  Although
this patch addressse Isar, projects based on Isar
are likely to contain this mistake in their own layer configurations.

`BBFILE_PATTERN_x`/`LAYERDIR_RE` are the only
such pair in Bitbake documented in the user's manual;
the problem should not extend to other variable uses.

Signed-off-by: Konrad Schwarz <konrad.schwarz@siemens.com>
---
 bitbake/lib/layerindexlib/tests/testdata/layer1/conf/layer.conf | 2 +-
 bitbake/lib/layerindexlib/tests/testdata/layer2/conf/layer.conf | 2 +-
 bitbake/lib/layerindexlib/tests/testdata/layer3/conf/layer.conf | 2 +-
 bitbake/lib/layerindexlib/tests/testdata/layer4/conf/layer.conf | 2 +-
 meta-isar/conf/layer.conf                                       | 2 +-
 meta-test/conf/layer.conf                                       | 2 +-
 meta/conf/layer.conf                                            | 2 +-
 testsuite/cibuilder.py                                          | 2 +-
 8 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/bitbake/lib/layerindexlib/tests/testdata/layer1/conf/layer.conf b/bitbake/lib/layerindexlib/tests/testdata/layer1/conf/layer.conf
index 966d5319..c7a372d7 100644
--- a/bitbake/lib/layerindexlib/tests/testdata/layer1/conf/layer.conf
+++ b/bitbake/lib/layerindexlib/tests/testdata/layer1/conf/layer.conf
@@ -4,7 +4,7 @@ BBPATH .= ":${LAYERDIR}"
 BBFILES += "${LAYERDIR}/recipes-*/*/*.bb"
 
 BBFILE_COLLECTIONS += "core"
-BBFILE_PATTERN_core = "^${LAYERDIR}/"
+BBFILE_PATTERN_core = "^${LAYERDIR_RE}/"
 BBFILE_PRIORITY_core = "5"
 
 LAYERSERIES_CORENAMES = "sumo"
diff --git a/bitbake/lib/layerindexlib/tests/testdata/layer2/conf/layer.conf b/bitbake/lib/layerindexlib/tests/testdata/layer2/conf/layer.conf
index 7569d1c2..dc9d36a6 100644
--- a/bitbake/lib/layerindexlib/tests/testdata/layer2/conf/layer.conf
+++ b/bitbake/lib/layerindexlib/tests/testdata/layer2/conf/layer.conf
@@ -6,7 +6,7 @@ BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
             ${LAYERDIR}/recipes-*/*/*.bbappend"
 
 BBFILE_COLLECTIONS += "networking-layer"
-BBFILE_PATTERN_networking-layer := "^${LAYERDIR}/"
+BBFILE_PATTERN_networking-layer := "^${LAYERDIR_RE}/"
 BBFILE_PRIORITY_networking-layer = "5"
 
 # This should only be incremented on significant changes that will
diff --git a/bitbake/lib/layerindexlib/tests/testdata/layer3/conf/layer.conf b/bitbake/lib/layerindexlib/tests/testdata/layer3/conf/layer.conf
index 7089071f..54ddee90 100644
--- a/bitbake/lib/layerindexlib/tests/testdata/layer3/conf/layer.conf
+++ b/bitbake/lib/layerindexlib/tests/testdata/layer3/conf/layer.conf
@@ -5,7 +5,7 @@ BBPATH .= ":${LAYERDIR}"
 BBFILES += "${LAYERDIR}/recipes*/*/*.bb ${LAYERDIR}/recipes*/*/*.bbappend"
 
 BBFILE_COLLECTIONS += "meta-python"
-BBFILE_PATTERN_meta-python := "^${LAYERDIR}/"
+BBFILE_PATTERN_meta-python := "^${LAYERDIR_RE}/"
 BBFILE_PRIORITY_meta-python = "7"
 
 # This should only be incremented on significant changes that will
diff --git a/bitbake/lib/layerindexlib/tests/testdata/layer4/conf/layer.conf b/bitbake/lib/layerindexlib/tests/testdata/layer4/conf/layer.conf
index 6649ee02..4646c234 100644
--- a/bitbake/lib/layerindexlib/tests/testdata/layer4/conf/layer.conf
+++ b/bitbake/lib/layerindexlib/tests/testdata/layer4/conf/layer.conf
@@ -5,7 +5,7 @@ BBPATH .= ":${LAYERDIR}"
 BBFILES += "${LAYERDIR}/recipes-*/*/*.bb ${LAYERDIR}/recipes-*/*/*.bbappend"
 
 BBFILE_COLLECTIONS += "openembedded-layer"
-BBFILE_PATTERN_openembedded-layer := "^${LAYERDIR}/"
+BBFILE_PATTERN_openembedded-layer := "^${LAYERDIR_RE}/"
 
 # Define the priority for recipes (.bb files) from this layer,
 # choosing carefully how this layer interacts with all of the
diff --git a/meta-isar/conf/layer.conf b/meta-isar/conf/layer.conf
index 2209b18b..577f47b5 100644
--- a/meta-isar/conf/layer.conf
+++ b/meta-isar/conf/layer.conf
@@ -8,7 +8,7 @@ BBPATH .= ":${LAYERDIR}"
 BBFILES += "${LAYERDIR}/recipes-*/*/*.bb ${LAYERDIR}/recipes-*/*/*.bbappend"
 
 BBFILE_COLLECTIONS += "isar"
-BBFILE_PATTERN_isar = "^${LAYERDIR}/"
+BBFILE_PATTERN_isar = "^${LAYERDIR_RE}/"
 BBFILE_PRIORITY_isar = "5"
 
 # This should only be incremented on significant changes that will
diff --git a/meta-test/conf/layer.conf b/meta-test/conf/layer.conf
index 0f15119d..425e9251 100644
--- a/meta-test/conf/layer.conf
+++ b/meta-test/conf/layer.conf
@@ -8,7 +8,7 @@ BBPATH .= ":${LAYERDIR}"
 BBFILES += "${LAYERDIR}/recipes-*/*/*.bb ${LAYERDIR}/recipes-*/*/*.bbappend"
 
 BBFILE_COLLECTIONS += "test"
-BBFILE_PATTERN_test = "^${LAYERDIR}/"
+BBFILE_PATTERN_test = "^${LAYERDIR_RE}/"
 BBFILE_PRIORITY_test = "10"
 
 # This should only be incremented on significant changes that will
diff --git a/meta/conf/layer.conf b/meta/conf/layer.conf
index 15f01233..69225172 100644
--- a/meta/conf/layer.conf
+++ b/meta/conf/layer.conf
@@ -8,7 +8,7 @@ BBPATH .= ":${LAYERDIR}"
 BBFILES += "${LAYERDIR}/recipes-*/*/*.bb ${LAYERDIR}/recipes-*/*/*.bbappend"
 
 BBFILE_COLLECTIONS += "core"
-BBFILE_PATTERN_core = "^${LAYERDIR}/"
+BBFILE_PATTERN_core = "^${LAYERDIR_RE}/"
 BBFILE_PRIORITY_core = "5"
 
 LAYERSERIES_CORENAMES = "v0.6 next"
diff --git a/testsuite/cibuilder.py b/testsuite/cibuilder.py
index 366f6a1f..80f9362e 100755
--- a/testsuite/cibuilder.py
+++ b/testsuite/cibuilder.py
@@ -362,7 +362,7 @@ class CIBuilder(Test):
                 'BBPATH .= ":${LAYERDIR}"\n'
                 'BBFILES += "${LAYERDIR}/recipes-*/*/*.bbappend"\n'
                 'BBFILE_COLLECTIONS += "tmp"\n'
-                'BBFILE_PATTERN_tmp = "^${LAYERDIR}/"\n'
+                'BBFILE_PATTERN_tmp = "^${LAYERDIR_RE}/"\n'
                 'BBFILE_PRIORITY_tmp = "5"\n'
                 'LAYERVERSION_tmp = "1"\n'
                 'LAYERSERIES_COMPAT_tmp = "v0.6"\n'
-- 
2.39.5

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20260112160613.40413-1-konrad.schwarz%40siemens.com.

             reply	other threads:[~2026-01-13  9:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-12 16:06 'Schwarz, Konrad' via isar-users [this message]
2026-01-13 12:05 ` 'MOESSBAUER, Felix' via isar-users
2026-01-16 16:14 ` Zhihang Wei

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=20260112160613.40413-1-konrad.schwarz@siemens.com \
    --to=isar-users@googlegroups.com \
    --cc=konrad.schwarz@siemens.com \
    /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