diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-12-20 11:20:33 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-12-20 11:24:03 +0000 |
commit | 1e6bfcab47f532677f87683ba2f5e5fb905e9ba5 (patch) | |
tree | 21f557da83dbe7fb83d9bfa48502e2bb48d95175 | |
parent | 146b1ea632294b2830e2cfe2d1258d48cd0c0e85 (diff) | |
download | openembedded-core-1e6bfcab47f532677f87683ba2f5e5fb905e9ba5.tar.gz openembedded-core-1e6bfcab47f532677f87683ba2f5e5fb905e9ba5.tar.bz2 openembedded-core-1e6bfcab47f532677f87683ba2f5e5fb905e9ba5.zip |
report-error: Handle the case no logfile exists
If the task fails early, no error log may exist. Currently we crash in
that case, this handles the situation more gracefully.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/report-error.bbclass | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/meta/classes/report-error.bbclass b/meta/classes/report-error.bbclass index 5fe2355842..8b30422edf 100644 --- a/meta/classes/report-error.bbclass +++ b/meta/classes/report-error.bbclass @@ -44,11 +44,14 @@ python errorreport_handler () { task = e.task taskdata={} log = e.data.getVar('BB_LOGFILE', True) - logFile = open(log, 'r') taskdata['package'] = e.data.expand("${PF}") taskdata['task'] = task - taskdata['log'] = logFile.read() - logFile.close() + if log: + logFile = open(log, 'r') + taskdata['log'] = logFile.read() + logFile.close() + else: + taskdata['log'] = "No Log" jsondata = json.loads(errorreport_getdata(e)) jsondata['failures'].append(taskdata) errorreport_savedata(e, jsondata, "error-report.txt") |