summaryrefslogtreecommitdiffstats
path: root/bitbake/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:42 +0000
commit8ead7dc3cc1b0c878f246ea233e34d58a74a66db (patch)
tree25e3a4d7780837d34f4c90490eb53d3c79006f1b /bitbake/lib/bb/parse/parse_py
parentf823f0a0c04d6f13359f0aac4a2946a6e4dd3649 (diff)
downloadpoky-8ead7dc3cc1b0c878f246ea233e34d58a74a66db.tar.gz
bitbake: 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. (Bitbake rev: 9fc98f96f0e0320beda0ce9546275a99336732c1) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/parse/parse_py')
-rw-r--r--bitbake/lib/bb/parse/parse_py/BBHandler.py15
1 files changed, 5 insertions, 10 deletions
diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py
index 2e0647b5df..92c55f531a 100644
--- a/bitbake/lib/bb/parse/parse_py/BBHandler.py
+++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py
@@ -51,7 +51,6 @@ __infunc__ = ""
51__inpython__ = False 51__inpython__ = False
52__body__ = [] 52__body__ = []
53__classname__ = "" 53__classname__ = ""
54classes = [ None, ]
55 54
56cached_statements = {} 55cached_statements = {}
57 56
@@ -107,7 +106,7 @@ def get_statements(filename, absolute_filename, base_name):
107 return statements 106 return statements
108 107
109def handle(fn, d, include): 108def handle(fn, d, include):
110 global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __infunc__, __body__, __residue__ 109 global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __infunc__, __body__, __residue__, __classname__
111 __body__ = [] 110 __body__ = []
112 __infunc__ = "" 111 __infunc__ = ""
113 __classname__ = "" 112 __classname__ = ""
@@ -125,7 +124,6 @@ def handle(fn, d, include):
125 124
126 if ext == ".bbclass": 125 if ext == ".bbclass":
127 __classname__ = root 126 __classname__ = root
128 classes.append(__classname__)
129 __inherit_cache = d.getVar('__inherit_cache') or [] 127 __inherit_cache = d.getVar('__inherit_cache') or []
130 if not fn in __inherit_cache: 128 if not fn in __inherit_cache:
131 __inherit_cache.append(fn) 129 __inherit_cache.append(fn)
@@ -150,11 +148,8 @@ def handle(fn, d, include):
150 148
151 statements.eval(d) 149 statements.eval(d)
152 150
153 if ext == ".bbclass": 151 if ext != ".bbclass" and include == 0:
154 classes.remove(__classname__) 152 return ast.multi_finalize(fn, d)
155 else:
156 if include == 0:
157 return ast.multi_finalize(fn, d)
158 153
159 if oldfile: 154 if oldfile:
160 d.setVar("FILE", oldfile) 155 d.setVar("FILE", oldfile)
@@ -166,7 +161,7 @@ def handle(fn, d, include):
166 return d 161 return d
167 162
168def feeder(lineno, s, fn, root, statements): 163def feeder(lineno, s, fn, root, statements):
169 global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __def_regexp__, __python_func_regexp__, __inpython__, __infunc__, __body__, classes, bb, __residue__ 164 global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __def_regexp__, __python_func_regexp__, __inpython__, __infunc__, __body__, bb, __residue__, __classname__
170 if __infunc__: 165 if __infunc__:
171 if s == '}': 166 if s == '}':
172 __body__.append('') 167 __body__.append('')
@@ -225,7 +220,7 @@ def feeder(lineno, s, fn, root, statements):
225 220
226 m = __export_func_regexp__.match(s) 221 m = __export_func_regexp__.match(s)
227 if m: 222 if m:
228 ast.handleExportFuncs(statements, fn, lineno, m, classes) 223 ast.handleExportFuncs(statements, fn, lineno, m, __classname__)
229 return 224 return
230 225
231 m = __addtask_regexp__.match(s) 226 m = __addtask_regexp__.match(s)