diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-10-17 11:42:28 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-10-18 10:59:27 +0100 |
commit | 9248bc1c53417e6581aa33fda683e765ad866426 (patch) | |
tree | a0ec636a8912b60922105e4a5218c2d272c592b1 /bitbake | |
parent | f5181b36d66fb8d92b2eb9072e76aa4c13fccb33 (diff) | |
download | poky-9248bc1c53417e6581aa33fda683e765ad866426.tar.gz |
bitbake: data/data_smart: Allow getVarFlag to return the variable parser object
(Bitbake rev: 136100dc932c9019737f927d826955425134010f)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/data.py | 11 | ||||
-rw-r--r-- | bitbake/lib/bb/data_smart.py | 18 |
2 files changed, 18 insertions, 11 deletions
diff --git a/bitbake/lib/bb/data.py b/bitbake/lib/bb/data.py index 80a7879cb6..e2700077c3 100644 --- a/bitbake/lib/bb/data.py +++ b/bitbake/lib/bb/data.py | |||
@@ -283,14 +283,12 @@ def build_dependencies(key, keys, shelldeps, varflagsexcl, d): | |||
283 | try: | 283 | try: |
284 | if key[-1] == ']': | 284 | if key[-1] == ']': |
285 | vf = key[:-1].split('[') | 285 | vf = key[:-1].split('[') |
286 | value = d.getVarFlag(vf[0], vf[1], False) | 286 | value, parser = d.getVarFlag(vf[0], vf[1], False, retparser=True) |
287 | parser = d.expandWithRefs(value, key) | ||
288 | deps |= parser.references | 287 | deps |= parser.references |
289 | deps = deps | (keys & parser.execs) | 288 | deps = deps | (keys & parser.execs) |
290 | return deps, value | 289 | return deps, value |
291 | varflags = d.getVarFlags(key, ["vardeps", "vardepvalue", "vardepsexclude", "exports", "postfuncs", "prefuncs", "lineno", "filename"]) or {} | 290 | varflags = d.getVarFlags(key, ["vardeps", "vardepvalue", "vardepsexclude", "exports", "postfuncs", "prefuncs", "lineno", "filename"]) or {} |
292 | vardeps = varflags.get("vardeps") | 291 | vardeps = varflags.get("vardeps") |
293 | value = d.getVarFlag(key, "_content", False) | ||
294 | 292 | ||
295 | def handle_contains(value, contains, d): | 293 | def handle_contains(value, contains, d): |
296 | newvalue = "" | 294 | newvalue = "" |
@@ -310,9 +308,10 @@ def build_dependencies(key, keys, shelldeps, varflagsexcl, d): | |||
310 | return value + newvalue | 308 | return value + newvalue |
311 | 309 | ||
312 | if "vardepvalue" in varflags: | 310 | if "vardepvalue" in varflags: |
313 | value = varflags.get("vardepvalue") | 311 | value = varflags.get("vardepvalue") |
314 | elif varflags.get("func"): | 312 | elif varflags.get("func"): |
315 | if varflags.get("python"): | 313 | if varflags.get("python"): |
314 | value = d.getVarFlag(key, "_content", False) | ||
316 | parser = bb.codeparser.PythonParser(key, logger) | 315 | parser = bb.codeparser.PythonParser(key, logger) |
317 | if value and "\t" in value: | 316 | if value and "\t" in value: |
318 | logger.warning("Variable %s contains tabs, please remove these (%s)" % (key, d.getVar("FILE"))) | 317 | logger.warning("Variable %s contains tabs, please remove these (%s)" % (key, d.getVar("FILE"))) |
@@ -321,7 +320,7 @@ def build_dependencies(key, keys, shelldeps, varflagsexcl, d): | |||
321 | deps = deps | (keys & parser.execs) | 320 | deps = deps | (keys & parser.execs) |
322 | value = handle_contains(value, parser.contains, d) | 321 | value = handle_contains(value, parser.contains, d) |
323 | else: | 322 | else: |
324 | parsedvar = d.expandWithRefs(value, key) | 323 | value, parsedvar = d.getVarFlag(key, "_content", False, retparser=True) |
325 | parser = bb.codeparser.ShellParser(key, logger) | 324 | parser = bb.codeparser.ShellParser(key, logger) |
326 | parser.parse_shell(parsedvar.value) | 325 | parser.parse_shell(parsedvar.value) |
327 | deps = deps | shelldeps | 326 | deps = deps | shelldeps |
@@ -337,7 +336,7 @@ def build_dependencies(key, keys, shelldeps, varflagsexcl, d): | |||
337 | if "exports" in varflags: | 336 | if "exports" in varflags: |
338 | deps = deps | set(varflags["exports"].split()) | 337 | deps = deps | set(varflags["exports"].split()) |
339 | else: | 338 | else: |
340 | parser = d.expandWithRefs(value, key) | 339 | value, parser = d.getVarFlag(key, "_content", False, retparser=True) |
341 | deps |= parser.references | 340 | deps |= parser.references |
342 | deps = deps | (keys & parser.execs) | 341 | deps = deps | (keys & parser.execs) |
343 | value = handle_contains(value, parser.contains, d) | 342 | value = handle_contains(value, parser.contains, d) |
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py index ecc71bd644..4ad0567c9a 100644 --- a/bitbake/lib/bb/data_smart.py +++ b/bitbake/lib/bb/data_smart.py | |||
@@ -722,7 +722,7 @@ class DataSmart(MutableMapping): | |||
722 | self.dict["__exportlist"]["_content"] = set() | 722 | self.dict["__exportlist"]["_content"] = set() |
723 | self.dict["__exportlist"]["_content"].add(var) | 723 | self.dict["__exportlist"]["_content"].add(var) |
724 | 724 | ||
725 | def getVarFlag(self, var, flag, expand=True, noweakdefault=False, parsing=False): | 725 | def getVarFlag(self, var, flag, expand=True, noweakdefault=False, parsing=False, retparser=False): |
726 | if flag == "_content": | 726 | if flag == "_content": |
727 | cachename = var | 727 | cachename = var |
728 | else: | 728 | else: |
@@ -798,9 +798,11 @@ class DataSmart(MutableMapping): | |||
798 | if match: | 798 | if match: |
799 | value = r + value | 799 | value = r + value |
800 | 800 | ||
801 | parser = None | ||
802 | if expand or retparser: | ||
803 | parser = self.expandWithRefs(value, cachename) | ||
801 | if expand: | 804 | if expand: |
802 | self.expand_cache[cachename] = self.expandWithRefs(value, cachename) | 805 | value = parser.value |
803 | value = self.expand_cache[cachename].value | ||
804 | 806 | ||
805 | if value and flag == "_content" and local_var is not None and "_remove" in local_var and not parsing: | 807 | if value and flag == "_content" and local_var is not None and "_remove" in local_var and not parsing: |
806 | removes = [] | 808 | removes = [] |
@@ -818,8 +820,14 @@ class DataSmart(MutableMapping): | |||
818 | filtered = filter(lambda v: v not in removes, | 820 | filtered = filter(lambda v: v not in removes, |
819 | __whitespace_split__.split(value)) | 821 | __whitespace_split__.split(value)) |
820 | value = "".join(filtered) | 822 | value = "".join(filtered) |
821 | if expand and cachename in self.expand_cache: | 823 | if parser: |
822 | self.expand_cache[cachename].value = value | 824 | parser.value = value |
825 | |||
826 | if parser: | ||
827 | self.expand_cache[cachename] = parser | ||
828 | |||
829 | if retparser: | ||
830 | return value, parser | ||
823 | 831 | ||
824 | return value | 832 | return value |
825 | 833 | ||