summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oe/qa.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/meta/lib/oe/qa.py b/meta/lib/oe/qa.py
index e8a854a302..efab7e8564 100644
--- a/meta/lib/oe/qa.py
+++ b/meta/lib/oe/qa.py
@@ -171,6 +171,40 @@ def elf_machine_to_string(machine):
171 except: 171 except:
172 return "Unknown (%s)" % repr(machine) 172 return "Unknown (%s)" % repr(machine)
173 173
174def write_error(type, error, d):
175 logfile = d.getVar('QA_LOGFILE')
176 if logfile:
177 p = d.getVar('P')
178 with open(logfile, "a+") as f:
179 f.write("%s: %s [%s]\n" % (p, error, type))
180
181def handle_error(error_class, error_msg, d):
182 if error_class in (d.getVar("ERROR_QA") or "").split():
183 write_error(error_class, error_msg, d)
184 bb.error("QA Issue: %s [%s]" % (error_msg, error_class))
185 d.setVar("QA_ERRORS_FOUND", "True")
186 return False
187 elif error_class in (d.getVar("WARN_QA") or "").split():
188 write_error(error_class, error_msg, d)
189 bb.warn("QA Issue: %s [%s]" % (error_msg, error_class))
190 else:
191 bb.note("QA Issue: %s [%s]" % (error_msg, error_class))
192 return True
193
194def add_message(messages, section, new_msg):
195 if section not in messages:
196 messages[section] = new_msg
197 else:
198 messages[section] = messages[section] + "\n" + new_msg
199
200def exit_with_message_if_errors(message, d):
201 qa_fatal_errors = bb.utils.to_boolean(d.getVar("QA_ERRORS_FOUND"), False)
202 if qa_fatal_errors:
203 bb.fatal(message)
204
205def exit_if_errors(d):
206 exit_with_message_if_errors("Fatal QA errors were found, failing task.", d)
207
174if __name__ == "__main__": 208if __name__ == "__main__":
175 import sys 209 import sys
176 210