diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-06-30 23:12:50 +0100 |
---|---|---|
committer | Steve Sakoman <steve@sakoman.com> | 2024-07-26 07:43:46 -0700 |
commit | ea50e03fd20c93aea377079321cf7edbe6fbe3c6 (patch) | |
tree | f5a355049384716b16658b2a7ed6e4f4da8553d0 | |
parent | 7b4cc330228d1853a74e85fb415f9a06b8183927 (diff) | |
download | poky-ea50e03fd20c93aea377079321cf7edbe6fbe3c6.tar.gz |
bitbake: codeparser: Skip non-local functions for module dependencies
If modules do something like "from glob import glob" then we end up
checksumming the glob code. That leads to bugs as the code can change
between different python versions for example, leading to checksum
instability.
We should ignore functions not from the current file as implemented
by this change.
(Bitbake rev: 11d83170922a2c6b9db1f6e8c23e533526984b2c)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 1e6f862864539d6f6a0bea3e4479e0dd40ff3091)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r-- | bitbake/lib/bb/codeparser.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/bitbake/lib/bb/codeparser.py b/bitbake/lib/bb/codeparser.py index 0b2890cf8a..1001ca1900 100644 --- a/bitbake/lib/bb/codeparser.py +++ b/bitbake/lib/bb/codeparser.py | |||
@@ -72,6 +72,11 @@ def add_module_functions(fn, functions, namespace): | |||
72 | parser.parse_python(None, filename=fn, lineno=1, fixedhash=fixedhash+f) | 72 | parser.parse_python(None, filename=fn, lineno=1, fixedhash=fixedhash+f) |
73 | #bb.warn("Cached %s" % f) | 73 | #bb.warn("Cached %s" % f) |
74 | except KeyError: | 74 | except KeyError: |
75 | targetfn = inspect.getsourcefile(functions[f]) | ||
76 | if fn != targetfn: | ||
77 | # Skip references to other modules outside this file | ||
78 | #bb.warn("Skipping %s" % name) | ||
79 | continue | ||
75 | lines, lineno = inspect.getsourcelines(functions[f]) | 80 | lines, lineno = inspect.getsourcelines(functions[f]) |
76 | src = "".join(lines) | 81 | src = "".join(lines) |
77 | parser.parse_python(src, filename=fn, lineno=lineno, fixedhash=fixedhash+f) | 82 | parser.parse_python(src, filename=fn, lineno=lineno, fixedhash=fixedhash+f) |