From 9913fd88d9399aedd58a39402673ba6aca28a118 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Tue, 2 Feb 2016 13:54:01 +0000 Subject: bitbake: codeparser: Improve handling of data.expand() dependencies Currently bitbake doesn't parse into data.expand() expressions, relying on high level expansion of python code to handle this. One of the tests does however test this works. We don't really want to be doing string expansion on python code, so specifically parse into expand() function calls so that when the high level behaviour is tweaked, the self tests continue to pass and that we do continue to handle expand() function calls as best we can. (Bitbake rev: b12c17be5e4a74c9680876605c87f46501f78d28) Signed-off-by: Richard Purdie --- bitbake/lib/bb/codeparser.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'bitbake') diff --git a/bitbake/lib/bb/codeparser.py b/bitbake/lib/bb/codeparser.py index 577b4271cf..2094f1337c 100644 --- a/bitbake/lib/bb/codeparser.py +++ b/bitbake/lib/bb/codeparser.py @@ -221,6 +221,17 @@ class PythonParser(): self.references.add(node.args[0].s) else: self.warn(node.func, node.args[0]) + elif name and name.endswith(".expand"): + if isinstance(node.args[0], ast.Str): + value = node.args[0].s + d = bb.data.init() + parser = d.expandWithRefs(value, self.name) + self.references |= parser.references + self.execs |= parser.execs + for varname in parser.contains: + if varname not in self.contains: + self.contains[varname] = set() + self.contains[varname] |= parser.contains[varname] elif name in self.execfuncs: if isinstance(node.args[0], ast.Str): self.var_execs.add(node.args[0].s) @@ -243,6 +254,7 @@ class PythonParser(): break def __init__(self, name, log): + self.name = name self.var_execs = set() self.contains = {} self.execs = set() -- cgit v1.2.3-54-g00ecf