It was noticed that __config__.py contains details of the build machine
hardware, which is another source of non-reproducibility.

As this file is only used to dump the build configuration on errors, we
can remove entries that leak build details entirely.

Signed-off-by: Ross Burton <[email protected]>
---
 .../python/python3-numpy_2.5.3.bb             | 21 ++++++++-----------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/meta/recipes-devtools/python/python3-numpy_2.5.3.bb 
b/meta/recipes-devtools/python/python3-numpy_2.5.3.bb
index c88b0bf1a29..338bdd2bbd0 100644
--- a/meta/recipes-devtools/python/python3-numpy_2.5.3.bb
+++ b/meta/recipes-devtools/python/python3-numpy_2.5.3.bb
@@ -26,20 +26,17 @@ PACKAGECONFIG[svml] = 
"-Ddisable-svml=false,-Ddisable-svml=true"
 # the overflow tests fail with compiler-rt on aarch64
 LDFLAGS:append:toolchain-clang:aarch64 = " -rtlib=libgcc -unwindlib=libgcc"
 
-# Remove references to buildpaths from numpy's __config__.py
-do_install:append() {
+# To ensure reproducibility, remove entries from __config__ which expose build
+# machine details, such as build paths, host paths, and hardware configuration.
+strip_build_info() {
     sed -i \
-        -e 's|${S}=||g' \
-        -e 's|${B}=||g' \
-        -e 's|${HOSTTOOLS_DIR}||g' \
-        -e 's|${RECIPE_SYSROOT_NATIVE}=||g' \
-        -e 's|${RECIPE_SYSROOT_NATIVE}||g' \
-        -e 's|${RECIPE_SYSROOT}=||g' \
-        -e 's|${RECIPE_SYSROOT}||g' \
-        ${D}${PYTHON_SITEPACKAGES_DIR}/numpy/__config__.py
-
-    nativepython3 -mcompileall -s ${D} 
${D}${PYTHON_SITEPACKAGES_DIR}/numpy/__config__.py
+        -e 's/@.*_ARGS@//' \
+        -e 's/@.*_CMD_ARRAY@//' \
+        -e 's/@BUILD_CPU.*@//' \
+        -e 's/@PYTHON_PATH@//' \
+        ${S}/numpy/__config__.py.in
 }
+do_patch[postfuncs] += "strip_build_info"
 
 do_install_ptest:append() {
     sed -i \
-- 
2.43.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#245585): 
https://lists.openembedded.org/g/openembedded-core/message/245585
Mute This Topic: https://lists.openembedded.org/mt/121182208/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to