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>
This commit is contained in:
Paul Eggleton 2017-03-20 17:16:20 +13:00 committed by Richard Purdie
parent 258f98a27c
commit 995b02b00c
1 changed files with 9 additions and 2 deletions

View File

@ -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