diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-08-27 14:24:52 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-08-28 15:12:45 +0100 |
commit | 669c07d6022174d01fe5a95b7b0faa9ef86da1e2 (patch) | |
tree | bfb56d13c73341aa1911602cef7b764978d72bf3 /bitbake/lib/bb/data.py | |
parent | 34226b82daaaefb2bc2defbe586f26413201bb26 (diff) | |
download | poky-669c07d6022174d01fe5a95b7b0faa9ef86da1e2.tar.gz |
bitbake: build/data: Write out more complete python run files
Currently the output in the python task/function run files is rather
incomplete and effectively useless. This enhances the code to take
advantage of the bitbake's dependency tracking and extend the output to
include dependencies. This makes the files more usable for debugging
purposes. Since this only happens at python function execution time, the
overhead is minimal in the grand scheme of things.
(Bitbake rev: 02667e048c3e632f857c87177c0022eaf5481802)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/data.py')
-rw-r--r-- | bitbake/lib/bb/data.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/bitbake/lib/bb/data.py b/bitbake/lib/bb/data.py index 3d776b32bf..91b1eb1298 100644 --- a/bitbake/lib/bb/data.py +++ b/bitbake/lib/bb/data.py | |||
@@ -281,6 +281,41 @@ def emit_func(func, o=sys.__stdout__, d = init()): | |||
281 | newdeps |= set((d.getVarFlag(dep, "vardeps", True) or "").split()) | 281 | newdeps |= set((d.getVarFlag(dep, "vardeps", True) or "").split()) |
282 | newdeps -= seen | 282 | newdeps -= seen |
283 | 283 | ||
284 | _functionfmt = """ | ||
285 | def {function}(d): | ||
286 | {body}""" | ||
287 | |||
288 | def emit_func_python(func, o=sys.__stdout__, d = init()): | ||
289 | """Emits all items in the data store in a format such that it can be sourced by a shell.""" | ||
290 | |||
291 | def write_func(func, o, call = False): | ||
292 | body = d.getVar(func, True) | ||
293 | if not body.startswith("def"): | ||
294 | body = _functionfmt.format(function=func, body=body) | ||
295 | |||
296 | o.write(body.strip() + "\n\n") | ||
297 | if call: | ||
298 | o.write(func + "(d)" + "\n\n") | ||
299 | |||
300 | write_func(func, o, True) | ||
301 | pp = bb.codeparser.PythonParser(func, logger) | ||
302 | pp.parse_python(d.getVar(func, True)) | ||
303 | newdeps = pp.execs | ||
304 | newdeps |= set((d.getVarFlag(func, "vardeps", True) or "").split()) | ||
305 | seen = set() | ||
306 | while newdeps: | ||
307 | deps = newdeps | ||
308 | seen |= deps | ||
309 | newdeps = set() | ||
310 | for dep in deps: | ||
311 | if d.getVarFlag(dep, "func") and d.getVarFlag(dep, "python"): | ||
312 | write_func(dep, o) | ||
313 | pp = bb.codeparser.PythonParser(dep, logger) | ||
314 | pp.parse_python(d.getVar(dep, True)) | ||
315 | newdeps |= pp.execs | ||
316 | newdeps |= set((d.getVarFlag(dep, "vardeps", True) or "").split()) | ||
317 | newdeps -= seen | ||
318 | |||
284 | def update_data(d): | 319 | def update_data(d): |
285 | """Performs final steps upon the datastore, including application of overrides""" | 320 | """Performs final steps upon the datastore, including application of overrides""" |
286 | d.finalize(parent = True) | 321 | d.finalize(parent = True) |