summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMariano Lopez <mariano.lopez@linux.intel.com>2015-10-01 10:40:46 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-10-03 00:02:19 +0100
commitafb5308770de776181da5b44f9dc30922836bc38 (patch)
tree7caebd21c71045a1e3e3077ee53312b9a2bc4832
parente11801d031896351364e7723db3392012f58b603 (diff)
downloadopenembedded-core-contrib-afb5308770de776181da5b44f9dc30922836bc38.tar.gz
openembedded-core-contrib-afb5308770de776181da5b44f9dc30922836bc38.tar.bz2
openembedded-core-contrib-afb5308770de776181da5b44f9dc30922836bc38.zip
report-error.bbclass: Support Unicode reports
Currently error-report doesn't manage Unicode because the files are opened with the default codec. This patch changes the codec of the files to UTF-8, this way the reports will include Unicode characters. This is useful for the qemu output when doing the testimage task. [YOCTO #8225] Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/report-error.bbclass11
1 files changed, 7 insertions, 4 deletions
diff --git a/meta/classes/report-error.bbclass b/meta/classes/report-error.bbclass
index 040c29ea24..82b5bcd690 100644
--- a/meta/classes/report-error.bbclass
+++ b/meta/classes/report-error.bbclass
@@ -9,22 +9,25 @@
ERR_REPORT_DIR ?= "${LOG_DIR}/error-report"
def errorreport_getdata(e):
+ import codecs
logpath = e.data.getVar('ERR_REPORT_DIR', True)
datafile = os.path.join(logpath, "error-report.txt")
- with open(datafile) as f:
+ with codecs.open(datafile, 'r', 'utf-8') as f:
data = f.read()
return data
def errorreport_savedata(e, newdata, file):
import json
+ import codecs
logpath = e.data.getVar('ERR_REPORT_DIR', True)
datafile = os.path.join(logpath, file)
- with open(datafile, "w") as f:
+ with codecs.open(datafile, 'w', 'utf-8') as f:
json.dump(newdata, f, indent=4, sort_keys=True)
return datafile
python errorreport_handler () {
import json
+ import codecs
logpath = e.data.getVar('ERR_REPORT_DIR', True)
datafile = os.path.join(logpath, "error-report.txt")
@@ -53,8 +56,8 @@ python errorreport_handler () {
taskdata['task'] = task
if log:
try:
- logFile = open(log, 'r')
- logdata = logFile.read().decode('utf-8')
+ logFile = codecs.open(log, 'r', 'utf-8')
+ logdata = logFile.read()
logFile.close()
except:
logdata = "Unable to read log file"