diff options
| author | Hongxu Jia <hongxu.jia@windriver.com> | 2025-09-17 21:50:47 +0800 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-09-25 11:09:04 +0100 |
| commit | 52db4985e5c07aa84acdcf4000db3c2345fd4f3f (patch) | |
| tree | a30feef6adea48be858de74a0c1b501cabee0bf7 /meta/recipes-devtools/python/python3-cython | |
| parent | 4f99a9eb031020c10b2a10b431ab8be6d75a534e (diff) | |
| download | poky-52db4985e5c07aa84acdcf4000db3c2345fd4f3f.tar.gz | |
python3-cython: make generated source file be reproducible
While python3 module use cython to build library, the generated source file
is not stable at each build and made the generated library not be reproducible
This commit replaces un-predictable string with hardcode string in generated
source file to assure the generated library should be reproducible
(From OE-Core rev: 61d98d12eca1c7bdf3b7387a820c83d3b8fad965)
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/python/python3-cython')
| -rw-r--r-- | meta/recipes-devtools/python/python3-cython/0001-Replace-not-predictable-build-path-prefix-with-hardc.patch | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python3-cython/0001-Replace-not-predictable-build-path-prefix-with-hardc.patch b/meta/recipes-devtools/python/python3-cython/0001-Replace-not-predictable-build-path-prefix-with-hardc.patch new file mode 100644 index 0000000000..1fbbd8fd48 --- /dev/null +++ b/meta/recipes-devtools/python/python3-cython/0001-Replace-not-predictable-build-path-prefix-with-hardc.patch | |||
| @@ -0,0 +1,72 @@ | |||
| 1 | From 1690c505f1387e1884565021991a162e2f88f2b9 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Hongxu Jia <hongxu.jia@windriver.com> | ||
| 3 | Date: Wed, 17 Sep 2025 01:42:08 -0700 | ||
| 4 | Subject: [PATCH] Replace not predictable build path prefix with hardcode | ||
| 5 | string in the generated output file | ||
| 6 | |||
| 7 | The build path may contain tmp dir which is not predictable, it caused | ||
| 8 | the generated output file is not stable at each build and made | ||
| 9 | the generated library is not reproducible [1] between builds | ||
| 10 | |||
| 11 | vim frozenlist/_frozenlist.cpp | ||
| 12 | ... | ||
| 13 | /* BEGIN: Cython Metadata | ||
| 14 | { | ||
| 15 | "distutils": { | ||
| 16 | "depends": [], | ||
| 17 | "language": "c++", | ||
| 18 | "name": "frozenlist._frozenlist", | ||
| 19 | "sources": [ | ||
| 20 | "/tmp/.tmp-frozenlist-pep517-cfdvygni/src/frozenlist/_frozenlist.pyx" | ||
| 21 | ] | ||
| 22 | }, | ||
| 23 | "module_name": "frozenlist._frozenlist" | ||
| 24 | } | ||
| 25 | END: Cython Metadata */ | ||
| 26 | ... | ||
| 27 | |||
| 28 | Replace build path prefix with hardcode `build_path', it is no harm to | ||
| 29 | tweak comments in source file, after applied this commit, | ||
| 30 | vim frozenlist/_frozenlist.cpp | ||
| 31 | ... | ||
| 32 | /* BEGIN: Cython Metadata | ||
| 33 | { | ||
| 34 | "distutils": { | ||
| 35 | "depends": [], | ||
| 36 | "language": "c++", | ||
| 37 | "name": "frozenlist._frozenlist", | ||
| 38 | "sources": [ | ||
| 39 | "build_path/frozenlist/_frozenlist.pyx" | ||
| 40 | ] | ||
| 41 | }, | ||
| 42 | "module_name": "frozenlist._frozenlist" | ||
| 43 | } | ||
| 44 | END: Cython Metadata */ | ||
| 45 | ... | ||
| 46 | |||
| 47 | [1] https://reproducible-builds.org/ | ||
| 48 | |||
| 49 | Upstream-Status: Submitted [https://github.com/cython/cython/pull/7162] | ||
| 50 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | ||
| 51 | --- | ||
| 52 | Cython/Compiler/ModuleNode.py | 4 +++- | ||
| 53 | 1 file changed, 3 insertions(+), 1 deletion(-) | ||
| 54 | |||
| 55 | diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py | ||
| 56 | index 6672cb986..b1123515e 100644 | ||
| 57 | --- a/Cython/Compiler/ModuleNode.py | ||
| 58 | +++ b/Cython/Compiler/ModuleNode.py | ||
| 59 | @@ -779,7 +779,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): | ||
| 60 | code.put_generated_by() | ||
| 61 | if metadata: | ||
| 62 | code.putln("/* BEGIN: Cython Metadata") | ||
| 63 | - code.putln(json.dumps(metadata, indent=4, sort_keys=True)) | ||
| 64 | + _metadata = json.dumps(metadata, indent=4, sort_keys=True) | ||
| 65 | + _metadata = _metadata.replace(os.getcwd(), 'build_path') | ||
| 66 | + code.putln(_metadata) | ||
| 67 | code.putln("END: Cython Metadata */") | ||
| 68 | code.putln("") | ||
| 69 | |||
| 70 | -- | ||
| 71 | 2.49.0 | ||
| 72 | |||
