diff mbox series

[meta-selinux] libselinux-python: support reproducible builds

Message ID 20251120125334.2528444-1-hongxu.jia@windriver.com
State New
Headers show
Series [meta-selinux] libselinux-python: support reproducible builds | expand

Commit Message

Hongxu Jia Nov. 20, 2025, 12:53 p.m. UTC
Originally, direct_url.json contains build path and it was removed
to fix buildpaths issue, but the hash of direct_url.json in RECORD
was not updated. In order to support reproducible builds [1], this
commit manually updates hash of direct_url.json in RECORD after
build path was removed

[1] https://reproducible-builds.org/

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 recipes-security/selinux/libselinux-python_3.9.bb | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/recipes-security/selinux/libselinux-python_3.9.bb b/recipes-security/selinux/libselinux-python_3.9.bb
index a4de036..97e0043 100644
--- a/recipes-security/selinux/libselinux-python_3.9.bb
+++ b/recipes-security/selinux/libselinux-python_3.9.bb
@@ -51,9 +51,19 @@  do_install() {
         PYLIBVER='python${PYTHON_BASEVERSION}' \
         PYTHONLIBDIR='${PYTHON_SITEPACKAGES_DIR}'
 
+    dicect_url_json="${D}${PYTHON_SITEPACKAGES_DIR}/selinux-${PV}.dist-info/direct_url.json"
+    oldhash=$(nativepython3 -c "from pip._internal.operations.install.wheel import rehash; hash,len = rehash('$dicect_url_json'); print(f'{hash},{len}')")
+
     # Fix buildpaths issue
     sed -i -e 's,${WORKDIR},,g' \
-        ${D}${PYTHON_SITEPACKAGES_DIR}/selinux-${PV}.dist-info/direct_url.json
+        $dicect_url_json
+
+    newhash=$(nativepython3 -c "from pip._internal.operations.install.wheel import rehash; hash,len = rehash('$dicect_url_json'); print(f'{hash},{len}')")
+
+    # Update hash of direct_url.json in RECORD after build path was removed
+    sed -i -e "s/$oldhash/$newhash/g" \
+        ${D}${PYTHON_SITEPACKAGES_DIR}/selinux-${PV}.dist-info/RECORD
+
 }
 
 BBCLASSEXTEND += "native"