summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/parse/parse_py/BBHandler.py
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2006-11-29 22:52:37 +0000
committerRichard Purdie <richard@openedhand.com>2006-11-29 22:52:37 +0000
commit681d6c18ad59dac9e53f769a568835241d7fa9b7 (patch)
tree243418a546b89650d28580f7721b8324586146e4 /bitbake/lib/bb/parse/parse_py/BBHandler.py
parentadabf6c0931af1282a7c75321cd8b050e8d05c95 (diff)
downloadpoky-681d6c18ad59dac9e53f769a568835241d7fa9b7.tar.gz
bitbake: Sync with bitbake trunk for bugfixes and improved dot file generation code
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@987 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'bitbake/lib/bb/parse/parse_py/BBHandler.py')
-rw-r--r--bitbake/lib/bb/parse/parse_py/BBHandler.py77
1 files changed, 36 insertions, 41 deletions
diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py
index 34f4d25996..42b0369428 100644
--- a/bitbake/lib/bb/parse/parse_py/BBHandler.py
+++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py
@@ -40,7 +40,6 @@ __word__ = re.compile(r"\S+")
40__infunc__ = "" 40__infunc__ = ""
41__inpython__ = False 41__inpython__ = False
42__body__ = [] 42__body__ = []
43__bbpath_found__ = 0
44__classname__ = "" 43__classname__ = ""
45classes = [ None, ] 44classes = [ None, ]
46 45
@@ -58,25 +57,24 @@ def supports(fn, d):
58 return localfn[-3:] == ".bb" or localfn[-8:] == ".bbclass" or localfn[-4:] == ".inc" 57 return localfn[-3:] == ".bb" or localfn[-8:] == ".bbclass" or localfn[-4:] == ".inc"
59 58
60def inherit(files, d): 59def inherit(files, d):
61 __inherit_cache = data.getVar('__inherit_cache', d) or "" 60 __inherit_cache = data.getVar('__inherit_cache', d) or []
62 fn = "" 61 fn = ""
63 lineno = 0 62 lineno = 0
64 for f in files: 63 files = data.expand(files, d)
65 file = data.expand(f, d) 64 for file in files:
66 if file[0] != "/" and file[-8:] != ".bbclass": 65 if file[0] != "/" and file[-8:] != ".bbclass":
67 file = os.path.join('classes', '%s.bbclass' % file) 66 file = os.path.join('classes', '%s.bbclass' % file)
68 67
69 if not file in __inherit_cache.split(): 68 if not file in __inherit_cache:
70 bb.msg.debug(2, bb.msg.domain.Parsing, "BB %s:%d: inheriting %s" % (fn, lineno, file)) 69 bb.msg.debug(2, bb.msg.domain.Parsing, "BB %s:%d: inheriting %s" % (fn, lineno, file))
71 __inherit_cache += " %s" % file 70 __inherit_cache.append( file )
72 include(fn, file, d, "inherit") 71 include(fn, file, d, "inherit")
73 data.setVar('__inherit_cache', __inherit_cache, d) 72 data.setVar('__inherit_cache', __inherit_cache, d)
74 73
75 74
76def handle(fn, d, include = 0): 75def handle(fn, d, include = 0):
77 global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __infunc__, __body__, __bbpath_found__, __residue__ 76 global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __infunc__, __body__, __residue__
78 __body__ = [] 77 __body__ = []
79 __bbpath_found__ = 0
80 __infunc__ = "" 78 __infunc__ = ""
81 __classname__ = "" 79 __classname__ = ""
82 __residue__ = [] 80 __residue__ = []
@@ -104,7 +102,6 @@ def handle(fn, d, include = 0):
104 if not os.path.isabs(fn): 102 if not os.path.isabs(fn):
105 f = None 103 f = None
106 for p in bbpath: 104 for p in bbpath:
107 p = data.expand(p, d)
108 j = os.path.join(p, fn) 105 j = os.path.join(p, fn)
109 if os.access(j, os.R_OK): 106 if os.access(j, os.R_OK):
110 abs_fn = j 107 abs_fn = j
@@ -147,39 +144,35 @@ def handle(fn, d, include = 0):
147 data.expandKeys(d) 144 data.expandKeys(d)
148 data.update_data(d) 145 data.update_data(d)
149 anonqueue = data.getVar("__anonqueue", d, 1) or [] 146 anonqueue = data.getVar("__anonqueue", d, 1) or []
150 for anon in anonqueue: 147 body = [x['content'] for x in anonqueue]
151 data.setVar("__anonfunc", anon["content"], d) 148 flag = { 'python' : 1, 'func' : 1 }
152 data.setVarFlags("__anonfunc", anon["flags"], d) 149 data.setVar("__anonfunc", "\n".join(body), d)
153 from bb import build 150 data.setVarFlags("__anonfunc", flag, d)
154 try: 151 from bb import build
155 t = data.getVar('T', d) 152 try:
156 data.setVar('T', '${TMPDIR}/', d) 153 t = data.getVar('T', d)
157 build.exec_func("__anonfunc", d) 154 data.setVar('T', '${TMPDIR}/', d)
158 data.delVar('T', d) 155 build.exec_func("__anonfunc", d)
159 if t: 156 data.delVar('T', d)
160 data.setVar('T', t, d) 157 if t:
161 except Exception, e: 158 data.setVar('T', t, d)
162 bb.msg.debug(1, bb.msg.domain.Parsing, "executing anonymous function: %s" % e) 159 except Exception, e:
163 raise 160 bb.msg.debug(1, bb.msg.domain.Parsing, "executing anonymous function: %s" % e)
161 raise
164 data.delVar("__anonqueue", d) 162 data.delVar("__anonqueue", d)
165 data.delVar("__anonfunc", d) 163 data.delVar("__anonfunc", d)
166 set_additional_vars(fn, d, include) 164 set_additional_vars(fn, d, include)
167 data.update_data(d) 165 data.update_data(d)
168 166
169 all_handlers = {} 167 all_handlers = {}
170 for var in data.keys(d): 168 for var in data.getVar('__BBHANDLERS', d) or []:
171 # try to add the handler 169 # try to add the handler
172 # if we added it remember the choiche 170 # if we added it remember the choiche
173 if data.getVarFlag(var, 'handler', d): 171 handler = data.getVar(var,d)
174 handler = data.getVar(var,d) 172 if bb.event.register(var,handler) == bb.event.Registered:
175 if bb.event.register(var,handler) == bb.event.Registered: 173 all_handlers[var] = handler
176 all_handlers[var] = handler
177
178 continue
179
180 if not data.getVarFlag(var, 'task', d):
181 continue
182 174
175 for var in data.getVar('__BBTASKS', d) or []:
183 deps = data.getVarFlag(var, 'deps', d) or [] 176 deps = data.getVarFlag(var, 'deps', d) or []
184 postdeps = data.getVarFlag(var, 'postdeps', d) or [] 177 postdeps = data.getVarFlag(var, 'postdeps', d) or []
185 bb.build.add_task(var, deps, d) 178 bb.build.add_task(var, deps, d)
@@ -204,7 +197,7 @@ def handle(fn, d, include = 0):
204 return d 197 return d
205 198
206def feeder(lineno, s, fn, root, d): 199def feeder(lineno, s, fn, root, d):
207 global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __def_regexp__, __python_func_regexp__, __inpython__,__infunc__, __body__, __bbpath_found__, classes, bb, __residue__ 200 global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __def_regexp__, __python_func_regexp__, __inpython__,__infunc__, __body__, classes, bb, __residue__
208 if __infunc__: 201 if __infunc__:
209 if s == '}': 202 if s == '}':
210 __body__.append('') 203 __body__.append('')
@@ -336,6 +329,10 @@ def feeder(lineno, s, fn, root, d):
336 329
337 data.setVarFlag(var, "task", 1, d) 330 data.setVarFlag(var, "task", 1, d)
338 331
332 bbtasks = data.getVar('__BBTASKS', d) or []
333 bbtasks.append(var)
334 data.setVar('__BBTASKS', bbtasks, d)
335
339 if after is not None: 336 if after is not None:
340# set up deps for function 337# set up deps for function
341 data.setVarFlag(var, "deps", after.split(), d) 338 data.setVarFlag(var, "deps", after.split(), d)
@@ -348,8 +345,11 @@ def feeder(lineno, s, fn, root, d):
348 if m: 345 if m:
349 fns = m.group(1) 346 fns = m.group(1)
350 hs = __word__.findall(fns) 347 hs = __word__.findall(fns)
348 bbhands = data.getVar('__BBHANDLERS', d) or []
351 for h in hs: 349 for h in hs:
350 bbhands.append(h)
352 data.setVarFlag(h, "handler", 1, d) 351 data.setVarFlag(h, "handler", 1, d)
352 data.setVar('__BBHANDLERS', bbhands, d)
353 return 353 return
354 354
355 m = __inherit_regexp__.match(s) 355 m = __inherit_regexp__.match(s)
@@ -386,16 +386,11 @@ def set_additional_vars(file, d, include):
386 386
387 bb.msg.debug(2, bb.msg.domain.Parsing, "BB %s: set_additional_vars" % file) 387 bb.msg.debug(2, bb.msg.domain.Parsing, "BB %s: set_additional_vars" % file)
388 388
389 src_uri = data.getVar('SRC_URI', d) 389 src_uri = data.getVar('SRC_URI', d, 1)
390 if not src_uri: 390 if not src_uri:
391 return 391 return
392 src_uri = data.expand(src_uri, d)
393 392
394 a = data.getVar('A', d) 393 a = (data.getVar('A', d, 1) or '').split()
395 if a:
396 a = data.expand(a, d).split()
397 else:
398 a = []
399 394
400 from bb import fetch 395 from bb import fetch
401 try: 396 try: