diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2012-09-07 16:22:54 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-09-10 13:14:08 +0100 |
commit | 21816355c00eadb2273d61b456f06239ca300b47 (patch) | |
tree | e02423f9ae95bef7950a91335d769fe0ba86a135 /bitbake | |
parent | 4d8ba9a0ec0afc2d14042ac0e153827b65a7428d (diff) | |
download | poky-21816355c00eadb2273d61b456f06239ca300b47.tar.gz |
bitbake: cooker: fix handling of exceptions during exception handling
If an exception occurs during handling another exception we were
getting a useless traceback such as the following, after which
BitBake froze:
ERROR: Command execution failed: Traceback (most recent call last):
File "/home/user/poky/poky/bitbake/lib/bb/command.py", line 84, in runAsyncCommand
self.cooker.updateCache()
File "/home/user/poky/poky/bitbake/lib/bb/cooker.py", line 1207, in updateCache
if not self.parser.parse_next():
File "/home/user/poky/poky/bitbake/lib/bb/cooker.py", line 1694, in parse_next
logger.error('Unable to parse %s', value.recipe,
AttributeError: 'exceptions.TypeError' object has no attribute 'recipe'
Fix this to print an actual traceback of the exception and exit
gracefully (well, as gracefully as possible under the circumstances).
The general fix for [YOCTO #2977].
(Bitbake rev: 675b237a284dff84e972546774b69e2f89afb360)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/cooker.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 1b3bb84018..19173ae7ba 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -1691,8 +1691,13 @@ class CookerParser(object): | |||
1691 | except Exception as exc: | 1691 | except Exception as exc: |
1692 | self.error += 1 | 1692 | self.error += 1 |
1693 | etype, value, tb = sys.exc_info() | 1693 | etype, value, tb = sys.exc_info() |
1694 | logger.error('Unable to parse %s', value.recipe, | 1694 | if hasattr(value, "recipe"): |
1695 | exc_info=(etype, value, exc.traceback)) | 1695 | logger.error('Unable to parse %s', value.recipe, |
1696 | exc_info=(etype, value, exc.traceback)) | ||
1697 | else: | ||
1698 | # Most likely, an exception occurred during raising an exception | ||
1699 | import traceback | ||
1700 | logger.error('Exception during parse: %s' % traceback.format_exc()) | ||
1696 | self.shutdown(clean=False) | 1701 | self.shutdown(clean=False) |
1697 | return False | 1702 | return False |
1698 | 1703 | ||