diff options
Diffstat (limited to 'bitbake/lib/bb/parse/ast.py')
-rw-r--r-- | bitbake/lib/bb/parse/ast.py | 79 |
1 files changed, 48 insertions, 31 deletions
diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py index cdc736a62a..f5974f40d2 100644 --- a/bitbake/lib/bb/parse/ast.py +++ b/bitbake/lib/bb/parse/ast.py | |||
@@ -208,7 +208,49 @@ class ExportFuncsNode: | |||
208 | else: | 208 | else: |
209 | bb.data.setVar(var, "\t" + calledvar + "\n", data) | 209 | bb.data.setVar(var, "\t" + calledvar + "\n", data) |
210 | bb.data.setVarFlag(var, 'export_func', '1', data) | 210 | bb.data.setVarFlag(var, 'export_func', '1', data) |
211 | 211 | ||
212 | class AddTaskNode: | ||
213 | def __init__(self, func, before, after): | ||
214 | self.func = func | ||
215 | self.before = before | ||
216 | self.after = after | ||
217 | |||
218 | def eval(self, data): | ||
219 | var = self.func | ||
220 | if self.func[:3] != "do_": | ||
221 | var = "do_" + self.func | ||
222 | |||
223 | bb.data.setVarFlag(var, "task", 1, data) | ||
224 | bbtasks = bb.data.getVar('__BBTASKS', data) or [] | ||
225 | if not var in bbtasks: | ||
226 | bbtasks.append(var) | ||
227 | bb.data.setVar('__BBTASKS', bbtasks, data) | ||
228 | |||
229 | existing = bb.data.getVarFlag(var, "deps", data) or [] | ||
230 | if self.after is not None: | ||
231 | # set up deps for function | ||
232 | for entry in self.after.split(): | ||
233 | if entry not in existing: | ||
234 | existing.append(entry) | ||
235 | bb.data.setVarFlag(var, "deps", existing, data) | ||
236 | if self.before is not None: | ||
237 | # set up things that depend on this func | ||
238 | for entry in self.before.split(): | ||
239 | existing = bb.data.getVarFlag(entry, "deps", data) or [] | ||
240 | if var not in existing: | ||
241 | bb.data.setVarFlag(entry, "deps", [var] + existing, data) | ||
242 | |||
243 | class BBHandlerNode: | ||
244 | def __init__(self, fns): | ||
245 | self.hs = __word__.findall(fns) | ||
246 | |||
247 | def eval(self, data): | ||
248 | bbhands = bb.data.getVar('__BBHANDLERS', data) or [] | ||
249 | for h in self.hs: | ||
250 | bbhands.append(h) | ||
251 | bb.data.setVarFlag(h, "handler", 1, data) | ||
252 | bb.data.setVar('__BBHANDLERS', bbhands, data) | ||
253 | |||
212 | def handleInclude(statements, m, fn, lineno, data, force): | 254 | def handleInclude(statements, m, fn, lineno, data, force): |
213 | # AST handling | 255 | # AST handling |
214 | statements.append(IncludeNode(m.group(1), fn, lineno, force)) | 256 | statements.append(IncludeNode(m.group(1), fn, lineno, force)) |
@@ -248,38 +290,13 @@ def handleAddTask(statements, m, d): | |||
248 | after = m.group("after") | 290 | after = m.group("after") |
249 | if func is None: | 291 | if func is None: |
250 | return | 292 | return |
251 | if func[:3] != "do_": | 293 | |
252 | var = "do_" + func | 294 | statements.append(AddTaskNode(func, before, after)) |
253 | 295 | statements[-1].eval(d) | |
254 | bb.data.setVarFlag(var, "task", 1, d) | ||
255 | |||
256 | bbtasks = bb.data.getVar('__BBTASKS', d) or [] | ||
257 | if not var in bbtasks: | ||
258 | bbtasks.append(var) | ||
259 | bb.data.setVar('__BBTASKS', bbtasks, d) | ||
260 | |||
261 | existing = bb.data.getVarFlag(var, "deps", d) or [] | ||
262 | if after is not None: | ||
263 | # set up deps for function | ||
264 | for entry in after.split(): | ||
265 | if entry not in existing: | ||
266 | existing.append(entry) | ||
267 | bb.data.setVarFlag(var, "deps", existing, d) | ||
268 | if before is not None: | ||
269 | # set up things that depend on this func | ||
270 | for entry in before.split(): | ||
271 | existing = bb.data.getVarFlag(entry, "deps", d) or [] | ||
272 | if var not in existing: | ||
273 | bb.data.setVarFlag(entry, "deps", [var] + existing, d) | ||
274 | 296 | ||
275 | def handleBBHandlers(statements, m, d): | 297 | def handleBBHandlers(statements, m, d): |
276 | fns = m.group(1) | 298 | statements.append(BBHandlerNode(m.group(1))) |
277 | hs = __word__.findall(fns) | 299 | statements[-1].eval(d) |
278 | bbhands = bb.data.getVar('__BBHANDLERS', d) or [] | ||
279 | for h in hs: | ||
280 | bbhands.append(h) | ||
281 | bb.data.setVarFlag(h, "handler", 1, d) | ||
282 | bb.data.setVar('__BBHANDLERS', bbhands, d) | ||
283 | 300 | ||
284 | def handleInherit(statements, m, d): | 301 | def handleInherit(statements, m, d): |
285 | files = m.group(1) | 302 | files = m.group(1) |