[oe-commits] Martin Jansa : report-error: send only last 5242000 characters in error logs

git at git.openembedded.org git at git.openembedded.org
Sun Sep 6 14:27:49 UTC 2015


Module: openembedded-core.git
Branch: master-next
Commit: 3544b4d4d72330eb12bb3cda25cb99ed52c8a2eb
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=3544b4d4d72330eb12bb3cda25cb99ed52c8a2eb

Author: Martin Jansa <martin.jansa at gmail.com>
Date:   Fri Sep  4 14:22:09 2015 +0200

report-error: send only last 5242000 characters in error logs

* otherwise whole build report submission is rejected because it's too big

Signed-off-by: Martin Jansa <Martin.Jansa at gmail.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 meta/classes/report-error.bbclass | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/meta/classes/report-error.bbclass b/meta/classes/report-error.bbclass
index cabd98c..040c29e 100644
--- a/meta/classes/report-error.bbclass
+++ b/meta/classes/report-error.bbclass
@@ -54,13 +54,22 @@ python errorreport_handler () {
             if log:
                 try:
                     logFile = open(log, 'r')
-                    taskdata['log'] = logFile.read().decode('utf-8')
+                    logdata = logFile.read().decode('utf-8')
                     logFile.close()
                 except:
-                    taskdata['log'] = "Unable to read log file"
+                    logdata = "Unable to read log file"
 
             else:
-                taskdata['log'] = "No Log"
+                logdata = "No Log"
+
+            # server will refuse failures longer than param specified in project.settings.py
+            # MAX_UPLOAD_SIZE = "5242880"
+            # use lower value, because 650 chars can be spent in task, package, version
+            max_logdata_size = 5242000
+            # upload last max_logdata_size characters
+            if len(logdata) > max_logdata_size:
+                logdata = "..." + logdata[-max_logdata_size:]
+            taskdata['log'] = logdata
             lock = bb.utils.lockfile(datafile + '.lock')
             jsondata = json.loads(errorreport_getdata(e))
             jsondata['failures'].append(taskdata)



More information about the Openembedded-commits mailing list