Skip to contentSkip to conversation

python3-pynacl: Fix reproduciblity

PATCH New Khem Raj 1 participant 1 message Oct 15, 2025

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 python3-pynacl: Fix reproduciblity

glob output isn't guaranteed to be in any particular order, so _sodium.*.so wasn't always reproducible.

Cc Yoann Congal <[email protected]>
Cc Hongxu Jia <[email protected]>
---
 .../0001-Build-bindings-reproducibly.patch    | 39 +++++++++++++++++++
 .../python/python3-pynacl_1.5.0.bb            |  1 +
 2 files changed, 40 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-pynacl/0001-Build-bindings-reproducibly.patch
meta-python/recipes-devtools/python/python3-pynacl/0001-Build-bindings-reproducibly.patch new file +39 -0
new file mode 100644
index 0000000000..3e7480b485
@@ -0,0 +1,39 @@
+From eccc9ea5eef13ee353de610af36fb7759b70e2e4 Mon Sep 17 00:00:00 2001
+From: Colin Watson <[email protected]>
+Date: Mon, 26 Aug 2024 18:14:33 +0100
+Subject: [PATCH] Build bindings reproducibly
+
+`glob` output isn't guaranteed to be in any particular order, so
+`_sodium.*.so` wasn't always reproducible.
+
+Upstream-Status: Backport [https://github.com/pyca/pynacl/pull/836]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ src/bindings/build.py | 12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/src/bindings/build.py b/src/bindings/build.py
+index 9634237..777237b 100644
+--- a/src/bindings/build.py
++++ b/src/bindings/build.py
+@@ -22,12 +22,16 @@ from cffi import FFI
+ __all__ = ["ffi"]
+
+
+-HEADERS = glob.glob(
+-    os.path.join(os.path.abspath(os.path.dirname(__file__)), "*.h")
++HEADERS = sorted(
++    glob.glob(os.path.join(os.path.abspath(os.path.dirname(__file__)), "*.h"))
+ )
+
+-MINIMAL_HEADERS = glob.glob(
+-    os.path.join(os.path.abspath(os.path.dirname(__file__)), "minimal", "*.h")
++MINIMAL_HEADERS = sorted(
++    glob.glob(
++        os.path.join(
++            os.path.abspath(os.path.dirname(__file__)), "minimal", "*.h"
++        )
++    )
+ )
+
+
meta-python/recipes-devtools/python/python3-pynacl_1.5.0.bb +1 -0
index 77ca2e1ff4..393066de9d 100644
@@ -4,6 +4,7 @@ HOMEPAGE = "https://github.com/pyca/pynacl"
 LICENSE = "Apache-2.0"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=8cc789b082b3d97e1ccc5261f8594d3f"
 
+SRC_URI += "file://0001-Build-bindings-reproducibly.patch"
 SRC_URI[sha256sum] = "8ac7448f09ab85811607bdd21ec2464495ac8b7c66d146bf545b0f08fb9220ba"
 
 PYPI_PACKAGE = "PyNaCl"