summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2015-09-22 17:21:37 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-09-22 18:13:00 +0100
commit8884875aacfedc69cc72898684e391e69fea00ba (patch)
tree2f28fd4302697db971f27107599c3cbb217a728a
parent9baf9fd7a53142a98c7f1cd49c7b001760af51f9 (diff)
downloadopenembedded-core-8884875aacfedc69cc72898684e391e69fea00ba.tar.gz
openembedded-core-8884875aacfedc69cc72898684e391e69fea00ba.tar.bz2
openembedded-core-8884875aacfedc69cc72898684e391e69fea00ba.zip
devtool: build-image: improve image recipe handling
* Make image optional for the extensible SDK (auto-determine it based on the targets the SDK was built for) * Check that specified recipe is in fact an image Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--scripts/lib/devtool/build-image.py26
1 files changed, 23 insertions, 3 deletions
diff --git a/scripts/lib/devtool/build-image.py b/scripts/lib/devtool/build-image.py
index 5759bece04..a6c7d81586 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, setup_tinfoil, parse_recipe
+from devtool import exec_build_env_command, setup_tinfoil, parse_recipe, DevtoolError
logger = logging.getLogger('devtool')
@@ -40,7 +40,17 @@ def _get_packages(tinfoil, workspace, config):
def build_image(args, config, basepath, workspace):
"""Entry point for the devtool 'build-image' subcommand."""
- image = args.recipe
+
+ image = args.imagename
+ auto_image = False
+ if not image:
+ sdk_targets = config.get('SDK', 'sdk_targets', '').split()
+ if sdk_targets:
+ image = sdk_targets[0]
+ auto_image = True
+ if not image:
+ raise DevtoolError('Unable to determine image to build, please specify one')
+
appendfile = os.path.join(config.workspace_path, 'appends',
'%s.bbappend' % image)
@@ -50,6 +60,16 @@ def build_image(args, config, basepath, workspace):
os.unlink(appendfile)
tinfoil = setup_tinfoil()
+ rd = parse_recipe(config, tinfoil, image, True)
+ if not rd:
+ # Error already shown
+ return 1
+ if not bb.data.inherits_class('image', rd):
+ if auto_image:
+ raise DevtoolError('Unable to determine image to build, please specify one')
+ else:
+ raise DevtoolError('Specified recipe %s is not an image recipe' % image)
+
if workspace:
packages = _get_packages(tinfoil, workspace, config)
if packages:
@@ -94,5 +114,5 @@ def register_commands(subparsers, context):
help='Build image including workspace recipe packages',
description='Builds an image, extending it to include '
'packages from recipes in the workspace')
- parser.add_argument('recipe', help='Image recipe to build')
+ parser.add_argument('imagename', help='Image recipe to build', nargs='?')
parser.set_defaults(func=build_image)