diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2015-09-22 17:21:37 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-09-23 09:53:19 +0100 |
commit | ef197f9b998c6e54f21af8729dcd953fbd6c7e40 (patch) | |
tree | dafdaa98ca9eb87a770be8f1b701da01c682f321 /scripts | |
parent | 8f67bb79901698991b41aac8e2f5fe00c03563bd (diff) | |
download | poky-ef197f9b998c6e54f21af8729dcd953fbd6c7e40.tar.gz |
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
(From OE-Core rev: 8884875aacfedc69cc72898684e391e69fea00ba)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lib/devtool/build-image.py | 26 |
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 | |||
21 | import logging | 21 | import logging |
22 | 22 | ||
23 | from bb.process import ExecutionError | 23 | from bb.process import ExecutionError |
24 | from devtool import exec_build_env_command, setup_tinfoil, parse_recipe | 24 | from devtool import exec_build_env_command, setup_tinfoil, parse_recipe, DevtoolError |
25 | 25 | ||
26 | logger = logging.getLogger('devtool') | 26 | logger = logging.getLogger('devtool') |
27 | 27 | ||
@@ -40,7 +40,17 @@ def _get_packages(tinfoil, workspace, config): | |||
40 | 40 | ||
41 | def build_image(args, config, basepath, workspace): | 41 | def build_image(args, config, basepath, workspace): |
42 | """Entry point for the devtool 'build-image' subcommand.""" | 42 | """Entry point for the devtool 'build-image' subcommand.""" |
43 | image = args.recipe | 43 | |
44 | image = args.imagename | ||
45 | auto_image = False | ||
46 | if not image: | ||
47 | sdk_targets = config.get('SDK', 'sdk_targets', '').split() | ||
48 | if sdk_targets: | ||
49 | image = sdk_targets[0] | ||
50 | auto_image = True | ||
51 | if not image: | ||
52 | raise DevtoolError('Unable to determine image to build, please specify one') | ||
53 | |||
44 | appendfile = os.path.join(config.workspace_path, 'appends', | 54 | appendfile = os.path.join(config.workspace_path, 'appends', |
45 | '%s.bbappend' % image) | 55 | '%s.bbappend' % image) |
46 | 56 | ||
@@ -50,6 +60,16 @@ def build_image(args, config, basepath, workspace): | |||
50 | os.unlink(appendfile) | 60 | os.unlink(appendfile) |
51 | 61 | ||
52 | tinfoil = setup_tinfoil() | 62 | tinfoil = setup_tinfoil() |
63 | rd = parse_recipe(config, tinfoil, image, True) | ||
64 | if not rd: | ||
65 | # Error already shown | ||
66 | return 1 | ||
67 | if not bb.data.inherits_class('image', rd): | ||
68 | if auto_image: | ||
69 | raise DevtoolError('Unable to determine image to build, please specify one') | ||
70 | else: | ||
71 | raise DevtoolError('Specified recipe %s is not an image recipe' % image) | ||
72 | |||
53 | if workspace: | 73 | if workspace: |
54 | packages = _get_packages(tinfoil, workspace, config) | 74 | packages = _get_packages(tinfoil, workspace, config) |
55 | if packages: | 75 | if packages: |
@@ -94,5 +114,5 @@ def register_commands(subparsers, context): | |||
94 | help='Build image including workspace recipe packages', | 114 | help='Build image including workspace recipe packages', |
95 | description='Builds an image, extending it to include ' | 115 | description='Builds an image, extending it to include ' |
96 | 'packages from recipes in the workspace') | 116 | 'packages from recipes in the workspace') |
97 | parser.add_argument('recipe', help='Image recipe to build') | 117 | parser.add_argument('imagename', help='Image recipe to build', nargs='?') |
98 | parser.set_defaults(func=build_image) | 118 | parser.set_defaults(func=build_image) |