summaryrefslogtreecommitdiffstats
path: root/scripts/lib/devtool
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2017-08-31 11:54:09 +1200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-08-31 23:30:02 +0100
commitdd5ceaefc0a782a5aecc5940bdb3b4a0551c7961 (patch)
tree0ad99990e5d850a6bac385d6fc8825dbf63f8bae /scripts/lib/devtool
parent69d50eb9ec2e8dc696aac13d0ffbf890fd4ce0e6 (diff)
downloadpoky-dd5ceaefc0a782a5aecc5940bdb3b4a0551c7961.tar.gz
devtool: edit-recipe: fix regression
OE-Core commit 5a16b3c804c5eca331a1c08a7ce31a54909af105 attempted to use the same function to get the path to a recipe as the new "find-recipe" command it implemented, except that cannot work because (a) it didn't return anything and (b) event if it had tried, a command function can only return an exit code and we don't want that for find-recipe if it succeeded. Split out a separate reusable function for both commands. (From OE-Core rev: d5191840212adbf480961ba6fc68e1ab17e5a77a) 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')
-rw-r--r--scripts/lib/devtool/utilcmds.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/scripts/lib/devtool/utilcmds.py b/scripts/lib/devtool/utilcmds.py
index c8cb760e4b..b74511643f 100644
--- a/scripts/lib/devtool/utilcmds.py
+++ b/scripts/lib/devtool/utilcmds.py
@@ -30,14 +30,13 @@ from devtool import parse_recipe
30 30
31logger = logging.getLogger('devtool') 31logger = logging.getLogger('devtool')
32 32
33def find_recipe(args, config, basepath, workspace): 33def _find_recipe_path(args, config, basepath, workspace):
34 """Entry point for the devtool 'find-recipe' subcommand"""
35 if args.any_recipe: 34 if args.any_recipe:
36 tinfoil = setup_tinfoil(config_only=False, basepath=basepath) 35 tinfoil = setup_tinfoil(config_only=False, basepath=basepath)
37 try: 36 try:
38 rd = parse_recipe(config, tinfoil, args.recipename, True) 37 rd = parse_recipe(config, tinfoil, args.recipename, True)
39 if not rd: 38 if not rd:
40 return 1 39 raise DevtoolError("Failed to find specified recipe")
41 recipefile = rd.getVar('FILE') 40 recipefile = rd.getVar('FILE')
42 finally: 41 finally:
43 tinfoil.shutdown() 42 tinfoil.shutdown()
@@ -47,11 +46,19 @@ def find_recipe(args, config, basepath, workspace):
47 if not recipefile: 46 if not recipefile:
48 raise DevtoolError("Recipe file for %s is not under the workspace" % 47 raise DevtoolError("Recipe file for %s is not under the workspace" %
49 args.recipename) 48 args.recipename)
49 return recipefile
50
51
52def find_recipe(args, config, basepath, workspace):
53 """Entry point for the devtool 'find-recipe' subcommand"""
54 recipefile = _find_recipe_path(args, config, basepath, workspace)
55 print(recipefile)
56 return 0
50 57
51 58
52def edit_recipe(args, config, basepath, workspace): 59def edit_recipe(args, config, basepath, workspace):
53 """Entry point for the devtool 'edit-recipe' subcommand""" 60 """Entry point for the devtool 'edit-recipe' subcommand"""
54 return scriptutils.run_editor(find_recipe(args, config, basepath, workspace), logger) 61 return scriptutils.run_editor(_find_recipe_path(args, config, basepath, workspace), logger)
55 62
56 63
57def configure_help(args, config, basepath, workspace): 64def configure_help(args, config, basepath, workspace):