diff --git a/meta/lib/oe/__init__.py b/meta/lib/oe/__init__.py index 6eb536ad28..d760481283 100644 --- a/meta/lib/oe/__init__.py +++ b/meta/lib/oe/__init__.py @@ -7,6 +7,8 @@ from pkgutil import extend_path __path__ = extend_path(__path__, __name__) -BBIMPORTS = ["data", "path", "utils", "types", "package", "packagedata", \ +# Modules with vistorcode need to go first else anything depending on them won't be +# processed correctly (e.g. qa) +BBIMPORTS = ["qa", "data", "path", "utils", "types", "package", "packagedata", \ "packagegroup", "sstatesig", "lsb", "cachedpath", "license", \ - "qa", "reproducible", "rust", "buildcfg", "go"] + "reproducible", "rust", "buildcfg", "go"] diff --git a/meta/lib/oe/qa.py b/meta/lib/oe/qa.py index f8ae3c743f..e338ad6439 100644 --- a/meta/lib/oe/qa.py +++ b/meta/lib/oe/qa.py @@ -4,6 +4,7 @@ # SPDX-License-Identifier: GPL-2.0-only # +import ast import os, struct, mmap class NotELFFileError(Exception): @@ -186,6 +187,20 @@ def write_error(type, error, d): with open(logfile, "a+") as f: f.write("%s: %s [%s]\n" % (p, error, type)) +def handle_error_visitorcode(name, args): + execs = set() + contains = {} + warn = None + if isinstance(args[0], ast.Constant) and isinstance(args[0].value, str): + for i in ["ERROR_QA", "WARN_QA"]: + if i not in contains: + contains[i] = set() + contains[i].add(args[0].value) + else: + warn = args[0] + execs.add(name) + return contains, execs, warn + def handle_error(error_class, error_msg, d): if error_class in (d.getVar("ERROR_QA") or "").split(): write_error(error_class, error_msg, d) @@ -198,6 +213,7 @@ def handle_error(error_class, error_msg, d): else: bb.note("QA Issue: %s [%s]" % (error_msg, error_class)) return True +handle_error.visitorcode = handle_error_visitorcode def add_message(messages, section, new_msg): if section not in messages: