Bug#1024638: opencv: embeds build path in Python extension

2023-01-31 Thread Victor Westerhuis
Vagrant Cascadian  schreef op 22 november 2022 
19:56:07 CET:
>On 2022-11-22, Victor Westerhuis wrote:
>> Stripping the rpath from the Python extension makes its BuildId
>> reproducible. The extension still works and both arch:all and arch:any
>> builds succeed locally.
>...
>> diff --git a/debian/rules b/debian/rules
>> index b4d654102..6bd845023 100755
>> --- a/debian/rules
>> +++ b/debian/rules
>> @@ -151,6 +151,7 @@ override_dh_auto_configure:
>>  -- --name=opencv --system=custom --configure-args "\
>>  dh_auto_configure -S cmake -D modules/python -B 
>> {build_dir} -- \
>>  -GNinja \
>> +-DCMAKE_SKIP_RPATH=ON \
>>  -DOpenCV_BINARY_DIR=$(CURDIR)/$(BUILDDIR) \
>>  
>> -DOPENCV_PYTHON_STANDALONE_INSTALL_PATH={install_dir} \
>>  -DOPENCV_SKIP_PYTHON_LOADER=ON \
>
>I would recommend using -DCMAKE_BUILD_RPATH_USE_ORIGIN=ON instead of
>-DCMAKE_SKIP_RPATH=ON.
Unfortunately the Python modules are built as a separate module via a separate 
Cmake invocation, so this has not worked. The rpaths passed to the linker of 
the Python libraries are absolute build paths, so they are not reproducible. 
>
>This is the default behavior with (the currently experimental) debhelper
>compat level 14. A little more detail on the issue is available here:
>
>  
> https://tests.reproducible-builds.org/debian/issues/unstable/cmake_rpath_contains_build_path_issue.html
>
>The main advantage of CMAKE_BUILD_RPATH_USE_ORIGIN is it is more likely
>to work with test suites that depend on the full path.
OpenCV does not ship tests for its Python module, so this is not an issue. 
>
>live well,
>  vagrant

Control: reopen -1

I would suggest to change the d/rules files to my original proposal. 
-- 
Groet, Regards,

Victor Westerhuis



Bug#1024638: opencv: embeds build path in Python extension

2022-11-22 Thread Vagrant Cascadian
On 2022-11-22, Victor Westerhuis wrote:
> Stripping the rpath from the Python extension makes its BuildId
> reproducible. The extension still works and both arch:all and arch:any
> builds succeed locally.
...
> diff --git a/debian/rules b/debian/rules
> index b4d654102..6bd845023 100755
> --- a/debian/rules
> +++ b/debian/rules
> @@ -151,6 +151,7 @@ override_dh_auto_configure:
>   -- --name=opencv --system=custom --configure-args "\
>   dh_auto_configure -S cmake -D modules/python -B 
> {build_dir} -- \
>   -GNinja \
> + -DCMAKE_SKIP_RPATH=ON \
>   -DOpenCV_BINARY_DIR=$(CURDIR)/$(BUILDDIR) \
>   
> -DOPENCV_PYTHON_STANDALONE_INSTALL_PATH={install_dir} \
>   -DOPENCV_SKIP_PYTHON_LOADER=ON \

I would recommend using -DCMAKE_BUILD_RPATH_USE_ORIGIN=ON instead of
-DCMAKE_SKIP_RPATH=ON.

This is the default behavior with (the currently experimental) debhelper
compat level 14. A little more detail on the issue is available here:

  
https://tests.reproducible-builds.org/debian/issues/unstable/cmake_rpath_contains_build_path_issue.html

The main advantage of CMAKE_BUILD_RPATH_USE_ORIGIN is it is more likely
to work with test suites that depend on the full path.

live well,
  vagrant


signature.asc
Description: PGP signature


Bug#1024638: opencv: embeds build path in Python extension

2022-11-22 Thread Victor Westerhuis
Source: opencv
Version: 4.6.0+dfsg-7
Severity: wishlist
Tags: patch
User: reproducible-bui...@lists.alioth.debian.org
Usertags: buildpath
X-Debbugs-Cc: reproducible-b...@lists.alioth.debian.org

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Hello maintainer,

Apologies for yet another small reproducible build patch. I neglected
to check my resolution for #972566 for reproducibility.

Stripping the rpath from the Python extension makes its BuildId
reproducible. The extension still works and both arch:all and arch:any
builds succeed locally.

Thanks for maintaining OpenCV!

Regards,

Victor Westerhuis

- -- System Information:
Debian Release: bookworm/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (100, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 6.0.0-4-amd64 (SMP w/4 CPU threads; PREEMPT)
Locale: LANG=en_NL.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_GB:en_US:en:nl_NL:nl
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)

-BEGIN PGP SIGNATURE-

iQJHBAEBCAAxFiEE6OxII3T+o0Ujs6ECQz2Rq5dHQPsFAmN85YQTHHZpY3RvckB3
ZXN0ZXJodS5pcwAKCRBDPZGrl0dA+4nTD/0VbXgUr5hsjE4SAGb/nTAJmXfEg6Cb
c1+pd9f4IfKhObGSfvkd24oNrgmvTQ9ZA1DyHQeMPFKmANNUh7lU2cAq+grgP/zK
BnTXFfFo+VST440W3PC6v9uWmBgU1tQ/CR+VLc+QDCXFSCx4yjfvWVn3F8YVFKjQ
TJHq4Vu6ynGMLFy//rHK1hT93Ehsqdywye9K1dvPKjOrfPbN15u+O+aUMIR/PFq4
sxi5HSpOF5Si3AujkKW0l5z6+hryc03wTD8/NcjpcKKcpe1KDXOAGSKkpet1APp4
/1D+UdsXQVc+ubve/XO5+pLEVznLTsa8QdhU39HZSGUwgoqkIIBwjRaO1Tmmb03+
jTCS1EmJameFnX9rc5QMsSALaB7wSigP/pY7wypJ9uN8dl6+JdCs/d0o5GDTsDT4
KfXbYecxjCqQtHrcRzCQPFniJ1k5+pPQfdciD9NfgqB9CXXkFcnBZUpbSLEqw6j0
BhmWNeVH2BIk7A1H81KbMiNmSWdSFbElLFm9hN8RsrbMWw/q/XShgwAKajxPxELn
faJ1JCB1leulSiuFekNf1nDas/6zPyo5ltDvqs9FYUWjvx5J213Mp4SIHupYVIly
m+cb9qdwyOQkEw8PcAI/RXM5BNKnpBFaQEFWtQbRrGYKxCg8ZbvqR5fzxxH59q+s
FScUESqwp7Xzbg==
=wUNR
-END PGP SIGNATURE-
>From fcd6886f1012fc20bf1a9bc194c120c889d5e220 Mon Sep 17 00:00:00 2001
From: Victor Westerhuis 
Date: Sun, 20 Nov 2022 22:20:24 +0100
Subject: [PATCH] Make Python extensions reproducible

Do not embed the build directory in the rpath.
---
 debian/rules | 1 +
 1 file changed, 1 insertion(+)

diff --git a/debian/rules b/debian/rules
index b4d654102..6bd845023 100755
--- a/debian/rules
+++ b/debian/rules
@@ -151,6 +151,7 @@ override_dh_auto_configure:
-- --name=opencv --system=custom --configure-args "\
dh_auto_configure -S cmake -D modules/python -B 
{build_dir} -- \
-GNinja \
+   -DCMAKE_SKIP_RPATH=ON \
-DOpenCV_BINARY_DIR=$(CURDIR)/$(BUILDDIR) \

-DOPENCV_PYTHON_STANDALONE_INSTALL_PATH={install_dir} \
-DOPENCV_SKIP_PYTHON_LOADER=ON \
-- 
2.38.1