summaryrefslogtreecommitdiffstats
path: root/scripts/lib
diff options
context:
space:
mode:
authorChang Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com>2017-06-28 09:59:19 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-07-21 22:51:37 +0100
commit819179d775ca084bcec6a86cd74d0c0c18278f12 (patch)
tree65c92f735396d628d6f2d833f8520f6ac4a21970 /scripts/lib
parent5778e35378dfa76958239f9a0ecb71ed90c16225 (diff)
downloadpoky-819179d775ca084bcec6a86cd74d0c0c18278f12.tar.gz
devtool: find-recipe: enable new subcommand for devtool
devtool find-recipe will prints out the path to the recipe in a workspace. This subcommand can also help to find recipe outside of current workspace using "-a" or "--any-recipe" option. This enhancement helps developer to get the recipe path when working with devtool. [YOCTO #11434] (From OE-Core rev: 5a16b3c804c5eca331a1c08a7ce31a54909af105) Signed-off-by: Chang Rebecca Swee Fun <rebecca.swee.fun.chang@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.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/scripts/lib/devtool/utilcmds.py b/scripts/lib/devtool/utilcmds.py
index 938d88afc0..c8cb760e4b 100644
--- a/scripts/lib/devtool/utilcmds.py
+++ b/scripts/lib/devtool/utilcmds.py
@@ -30,9 +30,8 @@ from devtool import parse_recipe
30 30
31logger = logging.getLogger('devtool') 31logger = logging.getLogger('devtool')
32 32
33 33def find_recipe(args, config, basepath, workspace):
34def edit_recipe(args, config, basepath, workspace): 34 """Entry point for the devtool 'find-recipe' subcommand"""
35 """Entry point for the devtool 'edit-recipe' subcommand"""
36 if args.any_recipe: 35 if args.any_recipe:
37 tinfoil = setup_tinfoil(config_only=False, basepath=basepath) 36 tinfoil = setup_tinfoil(config_only=False, basepath=basepath)
38 try: 37 try:
@@ -49,7 +48,10 @@ def edit_recipe(args, config, basepath, workspace):
49 raise DevtoolError("Recipe file for %s is not under the workspace" % 48 raise DevtoolError("Recipe file for %s is not under the workspace" %
50 args.recipename) 49 args.recipename)
51 50
52 return scriptutils.run_editor(recipefile, logger) 51
52def edit_recipe(args, config, basepath, workspace):
53 """Entry point for the devtool 'edit-recipe' subcommand"""
54 return scriptutils.run_editor(find_recipe(args, config, basepath, workspace), logger)
53 55
54 56
55def configure_help(args, config, basepath, workspace): 57def configure_help(args, config, basepath, workspace):
@@ -220,6 +222,14 @@ def register_commands(subparsers, context):
220 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') 222 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')
221 parser_edit_recipe.set_defaults(func=edit_recipe) 223 parser_edit_recipe.set_defaults(func=edit_recipe)
222 224
225 # Find-recipe
226 parser_find_recipe = subparsers.add_parser('find-recipe', help='Find a recipe file in your workspace',
227 description='By default, this will find a recipe file in your workspace; you can override this with the -a/--any-recipe option.',
228 group='working')
229 parser_find_recipe.add_argument('recipename', help='Recipe to find')
230 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')
231 parser_find_recipe.set_defaults(func=find_recipe)
232
223 # NOTE: Needed to override the usage string here since the default 233 # NOTE: Needed to override the usage string here since the default
224 # gets the order wrong - recipename must come before --arg 234 # gets the order wrong - recipename must come before --arg
225 parser_configure_help = subparsers.add_parser('configure-help', help='Get help on configure script options', 235 parser_configure_help = subparsers.add_parser('configure-help', help='Get help on configure script options',