diff options
Diffstat (limited to 'bitbake/lib')
| -rw-r--r-- | bitbake/lib/bb/parse/parse_py/ConfHandler.py | 4 | ||||
| -rw-r--r-- | bitbake/lib/bb/tests/parse.py | 21 |
2 files changed, 23 insertions, 2 deletions
diff --git a/bitbake/lib/bb/parse/parse_py/ConfHandler.py b/bitbake/lib/bb/parse/parse_py/ConfHandler.py index 3076067287..05c627ec8b 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\-_+.]+)\])? | 24 | (\[(?P<flag>[a-zA-Z0-9\-_+.][a-zA-Z0-9\-_+.@]+)\])? |
| 25 | 25 | ||
| 26 | \s* ( | 26 | \s* ( |
| 27 | (?P<colon>:=) | | 27 | (?P<colon>:=) | |
| @@ -45,7 +45,7 @@ __include_regexp__ = re.compile( r"include\s+(.+)" ) | |||
| 45 | __require_regexp__ = re.compile( r"require\s+(.+)" ) | 45 | __require_regexp__ = re.compile( r"require\s+(.+)" ) |
| 46 | __export_regexp__ = re.compile( r"export\s+([a-zA-Z0-9\-_+.${}/~]+)$" ) | 46 | __export_regexp__ = re.compile( r"export\s+([a-zA-Z0-9\-_+.${}/~]+)$" ) |
| 47 | __unset_regexp__ = re.compile( r"unset\s+([a-zA-Z0-9\-_+.${}/~]+)$" ) | 47 | __unset_regexp__ = re.compile( r"unset\s+([a-zA-Z0-9\-_+.${}/~]+)$" ) |
| 48 | __unset_flag_regexp__ = re.compile( r"unset\s+([a-zA-Z0-9\-_+.${}/~]+)\[([a-zA-Z0-9\-_+.]+)\]$" ) | 48 | __unset_flag_regexp__ = re.compile( r"unset\s+([a-zA-Z0-9\-_+.${}/~]+)\[([a-zA-Z0-9\-_+.][a-zA-Z0-9\-_+.@]+)\]$" ) |
| 49 | __addpylib_regexp__ = re.compile(r"addpylib\s+(.+)\s+(.+)" ) | 49 | __addpylib_regexp__ = re.compile(r"addpylib\s+(.+)\s+(.+)" ) |
| 50 | 50 | ||
| 51 | def init(data): | 51 | def init(data): |
diff --git a/bitbake/lib/bb/tests/parse.py b/bitbake/lib/bb/tests/parse.py index ee7f2534f1..d27c7c6f15 100644 --- a/bitbake/lib/bb/tests/parse.py +++ b/bitbake/lib/bb/tests/parse.py | |||
| @@ -218,3 +218,24 @@ VAR = " \\ | |||
| 218 | with self.assertRaises(bb.BBHandledException): | 218 | with self.assertRaises(bb.BBHandledException): |
| 219 | d = bb.parse.handle(f.name, self.d)[''] | 219 | d = bb.parse.handle(f.name, self.d)[''] |
| 220 | 220 | ||
| 221 | |||
| 222 | at_sign_in_var_flag = """ | ||
| 223 | A[flag@.service] = "nonet" | ||
| 224 | B[flag@.target] = "ntb" | ||
| 225 | |||
| 226 | unset A[flag@.service] | ||
| 227 | """ | ||
| 228 | def test_parse_at_sign_in_var_flag(self): | ||
| 229 | f = self.parsehelper(self.at_sign_in_var_flag) | ||
| 230 | d = bb.parse.handle(f.name, self.d)[''] | ||
| 231 | self.assertEqual(d.getVar("A"), None) | ||
| 232 | self.assertEqual(d.getVar("B"), None) | ||
| 233 | self.assertEqual(d.getVarFlag("A","flag@.service"), None) | ||
| 234 | self.assertEqual(d.getVarFlag("B","flag@.target"), "ntb") | ||
| 235 | |||
| 236 | 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") | ||
| 238 | f = self.parsehelper(invalid_at_sign) | ||
| 239 | with self.assertRaises(bb.parse.ParseError): | ||
| 240 | d = bb.parse.handle(f.name, self.d)[''] | ||
| 241 | |||
