summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2011-05-05 16:55:33 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-06-08 20:38:24 +0100
commit1749a73669b9f119050c32253a00aa618af6abd1 (patch)
tree20fb100795faa4e34a2e3a7a058746d55385afcc /bitbake/lib
parent36d1dcef6566e601d6b38a420b4e8103474cf018 (diff)
downloadast2050-yocto-poky-1749a73669b9f119050c32253a00aa618af6abd1.zip
ast2050-yocto-poky-1749a73669b9f119050c32253a00aa618af6abd1.tar.gz
cooker: pass traceback back from parsing thread
Uses bb.exceptions to get a traceback back from the parsing thread to the main thread, where it is then formatted. Also enables 3 lines of context for the formatted traceback, and limits the number of entries displayed to 5. (Bitbake rev: 8c33f50eb68411c071c001331e0134aeb776953b) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/cooker.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index ef42f02..658a7b0 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -1129,7 +1129,9 @@ def parse_file(task):
try:
return True, bb.cache.Cache.parse(filename, appends, parse_file.cfg, caches_array)
except Exception, exc:
+ tb = sys.exc_info()[2]
exc.recipe = filename
+ exc.traceback = list(bb.exceptions.extract_traceback(tb, context=3))
raise exc
# Need to turn BaseExceptions into Exceptions here so we gracefully shutdown
# and for example a worker thread doesn't just exit on its own in response to
@@ -1219,9 +1221,14 @@ class CookerParser(object):
self.shutdown(clean=False)
bb.fatal('Error parsing %s: %s' %
(exc.recipe, bb.exceptions.to_string(exc.realexception)))
- except Exception as exc:
+ except Exception:
+ import traceback
+ etype, value, tb = sys.exc_info()
+ formatted = bb.exceptions.format_extracted(value.traceback, limit=5)
+ formatted.extend(traceback.format_exception_only(etype, value))
+
self.shutdown(clean=False)
- bb.fatal('Error parsing %s: %s' % (exc.recipe, exc))
+ bb.fatal('Error parsing %s:\n%s' % (value.recipe, ''.join(formatted)))
self.current += 1
self.virtuals += len(result)
OpenPOWER on IntegriCloud