summaryrefslogtreecommitdiffstats
path: root/scripts/lib/devtool
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2015-05-27 17:59:09 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-06-18 09:14:06 +0100
commit07f76656d907a941f1bc18ad37599799b1ff271a (patch)
tree5ae551718b23fc267bbcfd1c3aaacdaedd36067b /scripts/lib/devtool
parent5648a7909f4f185d0ead1299b0bdc484ff1bb700 (diff)
downloadpoky-07f76656d907a941f1bc18ad37599799b1ff271a.tar.gz
devtool: use DevtoolError for error handling
Use DevtoolError exception more widely for handling error cases. This exception is now caught in the main script and raising it can be used to exit with an error. This hopefully simplifies error handling. The change also makes exit codes more consistent, always returning '1' when an error occurs. (From OE-Core rev: 2e4f1dcade7ccb581c7a390c32163ea3deeac6d5) Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/devtool')
-rw-r--r--scripts/lib/devtool/__init__.py6
-rw-r--r--scripts/lib/devtool/deploy.py31
-rw-r--r--scripts/lib/devtool/standard.py154
3 files changed, 92 insertions, 99 deletions
diff --git a/scripts/lib/devtool/__init__.py b/scripts/lib/devtool/__init__.py
index 9ec1ef6817..ea0b63e767 100644
--- a/scripts/lib/devtool/__init__.py
+++ b/scripts/lib/devtool/__init__.py
@@ -25,6 +25,12 @@ import logging
25 25
26logger = logging.getLogger('devtool') 26logger = logging.getLogger('devtool')
27 27
28
29class DevtoolError(Exception):
30 """Exception for handling devtool errors"""
31 pass
32
33
28def exec_build_env_command(init_path, builddir, cmd, watch=False, **options): 34def exec_build_env_command(init_path, builddir, cmd, watch=False, **options):
29 """Run a program in bitbake build context""" 35 """Run a program in bitbake build context"""
30 import bb 36 import bb
diff --git a/scripts/lib/devtool/deploy.py b/scripts/lib/devtool/deploy.py
index 92a3cb4cff..ca74a8e51d 100644
--- a/scripts/lib/devtool/deploy.py
+++ b/scripts/lib/devtool/deploy.py
@@ -19,7 +19,7 @@
19import os 19import os
20import subprocess 20import subprocess
21import logging 21import logging
22from devtool import exec_build_env_command, setup_tinfoil 22from devtool import exec_build_env_command, setup_tinfoil, DevtoolError
23 23
24logger = logging.getLogger('devtool') 24logger = logging.getLogger('devtool')
25 25
@@ -34,8 +34,8 @@ def deploy(args, config, basepath, workspace):
34 import oe.recipeutils 34 import oe.recipeutils
35 35
36 if not args.recipename in workspace: 36 if not args.recipename in workspace:
37 logger.error("no recipe named %s in your workspace" % args.recipename) 37 raise DevtoolError("no recipe named %s in your workspace" %
38 return -1 38 args.recipename)
39 try: 39 try:
40 host, destdir = args.target.split(':') 40 host, destdir = args.target.split(':')
41 except ValueError: 41 except ValueError:
@@ -50,12 +50,13 @@ def deploy(args, config, basepath, workspace):
50 try: 50 try:
51 rd = oe.recipeutils.parse_recipe_simple(tinfoil.cooker, args.recipename, tinfoil.config_data) 51 rd = oe.recipeutils.parse_recipe_simple(tinfoil.cooker, args.recipename, tinfoil.config_data)
52 except Exception as e: 52 except Exception as e:
53 logger.error('Exception parsing recipe %s: %s' % (args.recipename, e)) 53 raise DevtoolError('Exception parsing recipe %s: %s' %
54 return 2 54 (args.recipename, e))
55 recipe_outdir = rd.getVar('D', True) 55 recipe_outdir = rd.getVar('D', True)
56 if not os.path.exists(recipe_outdir) or not os.listdir(recipe_outdir): 56 if not os.path.exists(recipe_outdir) or not os.listdir(recipe_outdir):
57 logger.error('No files to deploy - have you built the %s recipe? If so, the install step has not installed any files.' % args.recipename) 57 raise DevtoolError('No files to deploy - have you built the %s '
58 return -1 58 'recipe? If so, the install step has not installed '
59 'any files.' % args.recipename)
59 60
60 if args.dry_run: 61 if args.dry_run:
61 print('Files to be deployed for %s on target %s:' % (args.recipename, args.target)) 62 print('Files to be deployed for %s on target %s:' % (args.recipename, args.target))
@@ -67,7 +68,7 @@ def deploy(args, config, basepath, workspace):
67 if os.path.exists(deploy_file): 68 if os.path.exists(deploy_file):
68 if undeploy(args, config, basepath, workspace): 69 if undeploy(args, config, basepath, workspace):
69 # Error already shown 70 # Error already shown
70 return -1 71 return 1
71 72
72 extraoptions = '' 73 extraoptions = ''
73 if args.no_host_check: 74 if args.no_host_check:
@@ -76,8 +77,8 @@ def deploy(args, config, basepath, workspace):
76 extraoptions += ' -q' 77 extraoptions += ' -q'
77 ret = subprocess.call('scp -r %s %s/* %s:%s' % (extraoptions, recipe_outdir, args.target, destdir), shell=True) 78 ret = subprocess.call('scp -r %s %s/* %s:%s' % (extraoptions, recipe_outdir, args.target, destdir), shell=True)
78 if ret != 0: 79 if ret != 0:
79 logger.error('Deploy failed - rerun with -s to get a complete error message') 80 raise DevtoolError('Deploy failed - rerun with -s to get a complete '
80 return ret 81 'error message')
81 82
82 logger.info('Successfully deployed %s' % recipe_outdir) 83 logger.info('Successfully deployed %s' % recipe_outdir)
83 84
@@ -99,8 +100,7 @@ def undeploy(args, config, basepath, workspace):
99 """Entry point for the devtool 'undeploy' subcommand""" 100 """Entry point for the devtool 'undeploy' subcommand"""
100 deploy_file = os.path.join(basepath, 'target_deploy', args.target, args.recipename + '.list') 101 deploy_file = os.path.join(basepath, 'target_deploy', args.target, args.recipename + '.list')
101 if not os.path.exists(deploy_file): 102 if not os.path.exists(deploy_file):
102 logger.error('%s has not been deployed' % args.recipename) 103 raise DevtoolError('%s has not been deployed' % args.recipename)
103 return -1
104 104
105 if args.dry_run: 105 if args.dry_run:
106 print('Previously deployed files to be un-deployed for %s on target %s:' % (args.recipename, args.target)) 106 print('Previously deployed files to be un-deployed for %s on target %s:' % (args.recipename, args.target))
@@ -117,15 +117,16 @@ def undeploy(args, config, basepath, workspace):
117 117
118 ret = subprocess.call("scp %s %s %s:/tmp" % (extraoptions, deploy_file, args.target), shell=True) 118 ret = subprocess.call("scp %s %s %s:/tmp" % (extraoptions, deploy_file, args.target), shell=True)
119 if ret != 0: 119 if ret != 0:
120 logger.error('Failed to copy file list to %s - rerun with -s to get a complete error message' % args.target) 120 raise DevtoolError('Failed to copy file list to %s - rerun with -s to '
121 return -1 121 'get a complete error message' % args.target)
122 122
123 ret = subprocess.call("ssh %s %s 'xargs -n1 rm -f </tmp/%s'" % (extraoptions, args.target, os.path.basename(deploy_file)), shell=True) 123 ret = subprocess.call("ssh %s %s 'xargs -n1 rm -f </tmp/%s'" % (extraoptions, args.target, os.path.basename(deploy_file)), shell=True)
124 if ret == 0: 124 if ret == 0:
125 logger.info('Successfully undeployed %s' % args.recipename) 125 logger.info('Successfully undeployed %s' % args.recipename)
126 os.remove(deploy_file) 126 os.remove(deploy_file)
127 else: 127 else:
128 logger.error('Undeploy failed - rerun with -s to get a complete error message') 128 raise DevtoolError('Undeploy failed - rerun with -s to get a complete '
129 'error message')
129 130
130 return ret 131 return ret
131 132
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index 14912a9454..4d3ff02be8 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -25,16 +25,11 @@ import logging
25import argparse 25import argparse
26import scriptutils 26import scriptutils
27import errno 27import errno
28from devtool import exec_build_env_command, setup_tinfoil 28from devtool import exec_build_env_command, setup_tinfoil, DevtoolError
29 29
30logger = logging.getLogger('devtool') 30logger = logging.getLogger('devtool')
31 31
32 32
33class DevtoolError(Exception):
34 """Exception for handling devtool errors"""
35 pass
36
37
38def plugin_init(pluginlist): 33def plugin_init(pluginlist):
39 """Plugin initialization""" 34 """Plugin initialization"""
40 pass 35 pass
@@ -46,26 +41,27 @@ def add(args, config, basepath, workspace):
46 import oe.recipeutils 41 import oe.recipeutils
47 42
48 if args.recipename in workspace: 43 if args.recipename in workspace:
49 logger.error("recipe %s is already in your workspace" % args.recipename) 44 raise DevtoolError("recipe %s is already in your workspace" %
50 return -1 45 args.recipename)
51 46
52 reason = oe.recipeutils.validate_pn(args.recipename) 47 reason = oe.recipeutils.validate_pn(args.recipename)
53 if reason: 48 if reason:
54 logger.error(reason) 49 raise DevtoolError(reason)
55 return -1
56 50
57 srctree = os.path.abspath(args.srctree) 51 srctree = os.path.abspath(args.srctree)
58 if os.path.exists(srctree): 52 if os.path.exists(srctree):
59 if args.fetch: 53 if args.fetch:
60 if not os.path.isdir(srctree): 54 if not os.path.isdir(srctree):
61 logger.error("Cannot fetch into source tree path %s as it exists and is not a directory" % srctree) 55 raise DevtoolError("Cannot fetch into source tree path %s as "
62 return 1 56 "it exists and is not a directory" %
57 srctree)
63 elif os.listdir(srctree): 58 elif os.listdir(srctree):
64 logger.error("Cannot fetch into source tree path %s as it already exists and is non-empty" % srctree) 59 raise DevtoolError("Cannot fetch into source tree path %s as "
65 return 1 60 "it already exists and is non-empty" %
61 srctree)
66 elif not args.fetch: 62 elif not args.fetch:
67 logger.error("Specified source tree %s could not be found" % srctree) 63 raise DevtoolError("Specified source tree %s could not be found" %
68 return 1 64 srctree)
69 65
70 appendpath = os.path.join(config.workspace_path, 'appends') 66 appendpath = os.path.join(config.workspace_path, 'appends')
71 if not os.path.exists(appendpath): 67 if not os.path.exists(appendpath):
@@ -76,8 +72,7 @@ def add(args, config, basepath, workspace):
76 rfv = None 72 rfv = None
77 if args.version: 73 if args.version:
78 if '_' in args.version or ' ' in args.version: 74 if '_' in args.version or ' ' in args.version:
79 logger.error('Invalid version string "%s"' % args.version) 75 raise DevtoolError('Invalid version string "%s"' % args.version)
80 return -1
81 rfv = args.version 76 rfv = args.version
82 if args.fetch: 77 if args.fetch:
83 if args.fetch.startswith('git://'): 78 if args.fetch.startswith('git://'):
@@ -107,8 +102,7 @@ def add(args, config, basepath, workspace):
107 stdout, _ = exec_build_env_command(config.init_path, basepath, 'recipetool --color=%s create -o %s "%s" %s' % (color, recipefile, source, extracmdopts)) 102 stdout, _ = exec_build_env_command(config.init_path, basepath, 'recipetool --color=%s create -o %s "%s" %s' % (color, recipefile, source, extracmdopts))
108 logger.info('Recipe %s has been automatically created; further editing may be required to make it fully functional' % recipefile) 103 logger.info('Recipe %s has been automatically created; further editing may be required to make it fully functional' % recipefile)
109 except bb.process.ExecutionError as e: 104 except bb.process.ExecutionError as e:
110 logger.error('Command \'%s\' failed:\n%s' % (e.command, e.stdout)) 105 raise DevtoolError('Command \'%s\' failed:\n%s' % (e.command, e.stdout))
111 return 1
112 106
113 _add_md5(config, args.recipename, recipefile) 107 _add_md5(config, args.recipename, recipefile)
114 108
@@ -134,35 +128,33 @@ def add(args, config, basepath, workspace):
134def _check_compatible_recipe(pn, d): 128def _check_compatible_recipe(pn, d):
135 """Check if the recipe is supported by devtool""" 129 """Check if the recipe is supported by devtool"""
136 if pn == 'perf': 130 if pn == 'perf':
137 logger.error("The perf recipe does not actually check out source and thus cannot be supported by this tool") 131 raise DevtoolError("The perf recipe does not actually check out "
138 return False 132 "source and thus cannot be supported by this tool")
139 133
140 if pn in ['kernel-devsrc', 'package-index'] or pn.startswith('gcc-source'): 134 if pn in ['kernel-devsrc', 'package-index'] or pn.startswith('gcc-source'):
141 logger.error("The %s recipe is not supported by this tool" % pn) 135 raise DevtoolError("The %s recipe is not supported by this tool" % pn)
142 return False
143 136
144 if bb.data.inherits_class('image', d): 137 if bb.data.inherits_class('image', d):
145 logger.error("The %s recipe is an image, and therefore is not supported by this tool" % pn) 138 raise DevtoolError("The %s recipe is an image, and therefore is not "
146 return False 139 "supported by this tool" % pn)
147 140
148 if bb.data.inherits_class('populate_sdk', d): 141 if bb.data.inherits_class('populate_sdk', d):
149 logger.error("The %s recipe is an SDK, and therefore is not supported by this tool" % pn) 142 raise DevtoolError("The %s recipe is an SDK, and therefore is not "
150 return False 143 "supported by this tool" % pn)
151 144
152 if bb.data.inherits_class('packagegroup', d): 145 if bb.data.inherits_class('packagegroup', d):
153 logger.error("The %s recipe is a packagegroup, and therefore is not supported by this tool" % pn) 146 raise DevtoolError("The %s recipe is a packagegroup, and therefore is "
154 return False 147 "not supported by this tool" % pn)
155 148
156 if bb.data.inherits_class('meta', d): 149 if bb.data.inherits_class('meta', d):
157 logger.error("The %s recipe is a meta-recipe, and therefore is not supported by this tool" % pn) 150 raise DevtoolError("The %s recipe is a meta-recipe, and therefore is "
158 return False 151 "not supported by this tool" % pn)
159 152
160 if bb.data.inherits_class('externalsrc', d) and d.getVar('EXTERNALSRC', True): 153 if bb.data.inherits_class('externalsrc', d) and d.getVar('EXTERNALSRC', True):
161 logger.error("externalsrc is currently enabled for the %s recipe. This prevents the normal do_patch task from working. You will need to disable this first." % pn) 154 raise DevtoolError("externalsrc is currently enabled for the %s "
162 return False 155 "recipe. This prevents the normal do_patch task "
163 156 "from working. You will need to disable this "
164 return True 157 "first." % pn)
165
166 158
167def _get_recipe_file(cooker, pn): 159def _get_recipe_file(cooker, pn):
168 """Find recipe file corresponding a package name""" 160 """Find recipe file corresponding a package name"""
@@ -209,14 +201,14 @@ def extract(args, config, basepath, workspace):
209 201
210 rd = _parse_recipe(config, tinfoil, args.recipename, True) 202 rd = _parse_recipe(config, tinfoil, args.recipename, True)
211 if not rd: 203 if not rd:
212 return -1 204 return 1
213 205
214 srctree = os.path.abspath(args.srctree) 206 srctree = os.path.abspath(args.srctree)
215 initial_rev = _extract_source(srctree, args.keep_temp, args.branch, rd) 207 initial_rev = _extract_source(srctree, args.keep_temp, args.branch, rd)
216 if initial_rev: 208 if initial_rev:
217 return 0 209 return 0
218 else: 210 else:
219 return -1 211 return 1
220 212
221class BbTaskExecutor(object): 213class BbTaskExecutor(object):
222 """Class for executing bitbake tasks for a recipe 214 """Class for executing bitbake tasks for a recipe
@@ -262,16 +254,15 @@ def _extract_source(srctree, keep_temp, devbranch, d):
262 254
263 pn = d.getVar('PN', True) 255 pn = d.getVar('PN', True)
264 256
265 if not _check_compatible_recipe(pn, d): 257 _check_compatible_recipe(pn, d)
266 return None
267 258
268 if os.path.exists(srctree): 259 if os.path.exists(srctree):
269 if not os.path.isdir(srctree): 260 if not os.path.isdir(srctree):
270 logger.error("output path %s exists and is not a directory" % srctree) 261 raise DevtoolError("output path %s exists and is not a directory" %
271 return None 262 srctree)
272 elif os.listdir(srctree): 263 elif os.listdir(srctree):
273 logger.error("output path %s already exists and is non-empty" % srctree) 264 raise DevtoolError("output path %s already exists and is "
274 return None 265 "non-empty" % srctree)
275 266
276 # Prepare for shutil.move later on 267 # Prepare for shutil.move later on
277 bb.utils.mkdirhier(srctree) 268 bb.utils.mkdirhier(srctree)
@@ -341,8 +332,8 @@ def _extract_source(srctree, keep_temp, devbranch, d):
341 initial_rev = stdout.rstrip() 332 initial_rev = stdout.rstrip()
342 else: 333 else:
343 if not os.listdir(srcsubdir): 334 if not os.listdir(srcsubdir):
344 logger.error("no source unpacked to S, perhaps the %s recipe doesn't use any source?" % pn) 335 raise DevtoolError("no source unpacked to S, perhaps the %s "
345 return None 336 "recipe doesn't use any source?" % pn)
346 337
347 if not os.path.exists(os.path.join(srcsubdir, '.git')): 338 if not os.path.exists(os.path.join(srcsubdir, '.git')):
348 bb.process.run('git init', cwd=srcsubdir) 339 bb.process.run('git init', cwd=srcsubdir)
@@ -423,22 +414,22 @@ def modify(args, config, basepath, workspace):
423 import oe.recipeutils 414 import oe.recipeutils
424 415
425 if args.recipename in workspace: 416 if args.recipename in workspace:
426 logger.error("recipe %s is already in your workspace" % args.recipename) 417 raise DevtoolError("recipe %s is already in your workspace" %
427 return -1 418 args.recipename)
428 419
429 if not args.extract and not os.path.isdir(args.srctree): 420 if not args.extract and not os.path.isdir(args.srctree):
430 logger.error("directory %s does not exist or not a directory (specify -x to extract source from recipe)" % args.srctree) 421 raise DevtoolError("directory %s does not exist or not a directory "
431 return -1 422 "(specify -x to extract source from recipe)" %
423 args.srctree)
432 424
433 tinfoil = setup_tinfoil() 425 tinfoil = setup_tinfoil()
434 426
435 rd = _parse_recipe(config, tinfoil, args.recipename, True) 427 rd = _parse_recipe(config, tinfoil, args.recipename, True)
436 if not rd: 428 if not rd:
437 return -1 429 return 1
438 recipefile = rd.getVar('FILE', True) 430 recipefile = rd.getVar('FILE', True)
439 431
440 if not _check_compatible_recipe(args.recipename, rd): 432 _check_compatible_recipe(args.recipename, rd)
441 return -1
442 433
443 initial_rev = None 434 initial_rev = None
444 commits = [] 435 commits = []
@@ -446,7 +437,7 @@ def modify(args, config, basepath, workspace):
446 if args.extract: 437 if args.extract:
447 initial_rev = _extract_source(args.srctree, False, args.branch, rd) 438 initial_rev = _extract_source(args.srctree, False, args.branch, rd)
448 if not initial_rev: 439 if not initial_rev:
449 return -1 440 return 1
450 # Get list of commits since this revision 441 # Get list of commits since this revision
451 (stdout, _) = bb.process.run('git rev-list --reverse %s..HEAD' % initial_rev, cwd=args.srctree) 442 (stdout, _) = bb.process.run('git rev-list --reverse %s..HEAD' % initial_rev, cwd=args.srctree)
452 commits = stdout.split() 443 commits = stdout.split()
@@ -758,22 +749,22 @@ def _update_recipe_patch(args, config, srctree, rd, config_data):
758def update_recipe(args, config, basepath, workspace): 749def update_recipe(args, config, basepath, workspace):
759 """Entry point for the devtool 'update-recipe' subcommand""" 750 """Entry point for the devtool 'update-recipe' subcommand"""
760 if not args.recipename in workspace: 751 if not args.recipename in workspace:
761 logger.error("no recipe named %s in your workspace" % args.recipename) 752 raise DevtoolError("no recipe named %s in your workspace" %
762 return -1 753 args.recipename)
763 754
764 if args.append: 755 if args.append:
765 if not os.path.exists(args.append): 756 if not os.path.exists(args.append):
766 logger.error('bbappend destination layer directory "%s" does not exist' % args.append) 757 raise DevtoolError('bbappend destination layer directory "%s" '
767 return 2 758 'does not exist' % args.append)
768 if not os.path.exists(os.path.join(args.append, 'conf', 'layer.conf')): 759 if not os.path.exists(os.path.join(args.append, 'conf', 'layer.conf')):
769 logger.error('conf/layer.conf not found in bbappend destination layer "%s"' % args.append) 760 raise DevtoolError('conf/layer.conf not found in bbappend '
770 return 2 761 'destination layer "%s"' % args.append)
771 762
772 tinfoil = setup_tinfoil() 763 tinfoil = setup_tinfoil()
773 764
774 rd = _parse_recipe(config, tinfoil, args.recipename, True) 765 rd = _parse_recipe(config, tinfoil, args.recipename, True)
775 if not rd: 766 if not rd:
776 return -1 767 return 1
777 768
778 orig_src_uri = rd.getVar('SRC_URI', False) or '' 769 orig_src_uri = rd.getVar('SRC_URI', False) or ''
779 if args.mode == 'auto': 770 if args.mode == 'auto':
@@ -786,17 +777,12 @@ def update_recipe(args, config, basepath, workspace):
786 777
787 srctree = workspace[args.recipename] 778 srctree = workspace[args.recipename]
788 779
789 try: 780 if mode == 'srcrev':
790 if mode == 'srcrev': 781 _update_recipe_srcrev(args, srctree, rd, tinfoil.config_data)
791 _update_recipe_srcrev(args, srctree, rd, tinfoil.config_data) 782 elif mode == 'patch':
792 elif mode == 'patch': 783 _update_recipe_patch(args, config, srctree, rd, tinfoil.config_data)
793 _update_recipe_patch(args, config, srctree, rd, 784 else:
794 tinfoil.config_data) 785 raise DevtoolError('update_recipe: invalid mode %s' % mode)
795 else:
796 raise DevtoolError('update_recipe: invalid mode %s' % mode)
797 except DevtoolError as err:
798 logger.error(err)
799 return 1
800 786
801 return 0 787 return 0
802 788
@@ -816,15 +802,13 @@ def reset(args, config, basepath, workspace):
816 import bb 802 import bb
817 if args.recipename: 803 if args.recipename:
818 if args.all: 804 if args.all:
819 logger.error("Recipe cannot be specified if -a/--all is used") 805 raise DevtoolError("Recipe cannot be specified if -a/--all is used")
820 return -1
821 elif not args.recipename in workspace: 806 elif not args.recipename in workspace:
822 logger.error("no recipe named %s in your workspace" % args.recipename) 807 raise DevtoolError("no recipe named %s in your workspace" %
823 return -1 808 args.recipename)
824 elif not args.all: 809 elif not args.all:
825 logger.error("Recipe must be specified, or specify -a/--all to reset all recipes") 810 raise DevtoolError("Recipe must be specified, or specify -a/--all to "
826 return -1 811 "reset all recipes")
827
828 if args.all: 812 if args.all:
829 recipes = workspace 813 recipes = workspace
830 else: 814 else:
@@ -836,8 +820,10 @@ def reset(args, config, basepath, workspace):
836 try: 820 try:
837 exec_build_env_command(config.init_path, basepath, 'bitbake -c clean %s' % pn) 821 exec_build_env_command(config.init_path, basepath, 'bitbake -c clean %s' % pn)
838 except bb.process.ExecutionError as e: 822 except bb.process.ExecutionError as e:
839 logger.error('Command \'%s\' failed, output:\n%s\nIf you wish, you may specify -n/--no-clean to skip running this command when resetting' % (e.command, e.stdout)) 823 raise DevtoolError('Command \'%s\' failed, output:\n%s\nIf you '
840 return 1 824 'wish, you may specify -n/--no-clean to '
825 'skip running this command when resetting' %
826 (e.command, e.stdout))
841 827
842 _check_preserve(config, pn) 828 _check_preserve(config, pn)
843 829
@@ -861,8 +847,8 @@ def build(args, config, basepath, workspace):
861 """Entry point for the devtool 'build' subcommand""" 847 """Entry point for the devtool 'build' subcommand"""
862 import bb 848 import bb
863 if not args.recipename in workspace: 849 if not args.recipename in workspace:
864 logger.error("no recipe named %s in your workspace" % args.recipename) 850 raise DevtoolError("no recipe named %s in your workspace" %
865 return -1 851 args.recipename)
866 build_task = config.get('Build', 'build_task', 'populate_sysroot') 852 build_task = config.get('Build', 'build_task', 'populate_sysroot')
867 try: 853 try:
868 exec_build_env_command(config.init_path, basepath, 'bitbake -c %s %s' % (build_task, args.recipename), watch=True) 854 exec_build_env_command(config.init_path, basepath, 'bitbake -c %s %s' % (build_task, args.recipename), watch=True)