summaryrefslogtreecommitdiffstats
path: root/lib/bb/parse/parse_py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2012-12-11 00:01:56 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-12-11 15:59:19 +0000
commit9fc98f96f0e0320beda0ce9546275a99336732c1 (patch)
treeaac28d91ebb37156bdff5cefa8ac51506f42938a /lib/bb/parse/parse_py
parent5b1b959b43c5ca90a46769381cf18d82cd76ea60 (diff)
downloadbitbake-9fc98f96f0e0320beda0ce9546275a99336732c1.tar.gz
BBHandler/ast: Simplify/fix EXPORT_FUNCTIONS usage
The current usage of EXPORT_FUNCTIONS is rather problematic since a class list (classes) is passed into the ast statement and cached as it was when first parsed. This class list may be different in other cases but is locked once in the cache. Worse, the construction of classes can be broken by exceptions during parsing at the wrong moments since the state of the parser is not always reset correctly. This can lead to leakage of other classes into the classes list. The current EXPORT_FUNCTIONS implementation looks at the last two currently inherited classes and sets up an indirect function call view the second last class inherited, e.g.: do_configure calls gnomebase_do_configure gnomebase_do_configure calls autotools_do_configure This intermediary doesn't seem to serve a useful purpose. This patch therefore makes builds deterministic and fixes various cache problems and indirection by removing the intermediaries and simply performing directly mapping for the cases where its needed. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/parse/parse_py')
-rw-r--r--lib/bb/parse/parse_py/BBHandler.py15
1 files changed, 5 insertions, 10 deletions
diff --git a/lib/bb/parse/parse_py/BBHandler.py b/lib/bb/parse/parse_py/BBHandler.py
index 2e0647b5d..92c55f531 100644
--- a/lib/bb/parse/parse_py/BBHandler.py
+++ b/lib/bb/parse/parse_py/BBHandler.py
@@ -51,7 +51,6 @@ __infunc__ = ""
__inpython__ = False
__body__ = []
__classname__ = ""
-classes = [ None, ]
cached_statements = {}
@@ -107,7 +106,7 @@ def get_statements(filename, absolute_filename, base_name):
return statements
def handle(fn, d, include):
- global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __infunc__, __body__, __residue__
+ global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __infunc__, __body__, __residue__, __classname__
__body__ = []
__infunc__ = ""
__classname__ = ""
@@ -125,7 +124,6 @@ def handle(fn, d, include):
if ext == ".bbclass":
__classname__ = root
- classes.append(__classname__)
__inherit_cache = d.getVar('__inherit_cache') or []
if not fn in __inherit_cache:
__inherit_cache.append(fn)
@@ -150,11 +148,8 @@ def handle(fn, d, include):
statements.eval(d)
- if ext == ".bbclass":
- classes.remove(__classname__)
- else:
- if include == 0:
- return ast.multi_finalize(fn, d)
+ if ext != ".bbclass" and include == 0:
+ return ast.multi_finalize(fn, d)
if oldfile:
d.setVar("FILE", oldfile)
@@ -166,7 +161,7 @@ def handle(fn, d, include):
return d
def feeder(lineno, s, fn, root, statements):
- global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __def_regexp__, __python_func_regexp__, __inpython__, __infunc__, __body__, classes, bb, __residue__
+ global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __def_regexp__, __python_func_regexp__, __inpython__, __infunc__, __body__, bb, __residue__, __classname__
if __infunc__:
if s == '}':
__body__.append('')
@@ -225,7 +220,7 @@ def feeder(lineno, s, fn, root, statements):
m = __export_func_regexp__.match(s)
if m:
- ast.handleExportFuncs(statements, fn, lineno, m, classes)
+ ast.handleExportFuncs(statements, fn, lineno, m, __classname__)
return
m = __addtask_regexp__.match(s)