mirror of
https://git.yoctoproject.org/poky
synced 2026-05-07 16:59:22 +00:00
scripts: ensure tinfoil is shut down correctly
We should always shut down tinfoil when we're finished with it, either
by explicitly calling the shutdown() method or by using it as a
context manager ("with ...").
(From OE-Core rev: 5ec6d9ef309b841cdcbf1d14ac678d106d5d888a)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
f2854c67ce
commit
e616beba1c
+33
-30
@@ -77,37 +77,40 @@ def main():
|
||||
scriptutils.logger_setup_color(logger, global_args.color)
|
||||
|
||||
tinfoil = tinfoil_init(False)
|
||||
for path in ([scripts_path] +
|
||||
tinfoil.config_data.getVar('BBPATH', True).split(':')):
|
||||
pluginpath = os.path.join(path, 'lib', 'recipetool')
|
||||
scriptutils.load_plugins(logger, plugins, pluginpath)
|
||||
|
||||
registered = False
|
||||
for plugin in plugins:
|
||||
if hasattr(plugin, 'register_commands'):
|
||||
registered = True
|
||||
plugin.register_commands(subparsers)
|
||||
elif hasattr(plugin, 'register_command'):
|
||||
# Legacy function name
|
||||
registered = True
|
||||
plugin.register_command(subparsers)
|
||||
if hasattr(plugin, 'tinfoil_init'):
|
||||
plugin.tinfoil_init(tinfoil)
|
||||
|
||||
if not registered:
|
||||
logger.error("No commands registered - missing plugins?")
|
||||
sys.exit(1)
|
||||
|
||||
args = parser.parse_args(unparsed_args, namespace=global_args)
|
||||
|
||||
try:
|
||||
if getattr(args, 'parserecipes', False):
|
||||
tinfoil.config_data.disableTracking()
|
||||
tinfoil.parseRecipes()
|
||||
tinfoil.config_data.enableTracking()
|
||||
ret = args.func(args)
|
||||
except bb.BBHandledException:
|
||||
ret = 1
|
||||
for path in ([scripts_path] +
|
||||
tinfoil.config_data.getVar('BBPATH', True).split(':')):
|
||||
pluginpath = os.path.join(path, 'lib', 'recipetool')
|
||||
scriptutils.load_plugins(logger, plugins, pluginpath)
|
||||
|
||||
registered = False
|
||||
for plugin in plugins:
|
||||
if hasattr(plugin, 'register_commands'):
|
||||
registered = True
|
||||
plugin.register_commands(subparsers)
|
||||
elif hasattr(plugin, 'register_command'):
|
||||
# Legacy function name
|
||||
registered = True
|
||||
plugin.register_command(subparsers)
|
||||
if hasattr(plugin, 'tinfoil_init'):
|
||||
plugin.tinfoil_init(tinfoil)
|
||||
|
||||
if not registered:
|
||||
logger.error("No commands registered - missing plugins?")
|
||||
sys.exit(1)
|
||||
|
||||
args = parser.parse_args(unparsed_args, namespace=global_args)
|
||||
|
||||
try:
|
||||
if getattr(args, 'parserecipes', False):
|
||||
tinfoil.config_data.disableTracking()
|
||||
tinfoil.parseRecipes()
|
||||
tinfoil.config_data.enableTracking()
|
||||
ret = args.func(args)
|
||||
except bb.BBHandledException:
|
||||
ret = 1
|
||||
finally:
|
||||
tinfoil.shutdown()
|
||||
|
||||
return ret
|
||||
|
||||
|
||||
Reference in New Issue
Block a user