tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

small perl5 reproducibility patch, review for all OS please



Hi,

Short version: please review the diff to lang/perl5 on all OS. Necessary for more a more reproducible perl5. Information on timestamps, metadata etc on reproducible-builds.org.
If I remember correctly the same version should still be in wip/perl5.


Long version:
in the long-term goal of more reproducbility, the perl5 I just committed to
wip, working on Guix since 2016 (and probably elsewhere variants of this),
makes the build of perl5 itself more reproducible (no idea about other factors yet
which are more general to our build environments etc, CFLAGS being debugged, etc), if you build it with PKGSRC_MKREPO (fixes for MKREPRO to be committed soon).
See the patch for more details why this is necessary.

This should affect all systems and should have picked the right approach for
ignoring kernel and fixing date, but since I had to remove some parts of
patch-Configure related to systems, and it affects all operating systems, I want a review on the buildability of this.

The osversion settings for the systems should no longer be needed, since the
output of uname -s is used, we can continue using $3.

This should not affect any perl5 packages, as far as I can by what perl
invocations I see inside the lang/perl5 directory. We don't seem to rely on
the build timestamp, and we don't seem to rely on the os version.
perl5 packages themselves need other fixes in the perl5 build process to become more reproducible.


PKGSRC_MKREPO is broken in some ways right now (and also far from complete)
which I am currently debugging.
? perl.diff
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/lang/perl5/distinfo,v
retrieving revision 1.178
diff -u -p -u -r1.178 distinfo
--- distinfo	25 Apr 2023 07:29:47 -0000	1.178
+++ distinfo	15 May 2023 16:52:46 -0000
@@ -3,7 +3,7 @@ $NetBSD: distinfo,v 1.178 2023/04/25 07:
 BLAKE2s (perl-5.36.1.tar.xz) = d1bfb3348be21613b3bde6246682ba15afe58d2dd786e99ffa8325ee368256c3
 SHA512 (perl-5.36.1.tar.xz) = 8d1ec654c59d078bfc477f11c9526233199a85e4d4f6f5a55bf9eb7802cd355189c669cc6785d2d5e741c1de4d740b7a0cfd3c0198122586a07ac7f527fb14af
 Size (perl-5.36.1.tar.xz) = 13053604 bytes
-SHA1 (patch-Configure) = a72983dba63f32f57418f2702b039585ba7236a7
+SHA1 (patch-Configure) = 7c9d603985538a35e1e6b22b252efc54d53d3170
 SHA1 (patch-Makefile.SH) = 56203aea57c429a94760f039a978463b8859b0a9
 SHA1 (patch-caretx.c) = b76b4175a58123fa4dfd2adf36b2207dcb6cf65a
 SHA1 (patch-cpan_ExtUtils-MakeMaker_lib_ExtUtils_MM__BeOS.pm) = 79e5aeccfa272ca5ec08bffc616d8053ae90ac51
@@ -14,3 +14,4 @@ SHA1 (patch-hints_linux.sh) = 4baa8f8069
 SHA1 (patch-hints_netbsd.sh) = 0d549a48800372d75fe34b783529a78cba90f646
 SHA1 (patch-hints_solaris__2.sh) = 364a28ca57dbabe1f902b601e336532996db6a0e
 SHA1 (patch-installperl) = b129d64cc17b898b44fe6282b8b1df36e342d0ef
+SHA1 (patch-perl.c) = 7730326b2dc6b4276d5b82a57bae133255c23c67
Index: patches/patch-Configure
===================================================================
RCS file: /cvsroot/pkgsrc/lang/perl5/patches/patch-Configure,v
retrieving revision 1.11
diff -u -p -u -r1.11 patch-Configure
--- patches/patch-Configure	24 May 2021 17:46:25 -0000	1.11
+++ patches/patch-Configure	15 May 2023 16:52:46 -0000
@@ -8,57 +8,69 @@ $NetBSD: patch-Configure,v 1.11 2021/05/
 * Several other changes.
 * Add rpath for QNX
 
+* reproducibility patch from guix:
+Don't encode the current timestamp.
+See https://reproducible-builds.org/docs/timestamps/
+https://reproducible-builds.org/docs/timezones/
+etc to see why this matters.
+
+This affects the output of `perl -V`, specifically the message "Compiled
+at [...]".
+
+The 'cf_time' and 'cf_by' values show up in 'config.h' and
+in 'Config_heavy.pl'.
+
+Use the output of 'uname -s' instead of 'uname -a' to avoid recording
+the kernel version ('uname -o' leads to directory names like
+'x86_64-gnulinux' instead of 'x86_64-linux', which might cause breakage
+down the road.)
+
 --- Configure.orig	2021-05-04 06:52:48.000000000 +0000
 +++ Configure
-@@ -3482,13 +3482,14 @@ EOM
- 			osvers="$3"
+@@ -3317,7 +3317,7 @@
+ : Try to determine whether config.sh was made on this system
+ case "$config_sh" in
+ '')
+-myuname=`$uname -a 2>/dev/null`
++myuname=`$uname -s 2>/dev/null`
+ $test -z "$myuname" && myuname=`hostname 2>/dev/null`
+ # Downcase everything to avoid ambiguity.
+ # Remove slashes and single quotes so we can use parts of this in
+@@ -3520,7 +3520,7 @@
  			;;
- 		dragonfly) osname=dragonfly
--			osvers="$3"
-+			osvers=`$uname -r | UU/tr '[A-Z]' '[a-z]'`
+ 		MiNT)	osname=mint
  			;;
- 		dynixptx*) osname=dynixptx
- 			osvers=`echo "$4"|sed 's/^v//'`
- 			;;
- 		freebsd) osname=freebsd
--			osvers="$3" ;;
-+			osvers=`$uname -r | UU/tr '[A-Z]' '[a-z]'`
-+			;;
- 		genix)	osname=genix ;;
- 		gnu)	osname=gnu
- 			osvers="$3" ;;
-@@ -3513,8 +3514,11 @@ EOM
- 		minix)	osname=minix
+-		minix)	osname=minix
++		minix*)	osname=minix
  			osvers=`$uname -r`
  			;;
-+		minix*) osname=minix
-+			osvers=`$uname -r`
-+			;;
  		netbsd*) osname=netbsd
--			osvers="$3"
-+			osvers=`$uname -r | UU/tr '[A-Z]' '[a-z]'`
- 			;;
- 		news-os) osvers="$3"
- 			case "$3" in
-@@ -3524,7 +3528,7 @@ EOM
- 			;;
- 		nonstop-ux) osname=nonstopux ;;
- 		openbsd) osname=openbsd
--			osvers="$3"
-+			osvers=`$uname -r | UU/tr '[A-Z]' '[a-z]'`
- 			;;
- 		os2)	osname=os2
- 			osvers="$4"
-@@ -3539,6 +3543,9 @@ EOM
+@@ -3549,6 +3549,9 @@
  		qnx) osname=qnx
  			osvers="$4"
  			;;
 +		sco_sv) osname=sco_sv
-+			osvers=`$uname -r`v`$uname -v`
++			osvers="$3"
 +			;;
  		solaris) osname=solaris
  			case "$3" in
  			5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
+@@ -3889,13 +3889,13 @@
+ . ./posthint.sh
+ 
+ : who configured the system
+-cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
++cf_time="1970-01-01"
+ case "$cf_by" in
+ "")
+ 	cf_by=`(logname) 2>/dev/null`
+ 	case "$cf_by" in
+ 	"")
+-		cf_by=`(whoami) 2>/dev/null`
++		cf_by="pkgsrc"
+ 		case "$cf_by" in
+ 		"") cf_by=unknown ;;
+ 		esac ;;
 @@ -4861,7 +4868,7 @@ esac
  # If using gcc or clang, we can get better values for libpth, incpth
  # and usrinc directly from the compiler.
Index: patches/patch-perl.c
===================================================================
RCS file: patches/patch-perl.c
diff -N patches/patch-perl.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-perl.c	15 May 2023 16:52:46 -0000
@@ -0,0 +1,10 @@
+--- perl.c.orig	2023-05-08 22:16:08.305668988 +0200
++++ perl.c	2023-05-08 22:18:56.293971052 +0200
+@@ -2015,6 +2015,7 @@
+     PUSHs(Perl_newSVpvn_flags(aTHX_ non_bincompat_options,
+                               sizeof(non_bincompat_options) - 1, SVs_TEMP));
+ 
++#define PERL_BUILD_DATE "Jan  1 1970 00:00:00"
+ #ifndef PERL_BUILD_DATE
+ #  ifdef __DATE__
+ #    ifdef __TIME__


Home | Main Index | Thread Index | Old Index