diff options
-rw-r--r-- | meta/recipes-devtools/python/python3-maturin/0001-build_context-improve-wheel-reproducibility-by-sorti.patch | 55 | ||||
-rw-r--r-- | meta/recipes-devtools/python/python3-maturin_1.7.1.bb | 1 |
2 files changed, 56 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python3-maturin/0001-build_context-improve-wheel-reproducibility-by-sorti.patch b/meta/recipes-devtools/python/python3-maturin/0001-build_context-improve-wheel-reproducibility-by-sorti.patch new file mode 100644 index 0000000000..83b586ff72 --- /dev/null +++ b/meta/recipes-devtools/python/python3-maturin/0001-build_context-improve-wheel-reproducibility-by-sorti.patch | |||
@@ -0,0 +1,55 @@ | |||
1 | From 49b985d7f5a4582bf9e2c58b6220124e2b7aa395 Mon Sep 17 00:00:00 2001 | ||
2 | From: Yoann Congal <yoann.congal@smile.fr> | ||
3 | Date: Thu, 17 Oct 2024 22:17:20 +0200 | ||
4 | Subject: [PATCH] build_context: improve wheel reproducibility by sorting libs | ||
5 | (#2261) | ||
6 | |||
7 | OE-core note: Upstream does not have a commit message for this. Bellow | ||
8 | is the message I've sent: | ||
9 | > While tracking a reproducibility issue from maturin's output, we found | ||
10 | > that the .so file in the output .whl were not ordered the same | ||
11 | > every time. | ||
12 | > | ||
13 | > Order of the external libraries in the .whl comes down to the order | ||
14 | > `soname_map` is iterated. But, `std::HashMap` does not provide a stable | ||
15 | > order and that create an unstable order in the wheel. | ||
16 | > | ||
17 | > Switch to `std::BTreeMap` which keeps keys sorted and is iterable | ||
18 | > in a stable order. | ||
19 | > | ||
20 | > This can be tested by building current python3-cryptography : | ||
21 | > SOURCE_DATE_EPOCH=1728915855 maturin build | ||
22 | > | ||
23 | > Before this commit, the above give two possible outputs (~50% each), the | ||
24 | > difference is in the order of libssl and libcrypto. | ||
25 | > | ||
26 | > After this commit, the output is reproducible. | ||
27 | |||
28 | Signed-off-by: Yoann Congal <yoann.congal@smile.fr> | ||
29 | Upstream-Status: Backport [https://github.com/PyO3/maturin/commit/61d54809776e1ca79ff8cc92387d70796d50c16e] | ||
30 | --- | ||
31 | src/build_context.rs | 4 ++-- | ||
32 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
33 | |||
34 | diff --git a/src/build_context.rs b/src/build_context.rs | ||
35 | index 2e498537..6fbd25c1 100644 | ||
36 | --- a/src/build_context.rs | ||
37 | +++ b/src/build_context.rs | ||
38 | @@ -24,7 +24,7 @@ use normpath::PathExt; | ||
39 | use pep508_rs::Requirement; | ||
40 | use platform_info::*; | ||
41 | use sha2::{Digest, Sha256}; | ||
42 | -use std::collections::{HashMap, HashSet}; | ||
43 | +use std::collections::{BTreeMap, HashSet}; | ||
44 | use std::env; | ||
45 | use std::fmt::{Display, Formatter}; | ||
46 | use std::io; | ||
47 | @@ -396,7 +396,7 @@ impl BuildContext { | ||
48 | writer.add_directory(&libs_dir)?; | ||
49 | |||
50 | let temp_dir = tempfile::tempdir()?; | ||
51 | - let mut soname_map = HashMap::new(); | ||
52 | + let mut soname_map = BTreeMap::new(); | ||
53 | let mut libs_copied = HashSet::new(); | ||
54 | for lib in ext_libs.iter().flatten() { | ||
55 | let lib_path = lib.realpath.clone().with_context(|| { | ||
diff --git a/meta/recipes-devtools/python/python3-maturin_1.7.1.bb b/meta/recipes-devtools/python/python3-maturin_1.7.1.bb index b9279f5ab5..8837128896 100644 --- a/meta/recipes-devtools/python/python3-maturin_1.7.1.bb +++ b/meta/recipes-devtools/python/python3-maturin_1.7.1.bb | |||
@@ -12,6 +12,7 @@ SRC_URI:append = "\ | |||
12 | file://0003-Extract-extension-ABI-name-resolvation-code-as-helpe.patch \ | 12 | file://0003-Extract-extension-ABI-name-resolvation-code-as-helpe.patch \ |
13 | file://0004-Fix-cross-compilation-issue-with-linux-ppc-architect.patch \ | 13 | file://0004-Fix-cross-compilation-issue-with-linux-ppc-architect.patch \ |
14 | file://0005-Fix-cross-compilation-issue-with-linux-mips64-archit.patch \ | 14 | file://0005-Fix-cross-compilation-issue-with-linux-mips64-archit.patch \ |
15 | file://0001-build_context-improve-wheel-reproducibility-by-sorti.patch \ | ||
15 | " | 16 | " |
16 | 17 | ||
17 | S = "${WORKDIR}/maturin-${PV}" | 18 | S = "${WORKDIR}/maturin-${PV}" |