Skip to contentSkip to conversation

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

PATCH In review Martin Jansa 1 participant 2 messages Sep 4, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 report-error: send only last 5242000 characters in error logs

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

---
 meta/classes/report-error.bbclass | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
meta/classes/report-error.bbclass +12 -3
index cabd98c..040c29e 100644
@@ -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)
Signature · 1 line
2.5.0
#1 lore raw
Quoted 1 line · Martin Jansa

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

Verified in last bitbake world build:
http://errors.yoctoproject.org/Errors/Build/8516/
until now they were rejected because webkit-efl log.do_compile is too big, now it's uploades in shortened form:
http://errors.yoctoproject.org/Errors/Details/16393/

Quoted 38 lines
---
 meta/classes/report-error.bbclass | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
meta/classes/report-error.bbclass +12 -3
index cabd98c..040c29e 100644
@@ -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)
Signature · 1 line
2.5.0
Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]