[RFC,v3,2/4] python3-native: Skip testing import of modules

Message ID 20211204212940.3787349-3-jacob.kroon@gmail.com
State New
Headers show
Series Improve native/cross reproducibility | expand

Commit Message

Jacob Kroon Dec. 4, 2021, 9:29 p.m. UTC
Building python3-native involves running the resulting native binary
as part of a test to import the built modules. If this fails the modules
will be renamed with an appended "failed" suffix. One of the upcoming patches
removes ${STAGING_LIBDIR_NATIVE} and ${STAGING_BASE_LIBDIR_NATIVE} from the
rpath, which means this step will fail. Patch python3 not to perform the
import test, so that the modules won't end up with invalid names.

Signed-off-by: Jacob Kroon <jacob.kroon@gmail.com>
---
 .../python/python3/no-import-test.patch            | 14 ++++++++++++++
 meta/recipes-devtools/python/python3_3.10.0.bb     |  1 +
 2 files changed, 15 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3/no-import-test.patch

Patch

diff --git a/meta/recipes-devtools/python/python3/no-import-test.patch b/meta/recipes-devtools/python/python3/no-import-test.patch
new file mode 100644
index 0000000000..d944e55cc5
--- /dev/null
+++ b/meta/recipes-devtools/python/python3/no-import-test.patch
@@ -0,0 +1,14 @@ 
+Index: Python-3.10.0/setup.py
+===================================================================
+--- Python-3.10.0.orig/setup.py
++++ Python-3.10.0/setup.py
+@@ -644,6 +644,9 @@ class PyBuildExt(build_ext):
+         if CROSS_COMPILING:
+             return
+ 
++        # Skip import test
++        return
++
+         loader = importlib.machinery.ExtensionFileLoader(ext.name, ext_filename)
+         spec = importlib.util.spec_from_file_location(ext.name, ext_filename,
+                                                       loader=loader)
diff --git a/meta/recipes-devtools/python/python3_3.10.0.bb b/meta/recipes-devtools/python/python3_3.10.0.bb
index e3300b6495..c9f21b5e16 100644
--- a/meta/recipes-devtools/python/python3_3.10.0.bb
+++ b/meta/recipes-devtools/python/python3_3.10.0.bb
@@ -40,6 +40,7 @@  SRC_URI:append:class-native = " \
            file://0001-distutils-sysconfig-append-STAGING_LIBDIR-python-sys.patch \
            file://12-distutils-prefix-is-inside-staging-area.patch \
            file://0001-Don-t-search-system-for-headers-libraries.patch \
+           file://no-import-test.patch \
            "
 SRC_URI[sha256sum] = "5a99f8e7a6a11a7b98b4e75e0d1303d3832cada5534068f69c7b6222a7b1b002"