bitbake: bb.cookerdata: include useful traceback for ExpansionError/ParseError

Show the user only the portion of the traceback which was from the metadata,
nothing from bitbake's internal calls.

(Bitbake rev: c45054aef03393fa0bf70e853ddcfc55988493cf)

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Christopher Larson 2015-08-24 15:32:00 -07:00 committed by Richard Purdie
parent 5fe590cd6e
commit 7c4fdb8c17
1 changed files with 10 additions and 1 deletions

View File

@ -180,7 +180,16 @@ def catch_parse_error(func):
parselog.critical("Unable to parse %s: %s" % (fn, exc))
sys.exit(1)
except (bb.parse.ParseError, bb.data_smart.ExpansionError) as exc:
parselog.critical("Unable to parse %s: %s" % (fn, exc))
import traceback
bbdir = os.path.dirname(__file__) + os.sep
exc_class, exc, tb = sys.exc_info()
for tb in iter(lambda: tb.tb_next, None):
# Skip frames in bitbake itself, we only want the metadata
fn, _, _, _ = traceback.extract_tb(tb, 1)[0]
if not fn.startswith(bbdir):
break
parselog.critical("Unable to parse %s", fn, exc_info=(exc_class, exc, tb))
sys.exit(1)
return wrapped