Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] report-error: send only last 5242000 characters in error logs
@ 2015-09-04 12:22 Martin Jansa
  2015-09-04 12:24 ` Martin Jansa
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Jansa @ 2015-09-04 12:22 UTC (permalink / raw)
  To: openembedded-core

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

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
 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)
-- 
2.5.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] report-error: send only last 5242000 characters in error logs
  2015-09-04 12:22 [PATCH] report-error: send only last 5242000 characters in error logs Martin Jansa
@ 2015-09-04 12:24 ` Martin Jansa
  0 siblings, 0 replies; 2+ messages in thread
From: Martin Jansa @ 2015-09-04 12:24 UTC (permalink / raw)
  To: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 2148 bytes --]

On Fri, Sep 04, 2015 at 02:22:09PM +0200, Martin Jansa wrote:
> * 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/

> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
> ---
>  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)
> -- 
> 2.5.0
> 

-- 
Martin 'JaMa' Jansa     jabber: Martin.Jansa@gmail.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 188 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-09-04 12:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-04 12:22 [PATCH] report-error: send only last 5242000 characters in error logs Martin Jansa
2015-09-04 12:24 ` Martin Jansa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox