summaryrefslogtreecommitdiffstats
path: root/scripts/recipetool
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/recipetool')
-rwxr-xr-xscripts/recipetool78
1 files changed, 36 insertions, 42 deletions
diff --git a/scripts/recipetool b/scripts/recipetool
index 17233d4ef0..e2d585d2c5 100755
--- a/scripts/recipetool
+++ b/scripts/recipetool
@@ -4,18 +4,8 @@
#
# Copyright (C) 2014 Intel Corporation
#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
+# SPDX-License-Identifier: GPL-2.0-only
#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import sys
import os
@@ -36,8 +26,8 @@ def tinfoil_init(parserecipes):
import bb.tinfoil
import logging
tinfoil = bb.tinfoil.Tinfoil(tracking=True)
- tinfoil.prepare(not parserecipes)
tinfoil.logger.setLevel(logger.getEffectiveLevel())
+ tinfoil.prepare(not parserecipes)
return tinfoil
def main():
@@ -73,41 +63,45 @@ def main():
logger.error("Unable to find bitbake by searching parent directory of this script or PATH")
sys.exit(1)
logger.debug('Found bitbake path: %s' % bitbakepath)
+ scriptpath.add_oe_lib_path()
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 (tinfoil.config_data.getVar('BBPATH').split(':')
+ + [scripts_path]):
+ 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