diff options
author | Kai Kang <kai.kang@windriver.com> | 2023-04-11 17:09:04 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-04-13 12:01:45 +0100 |
commit | a99566dac13f0ec1e91fd79c5b78395f3ee0ef56 (patch) | |
tree | 909032076e227a7e7420308fb4805beb10ccdbe8 /bitbake/lib/bb | |
parent | 066f44b1617f3d25d66d41340205b3b585086eaa (diff) | |
download | poky-a99566dac13f0ec1e91fd79c5b78395f3ee0ef56.tar.gz |
bitbake: bitbake: ConfHandler: Allow variable flag name with a single character
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.
(Bitbake rev: bb9e523291a3cad6e1596ee6a1e715b5e5feba8f)
Signed-off-by: Kai Kang <kai.kang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r-- | bitbake/lib/bb/parse/parse_py/ConfHandler.py | 4 | ||||
-rw-r--r-- | bitbake/lib/bb/tests/parse.py | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/bitbake/lib/bb/parse/parse_py/ConfHandler.py b/bitbake/lib/bb/parse/parse_py/ConfHandler.py index 05c627ec8b..7826dee7d3 100644 --- a/bitbake/lib/bb/parse/parse_py/ConfHandler.py +++ b/bitbake/lib/bb/parse/parse_py/ConfHandler.py | |||
@@ -21,7 +21,7 @@ __config_regexp__ = re.compile( r""" | |||
21 | ^ | 21 | ^ |
22 | (?P<exp>export\s+)? | 22 | (?P<exp>export\s+)? |
23 | (?P<var>[a-zA-Z0-9\-_+.${}/~:]+?) | 23 | (?P<var>[a-zA-Z0-9\-_+.${}/~:]+?) |
24 | (\[(?P<flag>[a-zA-Z0-9\-_+.][a-zA-Z0-9\-_+.@]+)\])? | 24 | (\[(?P<flag>[a-zA-Z0-9\-_+.][a-zA-Z0-9\-_+.@]*)\])? |
25 | 25 | ||
26 | \s* ( | 26 | \s* ( |
27 | (?P<colon>:=) | | 27 | (?P<colon>:=) | |
@@ -103,7 +103,7 @@ def include_single_file(parentfn, fn, lineno, data, error_out): | |||
103 | # We have an issue where a UI might want to enforce particular settings such as | 103 | # We have an issue where a UI might want to enforce particular settings such as |
104 | # an empty DISTRO variable. If configuration files do something like assigning | 104 | # an empty DISTRO variable. If configuration files do something like assigning |
105 | # a weak default, it turns out to be very difficult to filter out these changes, | 105 | # a weak default, it turns out to be very difficult to filter out these changes, |
106 | # particularly when the weak default might appear half way though parsing a chain | 106 | # particularly when the weak default might appear half way though parsing a chain |
107 | # of configuration files. We therefore let the UIs hook into configuration file | 107 | # of configuration files. We therefore let the UIs hook into configuration file |
108 | # parsing. This turns out to be a hard problem to solve any other way. | 108 | # parsing. This turns out to be a hard problem to solve any other way. |
109 | confFilters = [] | 109 | confFilters = [] |
diff --git a/bitbake/lib/bb/tests/parse.py b/bitbake/lib/bb/tests/parse.py index d27c7c6f15..a3165d95bd 100644 --- a/bitbake/lib/bb/tests/parse.py +++ b/bitbake/lib/bb/tests/parse.py | |||
@@ -222,6 +222,7 @@ VAR = " \\ | |||
222 | at_sign_in_var_flag = """ | 222 | at_sign_in_var_flag = """ |
223 | A[flag@.service] = "nonet" | 223 | A[flag@.service] = "nonet" |
224 | B[flag@.target] = "ntb" | 224 | B[flag@.target] = "ntb" |
225 | C[f] = "flag" | ||
225 | 226 | ||
226 | unset A[flag@.service] | 227 | unset A[flag@.service] |
227 | """ | 228 | """ |
@@ -232,6 +233,7 @@ unset A[flag@.service] | |||
232 | self.assertEqual(d.getVar("B"), None) | 233 | self.assertEqual(d.getVar("B"), None) |
233 | self.assertEqual(d.getVarFlag("A","flag@.service"), None) | 234 | self.assertEqual(d.getVarFlag("A","flag@.service"), None) |
234 | self.assertEqual(d.getVarFlag("B","flag@.target"), "ntb") | 235 | self.assertEqual(d.getVarFlag("B","flag@.target"), "ntb") |
236 | self.assertEqual(d.getVarFlag("C","f"), "flag") | ||
235 | 237 | ||
236 | def test_parse_invalid_at_sign_in_var_flag(self): | 238 | def test_parse_invalid_at_sign_in_var_flag(self): |
237 | invalid_at_sign = self.at_sign_in_var_flag.replace("B[f", "B[@f") | 239 | invalid_at_sign = self.at_sign_in_var_flag.replace("B[f", "B[@f") |