Procházet zdrojové kódy

devtool: tidy up handling of parse failures

Since the tinfoil2 refactoring, if an error occurred during parsing, we
were showing a traceback and not correctly exiting (since we weren't
calling shutdown()). Fix both of these issues.

(From OE-Core rev: 18304036e1b513fd12c049dbf549ba75c503ed84)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Paul Eggleton před 8 roky
rodič
revize
995b02b00c
1 změnil soubory, kde provedl 9 přidání a 2 odebrání
  1. 9 2
      scripts/lib/devtool/__init__.py

+ 9 - 2
scripts/lib/devtool/__init__.py

@@ -114,8 +114,15 @@ def setup_tinfoil(config_only=False, basepath=None, tracking=False):
 
         import bb.tinfoil
         tinfoil = bb.tinfoil.Tinfoil(tracking=tracking)
-        tinfoil.prepare(config_only)
-        tinfoil.logger.setLevel(logger.getEffectiveLevel())
+        try:
+            tinfoil.prepare(config_only)
+            tinfoil.logger.setLevel(logger.getEffectiveLevel())
+        except bb.tinfoil.TinfoilUIException:
+            tinfoil.shutdown()
+            raise DevtoolError('Failed to start bitbake environment')
+        except:
+            tinfoil.shutdown()
+            raise
     finally:
         os.chdir(orig_cwd)
     return tinfoil