Skip to contentSkip to conversation

insane.bbclass: write QA issues to log file only when thei are in ERROR_QA or WARN_QA

PATCH Superseded Martin Jansa 2 participants 7 messages Aug 21, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 insane.bbclass: write QA issues to log file only when thei are in ERROR_QA or WARN_QA

* QA check which aren't included in WARN_QA and ERROR_QA are shown during the build only as NOTE message (not shown at all with default knotty setting), so it might be surprising to see them later in qa.log file

---
 meta/classes/insane.bbclass | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta/classes/insane.bbclass +2 -1
index b7177c9b32..44e4a01c92 100644
@@ -184,12 +184,13 @@ def package_qa_write_error(type, error, d):
             f.write("%s: %s [%s]\n" % (p, error, type))
 
 def package_qa_handle_error(error_class, error_msg, d):
-    package_qa_write_error(error_class, error_msg, d)
     if error_class in (d.getVar("ERROR_QA") or "").split():
+        package_qa_write_error(error_class, error_msg, d)
         bb.error("QA Issue: %s [%s]" % (error_msg, error_class))
         d.setVar("QA_SANE", False)
         return False
     elif error_class in (d.getVar("WARN_QA") or "").split():
+        package_qa_write_error(error_class, error_msg, d)
         bb.warn("QA Issue: %s [%s]" % (error_msg, error_class))
     else:
         bb.note("QA Issue: %s [%s]" % (error_msg, error_class))
Signature · 1 line
2.14.0
#1 lore raw

Just notice typo in subject s/thei/they/g, will resend soon, in the meantime is there some feedback on this?

Alternatively we can write them with NOTE: WARN: ERROR: prefix like with the logger, so that the qa.log can be filtered by severity of the issue.

TL;DR; version:
In my jenkins builds I'm printing content of qa.log at the end of usually very long build log, so that they are easier to spot in one place and because I get a lot of "version-going-backwards" warnings which I'm not interested in anymore at all, I've removed them from ERROR_QA - but then I was wondering why I still see very long list of "version-going-backwards" warnings, but those were from qa.log. It would work for me fine to just "grep -v ^NOTE: qa.log" at the end of jenkins build if the alternative solution is more acceptable.

Quoted 33 lines · Martin Jansa

* QA check which aren't included in WARN_QA and ERROR_QA are shown during the build only as NOTE message (not shown at all with default knotty setting), so it might be surprising to see them later in qa.log file

---
 meta/classes/insane.bbclass | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta/classes/insane.bbclass +2 -2
index b7177c9b32..44e4a01c92 100644
@@ -184,12 +184,13 @@ def package_qa_write_error(type, error, d):
             f.write("%s: %s [%s]\n" % (p, error, type))
 
 def package_qa_handle_error(error_class, error_msg, d):
-    package_qa_write_error(error_class, error_msg, d)
     if error_class in (d.getVar("ERROR_QA") or "").split():
+        package_qa_write_error(error_class, error_msg, d)
         bb.error("QA Issue: %s [%s]" % (error_msg, error_class))
         d.setVar("QA_SANE", False)
         return False
     elif error_class in (d.getVar("WARN_QA") or "").split():
+        package_qa_write_error(error_class, error_msg, d)
         bb.warn("QA Issue: %s [%s]" % (error_msg, error_class))
     else:
         bb.note("QA Issue: %s [%s]" % (error_msg, error_class))
--

2.14.0

#2 lore raw

PATCH v2 1/1 insane.bbclass: write QA issues to log file only when they are in ERROR_QA or WARN_QA

In reply to Martin Jansa

* QA check which aren't included in WARN_QA and ERROR_QA are shown during the build only as NOTE message (not shown at all with default knotty setting), so it might be surprising to see them later in qa.log file

---
 meta/classes/insane.bbclass | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta/classes/insane.bbclass +2 -1
index b7177c9b32..44e4a01c92 100644
@@ -184,12 +184,13 @@ def package_qa_write_error(type, error, d):
             f.write("%s: %s [%s]\n" % (p, error, type))
 
 def package_qa_handle_error(error_class, error_msg, d):
-    package_qa_write_error(error_class, error_msg, d)
     if error_class in (d.getVar("ERROR_QA") or "").split():
+        package_qa_write_error(error_class, error_msg, d)
         bb.error("QA Issue: %s [%s]" % (error_msg, error_class))
         d.setVar("QA_SANE", False)
         return False
     elif error_class in (d.getVar("WARN_QA") or "").split():
+        package_qa_write_error(error_class, error_msg, d)
         bb.warn("QA Issue: %s [%s]" % (error_msg, error_class))
     else:
         bb.note("QA Issue: %s [%s]" % (error_msg, error_class))
Signature · 1 line
2.14.1
#3 lore raw

Re: [PATCHv2] insane.bbclass: write QA issues to log file only when they are in ERROR_QA or WARN_QA

Quoted 11 lines · Martin Jansa

* QA check which aren't included in WARN_QA and ERROR_QA are shown during the build only as NOTE message (not shown at all with default
  knotty setting), so it might be surprising to see them later in qa.log
  file

---
 meta/classes/insane.bbclass | 3 ++-

 1 file changed, 2 insertions(+), 1 deletion(-)

I've just been having a look at this and I think its by design, all messages are put into the log but at differing log levels. I think the correct thing to do may be to filter it as you proposed in your CI system.

Any other opinions?

Cheers,

Richard

#4 lore raw

Re: [PATCHv2] insane.bbclass: write QA issues to log file only when they are in ERROR_QA or WARN_QA

Quoted 1 line

all messages are put into the log but at differing log levels.

But there aren't the "log levels" in the file (as NOTE, WARN, ERROR) now, it writes only P, error message and type of QA check (not the selected severity of it, like bb.error, bb.warn, bb.note used in the function for normal output).

See the function above package_qa_handle_error:

def package_qa_write_error(type, error, d):
logfile = d.getVar('QA_LOGFILE')
if logfile:
p = d.getVar('P')
with open(logfile, "a+") as f:
f.write("%s: %s [%s]\n" % (p, error, type))

Quoted 24 lines · Richard Purdie
Quoted 11 lines · Martin Jansa

* QA check which aren't included in WARN_QA and ERROR_QA are shown during the build only as NOTE message (not shown at all with
default
knotty setting), so it might be surprising to see them later in
qa.log
file

---
 meta/classes/insane.bbclass | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

I've just been having a look at this and I think its by design, all messages are put into the log but at differing log levels. I think the correct thing to do may be to filter it as you proposed in your CI system.

Any other opinions?

Cheers,

Richard

#5 lore raw

Re: [PATCHv2] insane.bbclass: write QA issues to log file only when they are in ERROR_QA or WARN_QA

Quoted 7 lines · Martin Jansa
Quoted 1 line

 all messages are put into the log but at differing log levels.

But there aren't the "log levels" in the file (as NOTE, WARN, ERROR) now, it writes only P, error message and type of QA check (not the selected severity of it, like bb.error, bb.warn, bb.note used in the function for normal output).

Quoted 9 lines

See the function above package_qa_handle_error:

def package_qa_write_error(type, error, d):
    logfile = d.getVar('QA_LOGFILE')
    if logfile:
        p = d.getVar('P')
        with open(logfile, "a+") as f:
            f.write("%s: %s [%s]\n" % (p, error, type))

Sorry, I misread your earlier message and assumed it was logging the level already. I've spent too long staring at bitbake server bugs :/.

I'm still torn on this, I can see why qa.log makes sense to contain all the qa issues found and then the WARN/ERROR levels filter the console output (and ultimately the bitbake exit code). I can also see why in general we'd not want "levels" in the logfile, its more of a console issue.

You could do "grep -v version-going-backwards qa.log" I guess?

Cheers,

Richard

#6 lore raw

Re: [PATCHv2] insane.bbclass: write QA issues to log file only when they are in ERROR_QA or WARN_QA

Quoted 1 line

You could do "grep -v version-going-backwards qa.log" I guess?

In theory yes, in practice the same jenkins jobs are building different DISTROs or different Yocto releases with different QA flags enabled, so I would end up with using bitbke -e to find
WARN_QA and ERROR_QA for given build and then filter only those from qa.log.

I can still do it outside OE, I just didn't realize that there are reasons for not wanting the levels in the log file (and I still don't know why it's a good thing not to have them).

Regards,

Quoted 35 lines · Richard Purdie
Quoted 7 lines · Martin Jansa
Quoted 1 line

all messages are put into the log but at differing log levels.

But there aren't the "log levels" in the file (as NOTE, WARN, ERROR) now, it writes only P, error message and type of QA check (not the selected severity of it, like bb.error, bb.warn, bb.note used in the function for normal output).

Quoted 9 lines

See the function above package_qa_handle_error:

def package_qa_write_error(type, error, d):
logfile = d.getVar('QA_LOGFILE')
if logfile:
p = d.getVar('P')
with open(logfile, "a+") as f:
f.write("%s: %s [%s]\n" % (p, error, type))

Sorry, I misread your earlier message and assumed it was logging the level already. I've spent too long staring at bitbake server bugs :/.

I'm still torn on this, I can see why qa.log makes sense to contain all the qa issues found and then the WARN/ERROR levels filter the console output (and ultimately the bitbake exit code). I can also see why in general we'd not want "levels" in the logfile, its more of a console issue.

You could do "grep -v version-going-backwards qa.log" I guess?

Cheers,

Richard