aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Larson <kergoth@gmail.com>2015-06-25 11:35:41 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-07-27 12:28:12 +0100
commit5753f20acc31d4d8d93069e3daccce1fad27b7ac (patch)
tree1aa6fe87ba293537c7bbda018cf1f9d986e96e8f
parentc6feb6e97c9929560b1e3cec280c1d7976ecc030 (diff)
downloadopenembedded-core-contrib-5753f20acc31d4d8d93069e3daccce1fad27b7ac.tar.gz
openembedded-core-contrib-5753f20acc31d4d8d93069e3daccce1fad27b7ac.tar.bz2
openembedded-core-contrib-5753f20acc31d4d8d93069e3daccce1fad27b7ac.zip
recipetool: also load plugins from BBPATH
This makes it easier to extend, as a layer can add its own sub-commands. The bitbake path setup is moved earlier, as it has to be done before tinfoil_init. [YOCTO #7625] Signed-off-by: Christopher Larson <kergoth@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
-rwxr-xr-xscripts/recipetool31
1 files changed, 18 insertions, 13 deletions
diff --git a/scripts/recipetool b/scripts/recipetool
index 3063cf7c432..37c2dd31f49 100755
--- a/scripts/recipetool
+++ b/scripts/recipetool
@@ -36,11 +36,8 @@ def tinfoil_init(parserecipes):
import logging
tinfoil = bb.tinfoil.Tinfoil()
tinfoil.prepare(not parserecipes)
-
- for plugin in plugins:
- if hasattr(plugin, 'tinfoil_init'):
- plugin.tinfoil_init(tinfoil)
tinfoil.logger.setLevel(logger.getEffectiveLevel())
+ return tinfoil
def main():
@@ -55,12 +52,26 @@ def main():
parser.add_argument('--color', choices=['auto', 'always', 'never'], default='auto', help='Colorize output (where %(metavar)s is %(choices)s)', metavar='COLOR')
subparsers = parser.add_subparsers(title='subcommands', metavar='<subcommand>')
- scriptutils.load_plugins(logger, plugins, os.path.join(scripts_path, 'lib', 'recipetool'))
+ import scriptpath
+ bitbakepath = scriptpath.add_bitbake_lib_path()
+ if not bitbakepath:
+ 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)
+
+ 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_command'):
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?")
@@ -73,17 +84,11 @@ def main():
elif args.quiet:
logger.setLevel(logging.ERROR)
- import scriptpath
- bitbakepath = scriptpath.add_bitbake_lib_path()
- if not bitbakepath:
- 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)
-
scriptutils.logger_setup_color(logger, args.color)
try:
- tinfoil_init(getattr(args, 'parserecipes', False))
+ if getattr(args, 'parserecipes', False):
+ tinfoil.parseRecipes()
ret = args.func(args)
except bb.BBHandledException:
ret = 1