summaryrefslogtreecommitdiffstats
path: root/scripts/lib/devtool/sdk.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-01-23 00:59:52 +1300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-01-24 09:40:32 +0000
commitb435225e8af9481ab72b0a6b02b4c6835271152e (patch)
treec342b5abe42b9b3b5bffccb39c351c3ed2189088 /scripts/lib/devtool/sdk.py
parent44d1a2a45c4d92f331aef1a95adb6b12743d24cd (diff)
downloadpoky-b435225e8af9481ab72b0a6b02b4c6835271152e.tar.gz
devtool: add sdk-install subcommand
Add the ability to install additional pre-built items (from shared state) into the extensible SDK. This can already be done implicitly by adding something to DEPENDS within a recipe you're working on and then running "devtool build", but it's useful to be able to explicitly install things particularly if you're using the extensible SDK as a traditional toolchain. Note that for this command to be useful you need to have SSTATE_MIRRORS set in your SDK configuration, and that mirror needs to be populated with sstate artifacts for recipes you wish to be able to install. (From OE-Core rev: 3474a42954908d1688fd3a6cb600eed315b27833) 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/sdk.py')
-rw-r--r--scripts/lib/devtool/sdk.py63
1 files changed, 62 insertions, 1 deletions
diff --git a/scripts/lib/devtool/sdk.py b/scripts/lib/devtool/sdk.py
index 80ea8711cc..12de9423e7 100644
--- a/scripts/lib/devtool/sdk.py
+++ b/scripts/lib/devtool/sdk.py
@@ -8,7 +8,7 @@ import shutil
8import errno 8import errno
9import sys 9import sys
10import tempfile 10import tempfile
11from devtool import exec_build_env_command, setup_tinfoil, DevtoolError 11from devtool import exec_build_env_command, setup_tinfoil, parse_recipe, DevtoolError
12 12
13logger = logging.getLogger('devtool') 13logger = logging.getLogger('devtool')
14 14
@@ -235,6 +235,64 @@ def sdk_update(args, config, basepath, workspace):
235 return -1 235 return -1
236 return 0 236 return 0
237 237
238def sdk_install(args, config, basepath, workspace):
239 """Entry point for the devtool sdk-install command"""
240
241 import oe.recipeutils
242 import bb.process
243
244 for recipe in args.recipename:
245 if recipe in workspace:
246 raise DevtoolError('recipe %s is a recipe in your workspace' % recipe)
247
248 tasks = ['do_populate_sysroot', 'do_packagedata']
249 stampprefixes = {}
250 def checkstamp(recipe):
251 stampprefix = stampprefixes[recipe]
252 stamps = glob.glob(stampprefix + '*')
253 for stamp in stamps:
254 if '.sigdata.' not in stamp and stamp.startswith((stampprefix + '.', stampprefix + '_setscene.')):
255 return True
256 else:
257 return False
258
259 install_recipes = []
260 tinfoil = setup_tinfoil(config_only=False, basepath=basepath)
261 try:
262 for recipe in args.recipename:
263 rd = parse_recipe(config, tinfoil, recipe, True)
264 if not rd:
265 return 1
266 stampprefixes[recipe] = '%s.%s' % (rd.getVar('STAMP', True), tasks[0])
267 if checkstamp(recipe):
268 logger.info('%s is already installed' % recipe)
269 else:
270 install_recipes.append(recipe)
271 finally:
272 tinfoil.shutdown()
273
274 if install_recipes:
275 logger.info('Installing %s...' % ', '.join(install_recipes))
276 install_tasks = []
277 for recipe in install_recipes:
278 for task in tasks:
279 if recipe.endswith('-native') and 'package' in task:
280 continue
281 install_tasks.append('%s:%s' % (recipe, task))
282 try:
283 exec_build_env_command(config.init_path, basepath, 'bitbake --setscene-only %s' % ' '.join(install_tasks))
284 except bb.process.ExecutionError as e:
285 raise DevtoolError('Failed to install %s:\n%s' % (recipe, str(e)))
286 failed = False
287 for recipe in install_recipes:
288 if checkstamp(recipe):
289 logger.info('Successfully installed %s' % recipe)
290 else:
291 raise DevtoolError('Failed to install %s - unavailable' % recipe)
292 failed = True
293 if failed:
294 return 2
295
238def register_commands(subparsers, context): 296def register_commands(subparsers, context):
239 """Register devtool subcommands from the sdk plugin""" 297 """Register devtool subcommands from the sdk plugin"""
240 if context.fixed_setup: 298 if context.fixed_setup:
@@ -242,3 +300,6 @@ def register_commands(subparsers, context):
242 parser_sdk.add_argument('updateserver', help='The update server to fetch latest SDK components from', nargs='?') 300 parser_sdk.add_argument('updateserver', help='The update server to fetch latest SDK components from', nargs='?')
243 parser_sdk.add_argument('--skip-prepare', action="store_true", help='Skip re-preparing the build system after updating (for debugging only)') 301 parser_sdk.add_argument('--skip-prepare', action="store_true", help='Skip re-preparing the build system after updating (for debugging only)')
244 parser_sdk.set_defaults(func=sdk_update) 302 parser_sdk.set_defaults(func=sdk_update)
303 parser_sdk_install = subparsers.add_parser('sdk-install', help='Install additional SDK components', description='Installs additional recipe development files into the SDK. (You can use "devtool search" to find available recipes.)')
304 parser_sdk_install.add_argument('recipename', help='Name of the recipe to install the development artifacts for', nargs='+')
305 parser_sdk_install.set_defaults(func=sdk_install)