summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2017-03-15 11:01:34 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-03-16 22:11:32 +0000
commitef0c54ab70d22be9ba04e7648684fac5c043c5af (patch)
tree70065d787f75d3082c66d0ce8e1dd03764b562ec /scripts
parentab2caed31ad7d20561643f4de9792f97d3a6bd5b (diff)
downloadpoky-ef0c54ab70d22be9ba04e7648684fac5c043c5af.tar.gz
yocto-compat-layer: improve error handling in signature creation
When "bitbake -k -S none world" failed, the error printed by yocto-compat-layer.py contained the stack trace multiple times and did not contain the stderr output from bitbake, making the error hard to understand and debug: INFO: ====================================================================== INFO: ERROR: test_signatures (common.CommonCompatLayer) INFO: ---------------------------------------------------------------------- INFO: Traceback (most recent call last): File "/fast/work/poky/scripts/lib/compatlayer/__init__.py", line 144, in get_signatures stderr=subprocess.PIPE) File "/usr/lib/python3.4/subprocess.py", line 620, in check_output raise CalledProcessError(retcode, process.args, output=output) subprocess.CalledProcessError: Command 'bitbake -k -S none world' returned non-zero exit status 1 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/fast/work/poky/scripts/lib/compatlayer/cases/common.py", line 51, in test_signatures curr_sigs = get_signatures(self.td['builddir'], failsafe=True) File "/fast/work/poky/scripts/lib/compatlayer/__init__.py", line 149, in get_signatures raise RuntimeError(msg) RuntimeError: Traceback (most recent call last): File "/fast/work/poky/scripts/lib/compatlayer/__init__.py", line 144, in get_signatures stderr=subprocess.PIPE) File "/usr/lib/python3.4/subprocess.py", line 620, in check_output raise CalledProcessError(retcode, process.args, output=output) subprocess.CalledProcessError: Command 'bitbake -k -S none world' returned non-zero exit status 1 Loading cache...done. Loaded 1328 entries from dependency cache. NOTE: Resolving any missing task queue dependencies NOTE: Runtime target 'zlib-qat' is unbuildable, removing... Missing or unbuildable dependency chain was: ['zlib-qat'] ... Summary: There were 5 ERROR messages shown, returning a non-zero exit code. The yocto-compat-layer.log was incomplete, it only had the first part without the command output. stderr was missing due to stderr=subprocess.PIPE. Instead of the complicated try/except construct it's better to check the return code ourselves and raise just a single exception. The output (both on stderr and in the yocto-compat-layer.log) now is: INFO: ====================================================================== INFO: ERROR: test_signatures (common.CommonCompatLayer) INFO: ---------------------------------------------------------------------- INFO: Traceback (most recent call last): File "/fast/work/poky/scripts/lib/compatlayer/cases/common.py", line 51, in test_signatures curr_sigs = get_signatures(self.td['builddir'], failsafe=True) File "/fast/work/poky/scripts/lib/compatlayer/__init__.py", line 147, in get_signatures raise RuntimeError(msg) RuntimeError: Generating signatures failed. This might be due to some parse error and/or general layer incompatibilities. Command: bitbake -k -S none world Output: Loading cache...done. Loaded 1328 entries from dependency cache. NOTE: Resolving any missing task queue dependencies ERROR: Nothing PROVIDES 'qat16' (but /fast/work/meta-intel/common/recipes-extended/openssl-qat/openssl-qat_0.4.9-009.bb DEPENDS on or otherwise requires it) ERROR: qat16 was skipped: incompatible with machine qemux86 (not in COMPATIBLE_MACHINE) ... Missing or unbuildable dependency chain was: ['openssl-qat-dev'] ... Summary: There were 5 ERROR messages shown, returning a non-zero exit code. (From OE-Core rev: 5b9ac62ab535d2791b9713857e1016f49f53dd8d) Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/compatlayer/__init__.py20
1 files changed, 9 insertions, 11 deletions
diff --git a/scripts/lib/compatlayer/__init__.py b/scripts/lib/compatlayer/__init__.py
index b3a166aa9a..a7eb862531 100644
--- a/scripts/lib/compatlayer/__init__.py
+++ b/scripts/lib/compatlayer/__init__.py
@@ -135,17 +135,15 @@ def get_signatures(builddir, failsafe=False):
135 135
136 sigs = {} 136 sigs = {}
137 137
138 try: 138 cmd = 'bitbake '
139 cmd = 'bitbake ' 139 if failsafe:
140 if failsafe: 140 cmd += '-k '
141 cmd += '-k ' 141 cmd += '-S none world'
142 cmd += '-S none world' 142 p = subprocess.Popen(cmd, shell=True,
143 output = subprocess.check_output(cmd, shell=True, 143 stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
144 stderr=subprocess.PIPE) 144 output, _ = p.communicate()
145 except subprocess.CalledProcessError as e: 145 if p.returncode:
146 import traceback 146 msg = "Generating signatures failed. This might be due to some parse error and/or general layer incompatibilities.\nCommand: %s\nOutput:\n%s" % (cmd, output.decode('utf-8'))
147 exc = traceback.format_exc()
148 msg = '%s\n%s\n' % (exc, e.output.decode('utf-8'))
149 raise RuntimeError(msg) 147 raise RuntimeError(msg)
150 sigs_file = os.path.join(builddir, 'locked-sigs.inc') 148 sigs_file = os.path.join(builddir, 'locked-sigs.inc')
151 149