[oe-commits] Richard Purdie : report-error: Handle the case no logfile exists
git at git.openembedded.org
git at git.openembedded.org
Tue Jan 6 14:19:29 UTC 2015
Module: openembedded-core.git
Branch: dizzy
Commit: 8e52fea95441f88ab366c3c32b869cb30cc386b7
URL: http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=8e52fea95441f88ab366c3c32b869cb30cc386b7
Author: Richard Purdie <richard.purdie at linuxfoundation.org>
Date: Sat Dec 20 11:20:33 2014 +0000
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 at linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808 at gmail.com>
---
meta/classes/report-error.bbclass | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/meta/classes/report-error.bbclass b/meta/classes/report-error.bbclass
index 5fe2355..8b30422 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")
More information about the Openembedded-commits
mailing list