summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2014-12-20 11:20:33 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-01-06 14:13:38 +0000
commit9ffc238025e784a7d96e405d808a0adcea66f797 (patch)
tree857dd9fa33ea8939c7424af1d2fa966fad7f706a /meta
parent7461790c39702f25c8c5ab52dd70d05748a7768e (diff)
downloadpoky-9ffc238025e784a7d96e405d808a0adcea66f797.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) (From OE-Core rev: 8e52fea95441f88ab366c3c32b869cb30cc386b7) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/report-error.bbclass9
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")