archive mirror
 help / color / mirror / Atom feed
From: <>
To: <>
Subject: [PATCH v2] bitbake: ConfHandler: Allow variable flag name with a single character
Date: Tue, 11 Apr 2023 17:09:04 +0800	[thread overview]
Message-ID: <> (raw)

From: Kai Kang <>

Update regex pattern to allow variable flag name with a single character.

Regression tests have also been updated in `bb.parse` and
`bin/bitbake-selftest -k ParseTest` has been successfully executed.

Eliminate a trailing space as well.

Signed-off-by: Kai Kang <>
 bitbake/lib/bb/parse/parse_py/ | 4 ++--
 bitbake/lib/bb/tests/                | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/bitbake/lib/bb/parse/parse_py/ b/bitbake/lib/bb/parse/parse_py/
index 05c627ec8b..7826dee7d3 100644
--- a/bitbake/lib/bb/parse/parse_py/
+++ b/bitbake/lib/bb/parse/parse_py/
@@ -21,7 +21,7 @@ __config_regexp__  = re.compile( r"""
-    (\[(?P<flag>[a-zA-Z0-9\-_+.][a-zA-Z0-9\-_+.@]+)\])?
+    (\[(?P<flag>[a-zA-Z0-9\-_+.][a-zA-Z0-9\-_+.@]*)\])?
     \s* (
         (?P<colon>:=) |
@@ -103,7 +103,7 @@ def include_single_file(parentfn, fn, lineno, data, error_out):
 # We have an issue where a UI might want to enforce particular settings such as
 # an empty DISTRO variable. If configuration files do something like assigning
 # a weak default, it turns out to be very difficult to filter out these changes,
-# particularly when the weak default might appear half way though parsing a chain 
+# particularly when the weak default might appear half way though parsing a chain
 # of configuration files. We therefore let the UIs hook into configuration file
 # parsing. This turns out to be a hard problem to solve any other way.
 confFilters = []
diff --git a/bitbake/lib/bb/tests/ b/bitbake/lib/bb/tests/
index d27c7c6f15..a3165d95bd 100644
--- a/bitbake/lib/bb/tests/
+++ b/bitbake/lib/bb/tests/
@@ -222,6 +222,7 @@ VAR = " \\
     at_sign_in_var_flag = """
 A[flag@.service] = "nonet"
 B[] = "ntb"
+C[f] = "flag"
 unset A[flag@.service]
@@ -232,6 +233,7 @@ unset A[flag@.service]
         self.assertEqual(d.getVar("B"), None)
         self.assertEqual(d.getVarFlag("A","flag@.service"), None)
         self.assertEqual(d.getVarFlag("B",""), "ntb")
+        self.assertEqual(d.getVarFlag("C","f"), "flag")
     def test_parse_invalid_at_sign_in_var_flag(self):
         invalid_at_sign = self.at_sign_in_var_flag.replace("B[f", "B[@f")

                 reply	other threads:[~2023-04-11  9:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \

* 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;
as well as URLs for NNTP newsgroup(s).