summaryrefslogtreecommitdiffstats
path: root/scripts/lib
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2017-09-29 14:22:17 +1300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-11-11 12:14:27 +0000
commit73a25acd20f3ebf77f93549ff50f80fca4649c9c (patch)
treea54fdf50e57f4c3d76a1b694da3b212aed7441b6 /scripts/lib
parent624a07a7665020f3c3e3d830d96bab41dfc8ec5e (diff)
downloadpoky-73a25acd20f3ebf77f93549ff50f80fca4649c9c.tar.gz
devtool: make find-recipe and edit-recipe always work with any recipe
After some reconsideration I think it's a bit annoying for users to be forced to use an option to work with recipes where the file isn't in the workspace, so let's just have these commands check the workspace first for the recipe, and if it isn't there then load the cache and get it that way. (From OE-Core rev: 46683c61069a386658676a79d797062404bf1140) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib')
-rw-r--r--scripts/lib/devtool/utilcmds.py26
1 files changed, 14 insertions, 12 deletions
diff --git a/scripts/lib/devtool/utilcmds.py b/scripts/lib/devtool/utilcmds.py
index b74511643f..7cd139fb8b 100644
--- a/scripts/lib/devtool/utilcmds.py
+++ b/scripts/lib/devtool/utilcmds.py
@@ -32,6 +32,12 @@ logger = logging.getLogger('devtool')
32 32
33def _find_recipe_path(args, config, basepath, workspace): 33def _find_recipe_path(args, config, basepath, workspace):
34 if args.any_recipe: 34 if args.any_recipe:
35 logger.warning('-a/--any-recipe option is now always active, and thus the option will be removed in a future release')
36 if args.recipename in workspace:
37 recipefile = workspace[args.recipename]['recipefile']
38 else:
39 recipefile = None
40 if not recipefile:
35 tinfoil = setup_tinfoil(config_only=False, basepath=basepath) 41 tinfoil = setup_tinfoil(config_only=False, basepath=basepath)
36 try: 42 try:
37 rd = parse_recipe(config, tinfoil, args.recipename, True) 43 rd = parse_recipe(config, tinfoil, args.recipename, True)
@@ -40,12 +46,6 @@ def _find_recipe_path(args, config, basepath, workspace):
40 recipefile = rd.getVar('FILE') 46 recipefile = rd.getVar('FILE')
41 finally: 47 finally:
42 tinfoil.shutdown() 48 tinfoil.shutdown()
43 else:
44 check_workspace_recipe(workspace, args.recipename)
45 recipefile = workspace[args.recipename]['recipefile']
46 if not recipefile:
47 raise DevtoolError("Recipe file for %s is not under the workspace" %
48 args.recipename)
49 return recipefile 49 return recipefile
50 50
51 51
@@ -222,19 +222,21 @@ The ./configure %s output for %s follows.
222 222
223def register_commands(subparsers, context): 223def register_commands(subparsers, context):
224 """Register devtool subcommands from this plugin""" 224 """Register devtool subcommands from this plugin"""
225 parser_edit_recipe = subparsers.add_parser('edit-recipe', help='Edit a recipe file in your workspace', 225 parser_edit_recipe = subparsers.add_parser('edit-recipe', help='Edit a recipe file',
226 description='Runs the default editor (as specified by the EDITOR variable) on the specified recipe. Note that the recipe file itself must be in the workspace (i.e. as a result of "devtool add" or "devtool upgrade"); you can override this with the -a/--any-recipe option.', 226 description='Runs the default editor (as specified by the EDITOR variable) on the specified recipe. Note that this will be quicker for recipes in the workspace as the cache does not need to be loaded in that case.',
227 group='working') 227 group='working')
228 parser_edit_recipe.add_argument('recipename', help='Recipe to edit') 228 parser_edit_recipe.add_argument('recipename', help='Recipe to edit')
229 parser_edit_recipe.add_argument('--any-recipe', '-a', action="store_true", help='Edit any recipe, not just where the recipe file itself is in the workspace') 229 # FIXME drop -a at some point in future
230 parser_edit_recipe.add_argument('--any-recipe', '-a', action="store_true", help='Does nothing (exists for backwards-compatibility)')
230 parser_edit_recipe.set_defaults(func=edit_recipe) 231 parser_edit_recipe.set_defaults(func=edit_recipe)
231 232
232 # Find-recipe 233 # Find-recipe
233 parser_find_recipe = subparsers.add_parser('find-recipe', help='Find a recipe file in your workspace', 234 parser_find_recipe = subparsers.add_parser('find-recipe', help='Find a recipe file',
234 description='By default, this will find a recipe file in your workspace; you can override this with the -a/--any-recipe option.', 235 description='Finds a recipe file. Note that this will be quicker for recipes in the workspace as the cache does not need to be loaded in that case.',
235 group='working') 236 group='working')
236 parser_find_recipe.add_argument('recipename', help='Recipe to find') 237 parser_find_recipe.add_argument('recipename', help='Recipe to find')
237 parser_find_recipe.add_argument('--any-recipe', '-a', action="store_true", help='Find any recipe, not just where the recipe file itself is in the workspace') 238 # FIXME drop -a at some point in future
239 parser_find_recipe.add_argument('--any-recipe', '-a', action="store_true", help='Does nothing (exists for backwards-compatibility)')
238 parser_find_recipe.set_defaults(func=find_recipe) 240 parser_find_recipe.set_defaults(func=find_recipe)
239 241
240 # NOTE: Needed to override the usage string here since the default 242 # NOTE: Needed to override the usage string here since the default