[oe-commits] [bitbake] 04/04: bb.codeparser: track variable flag references

git at git.openembedded.org git at git.openembedded.org
Tue May 17 22:25:09 UTC 2016


rpurdie pushed a commit to branch master-next
in repository bitbake.

commit 02de81252a7a2abc867e4742cf2791d860cd661e
Author: Christopher Larson <chris_larson at mentor.com>
AuthorDate: Sat Apr 30 12:52:45 2016 -0700

    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.
    
    Signed-off-by: Christopher Larson <chris_larson at mentor.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/bb/codeparser.py | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/lib/bb/codeparser.py b/lib/bb/codeparser.py
index 3ee4d56..2980510 100644
--- a/lib/bb/codeparser.py
+++ b/lib/bb/codeparser.py
@@ -191,6 +191,7 @@ class BufferedLogger(Logger):
 
 class PythonParser():
     getvars = (".getVar", ".appendVar", ".prependVar")
+    getvarflags = (".getVarFlag", ".appendVarFlag", ".prependVarFlag")
     containsfuncs = ("bb.utils.contains", "base_contains", "bb.utils.contains_any")
     execfuncs = ("bb.build.exec_func", "bb.build.exec_task")
 
@@ -210,15 +211,20 @@ class PythonParser():
 
     def visit_Call(self, node):
         name = self.called_node_name(node.func)
-        if name and name.endswith(self.getvars) or name in self.containsfuncs:
+        if name and (name.endswith(self.getvars) or name.endswith(self.getvarflags) or name in self.containsfuncs):
             if isinstance(node.args[0], ast.Str):
                 varname = node.args[0].s
                 if name in self.containsfuncs and isinstance(node.args[1], ast.Str):
                     if varname not in self.contains:
                         self.contains[varname] = set()
                     self.contains[varname].add(node.args[1].s)
-                else:                      
-                    self.references.add(node.args[0].s)
+                elif name.endswith(self.getvarflags):
+                    if isinstance(node.args[1], ast.Str):
+                        self.references.add('%s[%s]' % (varname, node.args[1].s))
+                    else:
+                        self.warn(node.func, node.args[1])
+                else:
+                    self.references.add(varname)
             else:
                 self.warn(node.func, node.args[0])
         elif name and name.endswith(".expand"):

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list