diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2016-07-08 15:11:13 +1200 |
---|---|---|
committer | Paul Eggleton <paul.eggleton@linux.intel.com> | 2016-07-11 11:02:42 +1200 |
commit | dc4b7dcfe2a1a7a9efb20903b5cb9232aedd3716 (patch) | |
tree | 3691e823c6c8f85d130fd2f23300136cb15053aa | |
parent | 314198057ff1f703bc1a150c335f3987eb2cce01 (diff) | |
download | openembedded-core-contrib-dc4b7dcfe2a1a7a9efb20903b5cb9232aedd3716.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.
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
-rwxr-xr-x | scripts/devtool | 2 | ||||
-rw-r--r-- | scripts/lib/devtool/__init__.py | 5 | ||||
-rw-r--r-- | scripts/lib/devtool/standard.py | 16 |
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(): except DevtoolError as err: if str(err): logger.error(str(err)) - ret = 1 + ret = err.exitcode except argparse_oe.ArgumentUsageError as ae: parser.error_subcommand(ae.message, ae.subcommand) 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 logger = logging.getLogger('devtool') - class DevtoolError(Exception): """Exception for handling devtool errors""" - pass + def __init__(self, message, exitcode=1): + super(DevtoolError, self).__init__(message) + self.exitcode = exitcode def 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 8236dd51e9..f2ba69976f 100644 --- a/scripts/lib/devtool/standard.py +++ b/scripts/lib/devtool/standard.py @@ -268,28 +268,30 @@ def _check_compatible_recipe(pn, d): """Check if the recipe is supported by devtool""" if pn == 'perf': raise DevtoolError("The perf recipe does not actually check out " - "source and thus cannot be supported by this tool") + "source and thus cannot be supported by this tool", + 4) if pn in ['kernel-devsrc', 'package-index'] or pn.startswith('gcc-source'): - raise DevtoolError("The %s recipe is not supported by this tool" % pn) + raise DevtoolError("The %s recipe is not supported by this tool" % pn, 4) if bb.data.inherits_class('image', d): raise DevtoolError("The %s recipe is an image, and therefore is not " - "supported by this tool" % pn) + "supported by this tool" % pn, 4) if bb.data.inherits_class('populate_sdk', d): raise DevtoolError("The %s recipe is an SDK, and therefore is not " - "supported by this tool" % pn) + "supported by this tool" % pn, 4) if bb.data.inherits_class('packagegroup', d): raise DevtoolError("The %s recipe is a packagegroup, and therefore is " - "not supported by this tool" % pn) + "not supported by this tool" % pn, 4) if bb.data.inherits_class('meta', d): raise DevtoolError("The %s recipe is a meta-recipe, and therefore is " - "not supported by this tool" % pn) + "not supported by this tool" % pn, 4) if bb.data.inherits_class('externalsrc', d) and d.getVar('EXTERNALSRC', True): + # Not an incompatibility error per se, so we don't pass the error code raise DevtoolError("externalsrc is currently enabled for the %s " "recipe. This prevents the normal do_patch task " "from working. You will need to disable this " @@ -502,7 +504,7 @@ def _extract_source(srctree, keep_temp, devbranch, sync, d): if 'noexec' in (d.getVarFlags('do_unpack', False) or []): raise DevtoolError("The %s recipe has do_unpack disabled, unable to " - "extract source" % pn) + "extract source" % pn, 4) if not sync: # Prepare for shutil.move later on |