]> code.ossystems Code Review - openembedded-core.git/commitdiff
report-error: send only last 5242000 characters in error logs
authorMartin Jansa <martin.jansa@gmail.com>
Fri, 4 Sep 2015 12:22:09 +0000 (14:22 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 6 Sep 2015 14:24:20 +0000 (15:24 +0100)
* otherwise whole build report submission is rejected because it's too big

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/report-error.bbclass

index cabd98cc32938b4668d4450cdbfe7de4338a08b8..040c29ea2470ff2806cd0e780e77708b318ce230 100644 (file)
@@ -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)