aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Laplante <chris.laplante@agilent.com>2020-08-02 10:35:02 -0400
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-08-07 21:23:06 +0100
commit9747211cbb45401cbf4dd0409e9c80c648a178c6 (patch)
treea51666e10ef62672b996d6fbeaf0c2246264ba04
parentc472a8da521cc7f1d61ac2f28596167d47ab8a5a (diff)
downloadbitbake-9747211cbb45401cbf4dd0409e9c80c648a178c6.tar.gz
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] Signed-off-by: Chris Laplante <chris.laplante@agilent.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/bb/data.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/bb/data.py b/lib/bb/data.py
index b0683c518..97022853c 100644
--- a/lib/bb/data.py
+++ b/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))