summaryrefslogtreecommitdiffstats
path: root/scripts/lib/devtool/build_sdk.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-03-02 23:44:21 +1300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-03-07 00:11:38 +0000
commit25d9c4e02a90b1fd8c6a2036d29fd2cf87eca098 (patch)
tree29242ee8c4d7a9a12d7da5f40080f17d511a15ec /scripts/lib/devtool/build_sdk.py
parent41eb36dc4ce7feece2f63c7cae80478f5376459e (diff)
downloadpoky-25d9c4e02a90b1fd8c6a2036d29fd2cf87eca098.tar.gz
devtool: add build-sdk subcommand
Add a build-sdk command which is only available within the extensible SDK that builds a derivative extensible SDK. The idea is recipes in the workspace become a part of the new SDK - for example, this allows taking a vendor provided SDK, adding a few libs and then producing a new SDK with those included. When normally building the extensible SDK, the workspace is excluded; here we need to copy into the new SDK (renaming it in the process); the recipes' task signatures become locked and thus the sources are no longer needed, so they are removed along with the workspace bbappends which would interfere with the locked signatures. Additionally we need to just copy the configuration files (i.e. local.conf and auto.conf) rather than filtering and appending to them since that work has already been done when constructing the original SDK. The extra sstate artifacts from workspace recipes are also determined and copied into the new SDK in minimal mode (on the assumption that you won't set up a new sstate mirror). This reuses some code from build-image, so that needed to be generalised to allow that. Implements [YOCTO #8892]. (From OE-Core rev: 59e207ff6dd4b50a8905e14bc9292cf2794f4e7a) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/devtool/build_sdk.py')
-rw-r--r--scripts/lib/devtool/build_sdk.py65
1 files changed, 65 insertions, 0 deletions
diff --git a/scripts/lib/devtool/build_sdk.py b/scripts/lib/devtool/build_sdk.py
new file mode 100644
index 0000000000..b89d65b0cb
--- /dev/null
+++ b/scripts/lib/devtool/build_sdk.py
@@ -0,0 +1,65 @@
1# Development tool - build-sdk command plugin
2#
3# Copyright (C) 2015-2016 Intel Corporation
4#
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License version 2 as
7# published by the Free Software Foundation.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License along
15# with this program; if not, write to the Free Software Foundation, Inc.,
16# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18import os
19import subprocess
20import logging
21import glob
22import shutil
23import errno
24import sys
25import tempfile
26from devtool import exec_build_env_command, setup_tinfoil, parse_recipe, DevtoolError
27from devtool import build_image
28
29logger = logging.getLogger('devtool')
30
31
32def build_sdk(args, config, basepath, workspace):
33 """Entry point for the devtool build-sdk command"""
34
35 sdk_targets = config.get('SDK', 'sdk_targets', '').split()
36 if sdk_targets:
37 image = sdk_targets[0]
38 else:
39 raise DevtoolError('Unable to determine image to build SDK for')
40
41 extra_append = ['SDK_DERIVATIVE = "1"']
42 try:
43 result, outputdir = build_image.build_image_task(config,
44 basepath,
45 workspace,
46 image,
47 task='populate_sdk_ext',
48 extra_append=extra_append)
49 except build_image.TargetNotImageError:
50 raise DevtoolError('Unable to determine image to build SDK for')
51
52 if result == 0:
53 logger.info('Successfully built SDK. You can find output files in %s'
54 % outputdir)
55 return result
56
57
58def register_commands(subparsers, context):
59 """Register devtool subcommands"""
60 if context.fixed_setup:
61 parser_build_sdk = subparsers.add_parser('build-sdk',
62 help='Build a derivative SDK of this one',
63 description='Builds an extensible SDK based upon this one and the items in your workspace',
64 group='advanced')
65 parser_build_sdk.set_defaults(func=build_sdk)