summaryrefslogtreecommitdiff
path: root/bitbake/lib/bb
diff options
context:
space:
mode:
authorHolger Freyther <ich@tamarin.(none)>2009-05-19 10:52:18 +0200
committerRichard Purdie <rpurdie@linux.intel.com>2010-02-15 17:07:48 +0000
commitbaf239590070201bd24bb63d95158a58cf9dcaa6 (patch)
tree74faac88cd38925eb58a68bfb31b3c150e318962 /bitbake/lib/bb
parentd84b7c555512288b916ebc58b4baeefb9758d6bf (diff)
downloadopenembedded-core-baf239590070201bd24bb63d95158a58cf9dcaa6.tar.gz
openembedded-core-baf239590070201bd24bb63d95158a58cf9dcaa6.tar.bz2
openembedded-core-baf239590070201bd24bb63d95158a58cf9dcaa6.tar.xz
openembedded-core-baf239590070201bd24bb63d95158a58cf9dcaa6.zip
bitbake: [parser] Move more methods to the ast scheme
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r--bitbake/lib/bb/parse/ast.py79
1 files changed, 48 insertions, 31 deletions
diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py
index cdc736a62..f5974f40d 100644
--- a/bitbake/lib/bb/parse/ast.py
+++ b/bitbake/lib/bb/parse/ast.py
@@ -208,7 +208,49 @@ class ExportFuncsNode:
else:
bb.data.setVar(var, "\t" + calledvar + "\n", data)
bb.data.setVarFlag(var, 'export_func', '1', data)
-
+
+class AddTaskNode:
+ def __init__(self, func, before, after):
+ self.func = func
+ self.before = before
+ self.after = after
+
+ def eval(self, data):
+ var = self.func
+ if self.func[:3] != "do_":
+ var = "do_" + self.func
+
+ bb.data.setVarFlag(var, "task", 1, data)
+ bbtasks = bb.data.getVar('__BBTASKS', data) or []
+ if not var in bbtasks:
+ bbtasks.append(var)
+ bb.data.setVar('__BBTASKS', bbtasks, data)
+
+ existing = bb.data.getVarFlag(var, "deps", data) or []
+ if self.after is not None:
+ # set up deps for function
+ for entry in self.after.split():
+ if entry not in existing:
+ existing.append(entry)
+ bb.data.setVarFlag(var, "deps", existing, data)
+ if self.before is not None:
+ # set up things that depend on this func
+ for entry in self.before.split():
+ existing = bb.data.getVarFlag(entry, "deps", data) or []
+ if var not in existing:
+ bb.data.setVarFlag(entry, "deps", [var] + existing, data)
+
+class BBHandlerNode:
+ def __init__(self, fns):
+ self.hs = __word__.findall(fns)
+
+ def eval(self, data):
+ bbhands = bb.data.getVar('__BBHANDLERS', data) or []
+ for h in self.hs:
+ bbhands.append(h)
+ bb.data.setVarFlag(h, "handler", 1, data)
+ bb.data.setVar('__BBHANDLERS', bbhands, data)
+
def handleInclude(statements, m, fn, lineno, data, force):
# AST handling
statements.append(IncludeNode(m.group(1), fn, lineno, force))
@@ -248,38 +290,13 @@ def handleAddTask(statements, m, d):
after = m.group("after")
if func is None:
return
- if func[:3] != "do_":
- var = "do_" + func
-
- bb.data.setVarFlag(var, "task", 1, d)
-
- bbtasks = bb.data.getVar('__BBTASKS', d) or []
- if not var in bbtasks:
- bbtasks.append(var)
- bb.data.setVar('__BBTASKS', bbtasks, d)
-
- existing = bb.data.getVarFlag(var, "deps", d) or []
- if after is not None:
- # set up deps for function
- for entry in after.split():
- if entry not in existing:
- existing.append(entry)
- bb.data.setVarFlag(var, "deps", existing, d)
- if before is not None:
- # set up things that depend on this func
- for entry in before.split():
- existing = bb.data.getVarFlag(entry, "deps", d) or []
- if var not in existing:
- bb.data.setVarFlag(entry, "deps", [var] + existing, d)
+
+ statements.append(AddTaskNode(func, before, after))
+ statements[-1].eval(d)
def handleBBHandlers(statements, m, d):
- fns = m.group(1)
- hs = __word__.findall(fns)
- bbhands = bb.data.getVar('__BBHANDLERS', d) or []
- for h in hs:
- bbhands.append(h)
- bb.data.setVarFlag(h, "handler", 1, d)
- bb.data.setVar('__BBHANDLERS', bbhands, d)
+ statements.append(BBHandlerNode(m.group(1)))
+ statements[-1].eval(d)
def handleInherit(statements, m, d):
files = m.group(1)