diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-11-27 21:16:16 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-12-17 08:52:28 +0000 |
commit | f3bcd3c9a91f6212c30b9c778c11f3c8a9f6f1d4 (patch) | |
tree | 760b8dac27191ea1a625476d84c0651aa2788a5f /bitbake/lib/bb/parse/ast.py | |
parent | a225aa3ec4726161172ca4b03d02751b1250e7ae (diff) | |
download | poky-f3bcd3c9a91f6212c30b9c778c11f3c8a9f6f1d4.tar.gz |
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 <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/parse/ast.py')
-rw-r--r-- | bitbake/lib/bb/parse/ast.py | 12 |
1 files changed, 12 insertions, 0 deletions
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): | |||
290 | toimport = getattr(bb.utils._context[self.namespace], "BBIMPORTS", []) | 290 | toimport = getattr(bb.utils._context[self.namespace], "BBIMPORTS", []) |
291 | for i in toimport: | 291 | for i in toimport: |
292 | bb.utils._context[self.namespace] = __import__(self.namespace + "." + i) | 292 | bb.utils._context[self.namespace] = __import__(self.namespace + "." + i) |
293 | mod = getattr(bb.utils._context[self.namespace], i) | ||
294 | fn = getattr(mod, "__file__") | ||
295 | funcs = {} | ||
296 | for f in dir(mod): | ||
297 | if f.startswith("_"): | ||
298 | continue | ||
299 | fcall = getattr(mod, f) | ||
300 | if not callable(fcall): | ||
301 | continue | ||
302 | funcs[f] = fcall | ||
303 | bb.codeparser.add_module_functions(fn, funcs, "%s.%s" % (self.namespace, i)) | ||
304 | |||
293 | except AttributeError as e: | 305 | except AttributeError as e: |
294 | bb.error("Error importing OE modules: %s" % str(e)) | 306 | bb.error("Error importing OE modules: %s" % str(e)) |
295 | 307 | ||