Early functions like do_recipe_qa (which do_fetch depends upon) reference oe.qa.handle_error() which in turn adds dependencies on ERROR_QA and WARN_QA. This means that ERROR_QA:append = " nothing" will cause literally everything to rebuild and break sstate reuse.
Take advantage of new bitbake functionality to add a custom visitorcode function to handle_error which optimises the references into contains expressions which means the ERROR_QA and WARN_QA references are optmised to containing specific strings. This dramatically improves sstate reuse. The qa module has to be imported first since other code in later modules references it and bitbake can't handle the dependency ordering internally without a lot of unwanted complexity. Signed-off-by: Richard Purdie <[email protected]> --- meta/lib/oe/__init__.py | 6 ++++-- meta/lib/oe/qa.py | 11 +++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/meta/lib/oe/__init__.py b/meta/lib/oe/__init__.py index 6eb536ad284..d7604812834 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 f8ae3c743ff..2c558673701 100644 --- a/meta/lib/oe/qa.py +++ b/meta/lib/oe/qa.py @@ -199,6 +199,17 @@ def handle_error(error_class, error_msg, d): bb.note("QA Issue: %s [%s]" % (error_msg, error_class)) return True +handle_error.visitorcode = """ +if isinstance(args[0], ast.Constant) and isinstance(args[0].value, str): + for i in ["ERROR_QA", "WARN_QA"]: + if i not in self.contains: + self.contains[i] = set() + self.contains[i].add(args[0].value) +else: + self.warn(node.func, args[0]) + self.execs.add(name) +""" + def add_message(messages, section, new_msg): if section not in messages: messages[section] = new_msg
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#203880): https://lists.openembedded.org/g/openembedded-core/message/203880 Mute This Topic: https://lists.openembedded.org/mt/108140367/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
