summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb
diff options
context:
space:
mode:
authorChristopher Larson <chris_larson@mentor.com>2016-04-30 12:52:45 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-05-19 09:05:21 +0100
commit1fb330bea656617451509433ff93d426d02b8204 (patch)
tree6e418e6e60962454558172332ced856fa8b10a6d /bitbake/lib/bb
parent32ee30a46d5e27ffcb0f18d85a0768bd22adca94 (diff)
downloadpoky-1fb330bea656617451509433ff93d426d02b8204.tar.gz
bitbake: bb.codeparser: track variable flag references
Previously we only tracked the flags (minus excluded) of variables we depend on, but not the flags we use explicitly. (Bitbake rev: bdeb3dcd7c92e62a7c079e7b27048c4114f24a3a) Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r--bitbake/lib/bb/codeparser.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/bitbake/lib/bb/codeparser.py b/bitbake/lib/bb/codeparser.py
index 3ee4d5622b..2980510d41 100644
--- a/bitbake/lib/bb/codeparser.py
+++ b/bitbake/lib/bb/codeparser.py
@@ -191,6 +191,7 @@ class BufferedLogger(Logger):
191 191
192class PythonParser(): 192class PythonParser():
193 getvars = (".getVar", ".appendVar", ".prependVar") 193 getvars = (".getVar", ".appendVar", ".prependVar")
194 getvarflags = (".getVarFlag", ".appendVarFlag", ".prependVarFlag")
194 containsfuncs = ("bb.utils.contains", "base_contains", "bb.utils.contains_any") 195 containsfuncs = ("bb.utils.contains", "base_contains", "bb.utils.contains_any")
195 execfuncs = ("bb.build.exec_func", "bb.build.exec_task") 196 execfuncs = ("bb.build.exec_func", "bb.build.exec_task")
196 197
@@ -210,15 +211,20 @@ class PythonParser():
210 211
211 def visit_Call(self, node): 212 def visit_Call(self, node):
212 name = self.called_node_name(node.func) 213 name = self.called_node_name(node.func)
213 if name and name.endswith(self.getvars) or name in self.containsfuncs: 214 if name and (name.endswith(self.getvars) or name.endswith(self.getvarflags) or name in self.containsfuncs):
214 if isinstance(node.args[0], ast.Str): 215 if isinstance(node.args[0], ast.Str):
215 varname = node.args[0].s 216 varname = node.args[0].s
216 if name in self.containsfuncs and isinstance(node.args[1], ast.Str): 217 if name in self.containsfuncs and isinstance(node.args[1], ast.Str):
217 if varname not in self.contains: 218 if varname not in self.contains:
218 self.contains[varname] = set() 219 self.contains[varname] = set()
219 self.contains[varname].add(node.args[1].s) 220 self.contains[varname].add(node.args[1].s)
220 else: 221 elif name.endswith(self.getvarflags):
221 self.references.add(node.args[0].s) 222 if isinstance(node.args[1], ast.Str):
223 self.references.add('%s[%s]' % (varname, node.args[1].s))
224 else:
225 self.warn(node.func, node.args[1])
226 else:
227 self.references.add(varname)
222 else: 228 else:
223 self.warn(node.func, node.args[0]) 229 self.warn(node.func, node.args[0])
224 elif name and name.endswith(".expand"): 230 elif name and name.endswith(".expand"):