summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/data.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/data.py')
-rw-r--r--bitbake/lib/bb/data.py35
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 = """
285def {function}(d):
286{body}"""
287
288def 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
284def update_data(d): 319def 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)