From f664ecb910fdcc20aa9d3db6f5402e9008a5dd13 Mon Sep 17 00:00:00 2001 From: Chris Laplante Date: Sun, 2 Aug 2020 10:35:02 -0400 Subject: bitbake: data: emit filename/lineno information for shell functions Make it easier for users to debug shell task failure by including some breadcrumbs in the emitted .run file that (hopefully) points to the .bb/.bbclass file where the shell function was defined. Unfortunately this won't work with functions with _append or _prepends, since BitBake wipes the filename/lineno information. This shouldn't be too hard to fix; for now, you'll just see comments like this for such functions: [YOCTO #7877] (Bitbake rev: 9747211cbb45401cbf4dd0409e9c80c648a178c6) Signed-off-by: Chris Laplante Signed-off-by: Richard Purdie --- bitbake/lib/bb/data.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bitbake/lib/bb/data.py b/bitbake/lib/bb/data.py index b0683c5180..97022853ca 100644 --- a/bitbake/lib/bb/data.py +++ b/bitbake/lib/bb/data.py @@ -161,6 +161,12 @@ def emit_var(var, o=sys.__stdout__, d = init(), all=False): return True if func: + # Write a comment indicating where the shell function came from (line number and filename) to make it easier + # for the user to diagnose task failures. This comment is also used by build.py to determine the metadata + # location of shell functions. + o.write("# line: {0}, file: {1}\n".format( + d.getVarFlag(var, "lineno", False), + d.getVarFlag(var, "filename", False))) # NOTE: should probably check for unbalanced {} within the var val = val.rstrip('\n') o.write("%s() {\n%s\n}\n" % (varExpanded, val)) -- cgit v1.2.3-54-g00ecf