summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-07-11 11:07:56 +1200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-07-12 23:10:15 +0100
commit5c91537ab250e823b362bf5cc94760d26c6a4429 (patch)
tree3e992f843c3a739068b1e5d305356b708bc122bc
parentd56caf3408d6200d51dff62eae51ffb137ae7393 (diff)
downloadpoky-5c91537ab250e823b362bf5cc94760d26c6a4429.tar.gz
devtool: return specific exit code for incompatible recipes
Certain recipes cannot be used with devtool extract / modify / upgrade - usually because they don't provide any source. Return a specific exit code (4) so that scripts such as scripts/contrib/devtool-stress.py know the difference between this and a genuine failure. (From OE-Core rev: ffd295fed4ab81fc0bd00bb145ef4d72c49584bf) 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>
-rwxr-xr-xscripts/devtool2
-rw-r--r--scripts/lib/devtool/__init__.py5
-rw-r--r--scripts/lib/devtool/standard.py16
3 files changed, 13 insertions, 10 deletions
diff --git a/scripts/devtool b/scripts/devtool
index a93a11f341..b1274d69d8 100755
--- a/scripts/devtool
+++ b/scripts/devtool
@@ -334,7 +334,7 @@ def main():
334 except DevtoolError as err: 334 except DevtoolError as err:
335 if str(err): 335 if str(err):
336 logger.error(str(err)) 336 logger.error(str(err))
337 ret = 1 337 ret = err.exitcode
338 except argparse_oe.ArgumentUsageError as ae: 338 except argparse_oe.ArgumentUsageError as ae:
339 parser.error_subcommand(ae.message, ae.subcommand) 339 parser.error_subcommand(ae.message, ae.subcommand)
340 340
diff --git a/scripts/lib/devtool/__init__.py b/scripts/lib/devtool/__init__.py
index 77b1fd90a9..65eb4527bc 100644
--- a/scripts/lib/devtool/__init__.py
+++ b/scripts/lib/devtool/__init__.py
@@ -26,10 +26,11 @@ import re
26 26
27logger = logging.getLogger('devtool') 27logger = logging.getLogger('devtool')
28 28
29
30class DevtoolError(Exception): 29class DevtoolError(Exception):
31 """Exception for handling devtool errors""" 30 """Exception for handling devtool errors"""
32 pass 31 def __init__(self, message, exitcode=1):
32 super(DevtoolError, self).__init__(message)
33 self.exitcode = exitcode
33 34
34 35
35def exec_build_env_command(init_path, builddir, cmd, watch=False, **options): 36def exec_build_env_command(init_path, builddir, cmd, watch=False, **options):
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index 5be4d26b29..645a61f25b 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -264,28 +264,30 @@ def _check_compatible_recipe(pn, d):
264 """Check if the recipe is supported by devtool""" 264 """Check if the recipe is supported by devtool"""
265 if pn == 'perf': 265 if pn == 'perf':
266 raise DevtoolError("The perf recipe does not actually check out " 266 raise DevtoolError("The perf recipe does not actually check out "
267 "source and thus cannot be supported by this tool") 267 "source and thus cannot be supported by this tool",
268 4)
268 269
269 if pn in ['kernel-devsrc', 'package-index'] or pn.startswith('gcc-source'): 270 if pn in ['kernel-devsrc', 'package-index'] or pn.startswith('gcc-source'):
270 raise DevtoolError("The %s recipe is not supported by this tool" % pn) 271 raise DevtoolError("The %s recipe is not supported by this tool" % pn, 4)
271 272
272 if bb.data.inherits_class('image', d): 273 if bb.data.inherits_class('image', d):
273 raise DevtoolError("The %s recipe is an image, and therefore is not " 274 raise DevtoolError("The %s recipe is an image, and therefore is not "
274 "supported by this tool" % pn) 275 "supported by this tool" % pn, 4)
275 276
276 if bb.data.inherits_class('populate_sdk', d): 277 if bb.data.inherits_class('populate_sdk', d):
277 raise DevtoolError("The %s recipe is an SDK, and therefore is not " 278 raise DevtoolError("The %s recipe is an SDK, and therefore is not "
278 "supported by this tool" % pn) 279 "supported by this tool" % pn, 4)
279 280
280 if bb.data.inherits_class('packagegroup', d): 281 if bb.data.inherits_class('packagegroup', d):
281 raise DevtoolError("The %s recipe is a packagegroup, and therefore is " 282 raise DevtoolError("The %s recipe is a packagegroup, and therefore is "
282 "not supported by this tool" % pn) 283 "not supported by this tool" % pn, 4)
283 284
284 if bb.data.inherits_class('meta', d): 285 if bb.data.inherits_class('meta', d):
285 raise DevtoolError("The %s recipe is a meta-recipe, and therefore is " 286 raise DevtoolError("The %s recipe is a meta-recipe, and therefore is "
286 "not supported by this tool" % pn) 287 "not supported by this tool" % pn, 4)
287 288
288 if bb.data.inherits_class('externalsrc', d) and d.getVar('EXTERNALSRC', True): 289 if bb.data.inherits_class('externalsrc', d) and d.getVar('EXTERNALSRC', True):
290 # Not an incompatibility error per se, so we don't pass the error code
289 raise DevtoolError("externalsrc is currently enabled for the %s " 291 raise DevtoolError("externalsrc is currently enabled for the %s "
290 "recipe. This prevents the normal do_patch task " 292 "recipe. This prevents the normal do_patch task "
291 "from working. You will need to disable this " 293 "from working. You will need to disable this "
@@ -498,7 +500,7 @@ def _extract_source(srctree, keep_temp, devbranch, sync, d):
498 500
499 if 'noexec' in (d.getVarFlags('do_unpack', False) or []): 501 if 'noexec' in (d.getVarFlags('do_unpack', False) or []):
500 raise DevtoolError("The %s recipe has do_unpack disabled, unable to " 502 raise DevtoolError("The %s recipe has do_unpack disabled, unable to "
501 "extract source" % pn) 503 "extract source" % pn, 4)
502 504
503 if not sync: 505 if not sync:
504 # Prepare for shutil.move later on 506 # Prepare for shutil.move later on