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 | openembedded-core-contrib-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): try: if key[-1] == ']': vf = key[:-1].split('[') - value = d.getVarFlag(vf[0], vf[1], False) - parser = d.expandWithRefs(value, key) + value, parser = d.getVarFlag(vf[0], vf[1], False, retparser=True) deps |= parser.references deps = deps | (keys & parser.execs) return deps, value varflags = d.getVarFlags(key, ["vardeps", "vardepvalue", "vardepsexclude", "exports", "postfuncs", "prefuncs", "lineno", "filename"]) or {} vardeps = varflags.get("vardeps") - value = d.getVarFlag(key, "_content", False) def handle_contains(value, contains, d): newvalue = "" @@ -310,9 +308,10 @@ def build_dependencies(key, keys, shelldeps, varflagsexcl, d): return value + newvalue if "vardepvalue" in varflags: - value = varflags.get("vardepvalue") + value = varflags.get("vardepvalue") elif varflags.get("func"): if varflags.get("python"): + value = d.getVarFlag(key, "_content", False) parser = bb.codeparser.PythonParser(key, logger) if value and "\t" in value: 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): deps = deps | (keys & parser.execs) value = handle_contains(value, parser.contains, d) else: - parsedvar = d.expandWithRefs(value, key) + value, parsedvar = d.getVarFlag(key, "_content", False, retparser=True) parser = bb.codeparser.ShellParser(key, logger) parser.parse_shell(parsedvar.value) deps = deps | shelldeps @@ -337,7 +336,7 @@ def build_dependencies(key, keys, shelldeps, varflagsexcl, d): if "exports" in varflags: deps = deps | set(varflags["exports"].split()) else: - parser = d.expandWithRefs(value, key) + value, parser = d.getVarFlag(key, "_content", False, retparser=True) deps |= parser.references deps = deps | (keys & parser.execs) 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): self.dict["__exportlist"]["_content"] = set() self.dict["__exportlist"]["_content"].add(var) - def getVarFlag(self, var, flag, expand=True, noweakdefault=False, parsing=False): + def getVarFlag(self, var, flag, expand=True, noweakdefault=False, parsing=False, retparser=False): if flag == "_content": cachename = var else: @@ -798,9 +798,11 @@ class DataSmart(MutableMapping): if match: value = r + value + parser = None + if expand or retparser: + parser = self.expandWithRefs(value, cachename) if expand: - self.expand_cache[cachename] = self.expandWithRefs(value, cachename) - value = self.expand_cache[cachename].value + value = parser.value if value and flag == "_content" and local_var is not None and "_remove" in local_var and not parsing: removes = [] @@ -818,8 +820,14 @@ class DataSmart(MutableMapping): filtered = filter(lambda v: v not in removes, __whitespace_split__.split(value)) value = "".join(filtered) - if expand and cachename in self.expand_cache: - self.expand_cache[cachename].value = value + if parser: + parser.value = value + + if parser: + self.expand_cache[cachename] = parser + + if retparser: + return value, parser return value |