diff options
Diffstat (limited to 'meta/lib/oe/qa.py')
-rw-r--r-- | meta/lib/oe/qa.py | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/meta/lib/oe/qa.py b/meta/lib/oe/qa.py index f8ae3c743f..cd36cb5070 100644 --- a/meta/lib/oe/qa.py +++ b/meta/lib/oe/qa.py | |||
@@ -4,6 +4,7 @@ | |||
4 | # SPDX-License-Identifier: GPL-2.0-only | 4 | # SPDX-License-Identifier: GPL-2.0-only |
5 | # | 5 | # |
6 | 6 | ||
7 | import ast | ||
7 | import os, struct, mmap | 8 | import os, struct, mmap |
8 | 9 | ||
9 | class NotELFFileError(Exception): | 10 | class NotELFFileError(Exception): |
@@ -186,6 +187,20 @@ def write_error(type, error, d): | |||
186 | with open(logfile, "a+") as f: | 187 | with open(logfile, "a+") as f: |
187 | f.write("%s: %s [%s]\n" % (p, error, type)) | 188 | f.write("%s: %s [%s]\n" % (p, error, type)) |
188 | 189 | ||
190 | def handle_error_visitorcode(name, args): | ||
191 | execs = set() | ||
192 | contains = {} | ||
193 | warn = None | ||
194 | if isinstance(args[0], ast.Constant) and isinstance(args[0].value, str): | ||
195 | for i in ["ERROR_QA", "WARN_QA"]: | ||
196 | if i not in contains: | ||
197 | contains[i] = set() | ||
198 | contains[i].add(args[0].value) | ||
199 | else: | ||
200 | warn = args[0] | ||
201 | execs.add(name) | ||
202 | return contains, execs, warn | ||
203 | |||
189 | def handle_error(error_class, error_msg, d): | 204 | def handle_error(error_class, error_msg, d): |
190 | if error_class in (d.getVar("ERROR_QA") or "").split(): | 205 | if error_class in (d.getVar("ERROR_QA") or "").split(): |
191 | write_error(error_class, error_msg, d) | 206 | write_error(error_class, error_msg, d) |
@@ -198,12 +213,7 @@ def handle_error(error_class, error_msg, d): | |||
198 | else: | 213 | else: |
199 | bb.note("QA Issue: %s [%s]" % (error_msg, error_class)) | 214 | bb.note("QA Issue: %s [%s]" % (error_msg, error_class)) |
200 | return True | 215 | return True |
201 | 216 | handle_error.visitorcode = handle_error_visitorcode | |
202 | def add_message(messages, section, new_msg): | ||
203 | if section not in messages: | ||
204 | messages[section] = new_msg | ||
205 | else: | ||
206 | messages[section] = messages[section] + "\n" + new_msg | ||
207 | 217 | ||
208 | def exit_with_message_if_errors(message, d): | 218 | def exit_with_message_if_errors(message, d): |
209 | qa_fatal_errors = bb.utils.to_boolean(d.getVar("QA_ERRORS_FOUND"), False) | 219 | qa_fatal_errors = bb.utils.to_boolean(d.getVar("QA_ERRORS_FOUND"), False) |