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-21 12:37:52 +0000 |
| commit | 900f27a98343acae497b2a81de633f2d8f268d94 (patch) | |
| tree | 978f9c5137205b57294725316895006b47bd413e | |
| parent | 88528a128fe7c11871c24706ff6d245b183d6975 (diff) | |
| download | poky-900f27a98343acae497b2a81de633f2d8f268d94.tar.gz | |
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.
(From OE-Core rev: 1e6bfcab47f532677f87683ba2f5e5fb905e9ba5)
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 () { | |||
| 44 | task = e.task | 44 | task = e.task |
| 45 | taskdata={} | 45 | taskdata={} |
| 46 | log = e.data.getVar('BB_LOGFILE', True) | 46 | log = e.data.getVar('BB_LOGFILE', True) |
| 47 | logFile = open(log, 'r') | ||
| 48 | taskdata['package'] = e.data.expand("${PF}") | 47 | taskdata['package'] = e.data.expand("${PF}") |
| 49 | taskdata['task'] = task | 48 | taskdata['task'] = task |
| 50 | taskdata['log'] = logFile.read() | 49 | if log: |
| 51 | logFile.close() | 50 | logFile = open(log, 'r') |
| 51 | taskdata['log'] = logFile.read() | ||
| 52 | logFile.close() | ||
| 53 | else: | ||
| 54 | taskdata['log'] = "No Log" | ||
| 52 | jsondata = json.loads(errorreport_getdata(e)) | 55 | jsondata = json.loads(errorreport_getdata(e)) |
| 53 | jsondata['failures'].append(taskdata) | 56 | jsondata['failures'].append(taskdata) |
| 54 | errorreport_savedata(e, jsondata, "error-report.txt") | 57 | errorreport_savedata(e, jsondata, "error-report.txt") |
