summaryrefslogtreecommitdiffstats
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-08 09:19:34 +0100
commitf664ecb910fdcc20aa9d3db6f5402e9008a5dd13 (patch)
tree6e08f2bda253169a5a7415df6d4a5bd45ad3fef7
parent1752a4766443388a8cf372d2c5eddfe2ef1fe899 (diff)
downloadpoky-f664ecb910fdcc20aa9d3db6f5402e9008a5dd13.tar.gz
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 <chris.laplante@agilent.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/data.py6
1 files changed, 6 insertions, 0 deletions
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):
161 return True 161 return True
162 162
163 if func: 163 if func:
164 # Write a comment indicating where the shell function came from (line number and filename) to make it easier
165 # for the user to diagnose task failures. This comment is also used by build.py to determine the metadata
166 # location of shell functions.
167 o.write("# line: {0}, file: {1}\n".format(
168 d.getVarFlag(var, "lineno", False),
169 d.getVarFlag(var, "filename", False)))
164 # NOTE: should probably check for unbalanced {} within the var 170 # NOTE: should probably check for unbalanced {} within the var
165 val = val.rstrip('\n') 171 val = val.rstrip('\n')
166 o.write("%s() {\n%s\n}\n" % (varExpanded, val)) 172 o.write("%s() {\n%s\n}\n" % (varExpanded, val))