From f3bcd3c9a91f6212c30b9c778c11f3c8a9f6f1d4 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Sun, 27 Nov 2022 21:16:16 +0000 Subject: bitbake: ast/data/codeparser: Add dependencies from python module functions Moving code into python modules is a very effective way to reduce parsing time and overhead in recipes. The downside has always been that any dependency information on which variables those functions access is lost and the hashes can therefore become less reliable. This patch adds parsing of the imported module functions and that dependency information is them injected back into the hash dependency information. Intermodule function references are resolved to the full function call names in our module namespace to ensure interfunction dependencies are correctly handled too. (Bitbake rev: 605c478ce14cdc3c02d6ef6d57146a76d436a83c) (Bitbake rev: 91441e157e495b02db44e19e836afad366ee8924) Signed-off-by: Richard Purdie --- bitbake/lib/bb/parse/ast.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'bitbake/lib/bb/parse/ast.py') diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py index 862087c77d..375ba3cb79 100644 --- a/bitbake/lib/bb/parse/ast.py +++ b/bitbake/lib/bb/parse/ast.py @@ -290,6 +290,18 @@ class PyLibNode(AstNode): toimport = getattr(bb.utils._context[self.namespace], "BBIMPORTS", []) for i in toimport: bb.utils._context[self.namespace] = __import__(self.namespace + "." + i) + mod = getattr(bb.utils._context[self.namespace], i) + fn = getattr(mod, "__file__") + funcs = {} + for f in dir(mod): + if f.startswith("_"): + continue + fcall = getattr(mod, f) + if not callable(fcall): + continue + funcs[f] = fcall + bb.codeparser.add_module_functions(fn, funcs, "%s.%s" % (self.namespace, i)) + except AttributeError as e: bb.error("Error importing OE modules: %s" % str(e)) -- cgit v1.2.3-54-g00ecf