diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-08-05 13:24:29 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-08-06 06:34:58 +0100 |
| commit | 5a4501abeb1005c2cacc84cdd6d2b4f3fcbe188f (patch) | |
| tree | f5199b47d269402a52ede5a1725b79fc706063cb | |
| parent | dc7ef0f896ff7abeb2296fa420ba5219b9455959 (diff) | |
| download | poky-5a4501abeb1005c2cacc84cdd6d2b4f3fcbe188f.tar.gz | |
bitbake: command: Ensure we catch/handle exceptions
If an exception occurs in early setup, bitbake could just hang. Return
the exception rather than doing that.
[YOCTO #14408]
(Bitbake rev: c8a4107132ce51f84ae84bf1ceb1c3fd90f156d3)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | bitbake/lib/bb/command.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py index f530cf844b..a81dcb1366 100644 --- a/bitbake/lib/bb/command.py +++ b/bitbake/lib/bb/command.py | |||
| @@ -65,9 +65,17 @@ class Command: | |||
| 65 | 65 | ||
| 66 | # Ensure cooker is ready for commands | 66 | # Ensure cooker is ready for commands |
| 67 | if command != "updateConfig" and command != "setFeatures": | 67 | if command != "updateConfig" and command != "setFeatures": |
| 68 | self.cooker.init_configdata() | 68 | try: |
| 69 | if not self.remotedatastores: | 69 | self.cooker.init_configdata() |
| 70 | self.remotedatastores = bb.remotedata.RemoteDatastores(self.cooker) | 70 | if not self.remotedatastores: |
| 71 | self.remotedatastores = bb.remotedata.RemoteDatastores(self.cooker) | ||
| 72 | except (Exception, SystemExit) as exc: | ||
| 73 | import traceback | ||
| 74 | if isinstance(exc, bb.BBHandledException): | ||
| 75 | # We need to start returning real exceptions here. Until we do, we can't | ||
| 76 | # tell if an exception is an instance of bb.BBHandledException | ||
| 77 | return None, "bb.BBHandledException()\n" + traceback.format_exc() | ||
| 78 | return None, traceback.format_exc() | ||
| 71 | 79 | ||
| 72 | if hasattr(CommandsSync, command): | 80 | if hasattr(CommandsSync, command): |
| 73 | # Can run synchronous commands straight away | 81 | # Can run synchronous commands straight away |
