aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/lib/devtool/build-image.py
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2015-08-30 17:41:29 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-08-31 11:36:53 +0100
commitefe685711ae6f4beec06ba591c74140ce56b96af (patch)
tree3348979e3af1fc4695a90884def8941050f29f84 /scripts/lib/devtool/build-image.py
parent39714557dde70c4b1ce8d08c7e1d21fd39a1d1a6 (diff)
downloadopenembedded-core-contrib-efe685711ae6f4beec06ba591c74140ce56b96af.tar.gz
devtool: build-image: filter out recipes
Filtered out non-target recipes and recipes with recipe name != package name in build-image plugin. Isolated all logic of getting recipes in _get_recipes function. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Diffstat (limited to 'scripts/lib/devtool/build-image.py')
-rw-r--r--scripts/lib/devtool/build-image.py25
1 files changed, 21 insertions, 4 deletions
diff --git a/scripts/lib/devtool/build-image.py b/scripts/lib/devtool/build-image.py
index 708120a861..341ab28d8e 100644
--- a/scripts/lib/devtool/build-image.py
+++ b/scripts/lib/devtool/build-image.py
@@ -21,7 +21,7 @@ import os
import logging
from bb.process import ExecutionError
-from devtool import exec_build_env_command
+from devtool import exec_build_env_command, setup_tinfoil, parse_recipe
logger = logging.getLogger('devtool')
@@ -29,14 +29,31 @@ def plugin_init(pluginlist):
"""Plugin initialization"""
pass
+def _get_recipes(workspace, config):
+ """Get list of target recipes from the workspace."""
+ result = []
+ tinfoil = setup_tinfoil()
+ for recipe in workspace:
+ data = parse_recipe(config, tinfoil, recipe, True)
+ if 'class-target' in data.getVar('OVERRIDES', True).split(':'):
+ if recipe in data.getVar('PACKAGES', True):
+ result.append(recipe)
+ else:
+ logger.warning("Skipping recipe %s as it doesn't produce "
+ "package with the same name", recipe)
+ tinfoil.shutdown()
+ return result
+
def build_image(args, config, basepath, workspace):
"""Entry point for the devtool 'build-image' subcommand."""
image = args.recipe
appendfile = os.path.join(config.workspace_path, 'appends',
'%s.bbappend' % image)
- with open(appendfile, 'w') as afile:
- afile.write('IMAGE_INSTALL_append = " %s"\n' % \
- ' '.join(workspace.keys()))
+
+ recipes = _get_recipes(workspace, config)
+ if recipes:
+ with open(appendfile, 'w') as afile:
+ afile.write('IMAGE_INSTALL_append = " %s"\n' % ' '.join(recipes))
try:
exec_build_env_command(config.init_path, basepath,