diff options
Diffstat (limited to 'external/poky/meta/classes/report-error.bbclass')
-rw-r--r-- | external/poky/meta/classes/report-error.bbclass | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/external/poky/meta/classes/report-error.bbclass b/external/poky/meta/classes/report-error.bbclass index 1c55abfb..1a12db12 100644 --- a/external/poky/meta/classes/report-error.bbclass +++ b/external/poky/meta/classes/report-error.bbclass @@ -25,6 +25,19 @@ def errorreport_savedata(e, newdata, file): json.dump(newdata, f, indent=4, sort_keys=True) return datafile +def get_conf_data(e, filename): + builddir = e.data.getVar('TOPDIR') + filepath = os.path.join(builddir, "conf", filename) + jsonstring = "" + if os.path.exists(filepath): + with open(filepath, 'r') as f: + for line in f.readlines(): + if line.startswith("#") or len(line.strip()) == 0: + continue + else: + jsonstring=jsonstring + line + return jsonstring + python errorreport_handler () { import json import codecs @@ -51,6 +64,8 @@ python errorreport_handler () { data['failures'] = [] data['component'] = " ".join(e.getPkgs()) data['branch_commit'] = str(base_detect_branch(e.data)) + ": " + str(base_detect_revision(e.data)) + data['local_conf'] = get_conf_data(e, 'local.conf') + data['auto_conf'] = get_conf_data(e, 'auto.conf') lock = bb.utils.lockfile(datafile + '.lock') errorreport_savedata(e, data, "error-report.txt") bb.utils.unlockfile(lock) @@ -63,19 +78,15 @@ python errorreport_handler () { taskdata['task'] = task if log: try: - logFile = codecs.open(log, 'r', 'utf-8') - logdata = logFile.read() - + with codecs.open(log, encoding='utf-8') as logFile: + logdata = logFile.read() # Replace host-specific paths so the logs are cleaner for d in ("TOPDIR", "TMPDIR"): s = e.data.getVar(d) if s: logdata = logdata.replace(s, d) - - logFile.close() except: logdata = "Unable to read log file" - else: logdata = "No Log" |