summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
21import logging 21import logging
22 22
23from bb.process import ExecutionError 23from bb.process import ExecutionError
24from devtool import exec_build_env_command 24from devtool import exec_build_env_command, setup_tinfoil, parse_recipe
25 25
26logger = logging.getLogger('devtool') 26logger = logging.getLogger('devtool')
27 27
@@ -29,14 +29,31 @@ def plugin_init(pluginlist):
29 """Plugin initialization""" 29 """Plugin initialization"""
30 pass 30 pass
31 31
32def _get_recipes(workspace, config):
33 """Get list of target recipes from the workspace."""
34 result = []
35 tinfoil = setup_tinfoil()
36 for recipe in workspace:
37 data = parse_recipe(config, tinfoil, recipe, True)
38 if 'class-target' in data.getVar('OVERRIDES', True).split(':'):
39 if recipe in data.getVar('PACKAGES', True):
40 result.append(recipe)
41 else:
42 logger.warning("Skipping recipe %s as it doesn't produce "
43 "package with the same name", recipe)
44 tinfoil.shutdown()
45 return result
46
32def build_image(args, config, basepath, workspace): 47def build_image(args, config, basepath, workspace):
33 """Entry point for the devtool 'build-image' subcommand.""" 48 """Entry point for the devtool 'build-image' subcommand."""
34 image = args.recipe 49 image = args.recipe
35 appendfile = os.path.join(config.workspace_path, 'appends', 50 appendfile = os.path.join(config.workspace_path, 'appends',
36 '%s.bbappend' % image) 51 '%s.bbappend' % image)
37 with open(appendfile, 'w') as afile: 52
38 afile.write('IMAGE_INSTALL_append = " %s"\n' % \ 53 recipes = _get_recipes(workspace, config)
39 ' '.join(workspace.keys())) 54 if recipes:
55 with open(appendfile, 'w') as afile:
56 afile.write('IMAGE_INSTALL_append = " %s"\n' % ' '.join(recipes))
40 57
41 try: 58 try:
42 exec_build_env_command(config.init_path, basepath, 59 exec_build_env_command(config.init_path, basepath,