Source: pdl Version: 1:2.016-2 Severity: wishlist Tags: patch upstream User: [email protected] Usertags: randomness X-Debbugs-Cc: [email protected]
Hi! While working on the "reproducible builds" effort [1], we have noticed that pdl could not be built reproducibly. In several files the order is non-deterministic. The attached patch fixes the issues I have found so far. To be reproducible this also requires the pdl patch from #829323 and there is another issue in ExtUtils::ParseXS remaining, which is still uninvestigated. Regards, Reiner [1]: https://wiki.debian.org/ReproducibleBuilds
diff --git a/debian/patches/reproducible-build.patch b/debian/patches/reproducible-build.patch
new file mode 100644
index 0000000..ba877fb
--- /dev/null
+++ b/debian/patches/reproducible-build.patch
@@ -0,0 +1,102 @@
+--- a/Basic/Core/pdlcore.h.PL
++++ b/Basic/Core/pdlcore.h.PL
+@@ -148,7 +148,7 @@
+
+ !NO!SUBS!
+
+-for my $in ( keys %PDL_DATATYPES ) {
++for my $in ( sort keys %PDL_DATATYPES ) {
+
+ (my $type = $PDL_DATATYPES{$in}) =~ s/^PDL_//;
+ print OUT <<"!WITH!SUBS!";
+@@ -351,7 +351,7 @@
+ # file
+ require "Types.pm"; # ie PDL::Types
+
+-for (keys %PDL::Types::typehash) {
++for (sort keys %PDL::Types::typehash) {
+ my $ctype = $PDL::Types::typehash{$_}{ctype};
+ my $ppsym = $PDL::Types::typehash{$_}{ppsym};
+
+--- a/Basic/Slices/slices.pd
++++ b/Basic/Slices/slices.pd
+@@ -2899,7 +2899,7 @@
+ switch( p->datatype ) {
+ KLUDGE
+
+-for my $type(keys %PDL::Types::typehash) {
++for my $type(sort keys %PDL::Types::typehash) {
+ $sliceb_data_kludge .=
+ " case $type: nn = *( ($PDL::Types::typehash{$type}->{realctype} *)(p->data) ); break;\n";
+ }
+--- a/Basic/Ufunc/ufunc.pd
++++ b/Basic/Ufunc/ufunc.pd
+@@ -126,7 +126,7 @@
+ prodover => { name => 'product', op => '*=', init => 1, },
+ );
+
+-foreach my $func ( keys %over ) {
++foreach my $func ( sort keys %over ) {
+
+ # creates $func and cumu$func functions
+ # and d$func and dcumu$func functions, which
+@@ -243,7 +243,7 @@
+
+ );
+
+-foreach my $func ( keys %over ) {
++foreach my $func ( sort keys %over ) {
+
+ my $def = $over{$func}{def};
+ my $txt = $over{$func}{txt};
+@@ -438,7 +438,7 @@
+ # note: we export them to the PDL Core structure for use in
+ # other modules (eg Image2D)
+
+-for (keys %PDL::Types::typehash) {
++for (sort keys %PDL::Types::typehash) {
+ my $ctype = $PDL::Types::typehash{$_}{ctype};
+ my $ppsym = $PDL::Types::typehash{$_}{ppsym};
+
+--- a/Lib/Image2D/image2d.pd
++++ b/Lib/Image2D/image2d.pd
+@@ -137,7 +137,7 @@
+ 'pnpolyfill_pp' => {'pars' => '[o,nc] a(m,n); ps(k,l); int col()', 'special' => 'if(c) { $a() = $col(); }'}
+ );
+
+-for my $name (keys %pnpolyFields) {
++for my $name (sort keys %pnpolyFields) {
+ pp_def($name,
+ HandleBad => 0,
+ PMFunc => '',
+@@ -193,7 +193,7 @@
+
+ ');
+
+-for (keys %PDL::Types::typehash) {
++for (sort keys %PDL::Types::typehash) {
+ my $ctype = $PDL::Types::typehash{$_}{ctype};
+ my $ppsym = $PDL::Types::typehash{$_}{ppsym};
+
+--- a/Lib/Slatec/slatec.pd
++++ b/Lib/Slatec/slatec.pd
+@@ -375,7 +375,7 @@
+ my @talts = map {
+ defined $ftypes{$_} or die "FTYPE $_ NOT THERE\n";
+ [$ftypes{$_},$fnames->{$_}]
+- } keys %$fnames;
++ } sort keys %$fnames;
+
+ my $func = "\$T".(join '',map {$_->[0]} @talts) . "(" .
+ (join ',',map {$_->[1].$uscore} @talts).")";
+--- a/IO/HDF/buildfunc.pm
++++ b/IO/HDF/buildfunc.pm
+@@ -82,7 +82,7 @@
+ # Add the OUTPUT section:
+ $xsout .= "OUTPUT:\n";
+ $xsout .= "\tRETVAL\n";
+- foreach my $var ( keys %$output )
++ foreach my $var ( sort keys %$output )
+ {
+ $xsout .= "\t$var\n";
+ }
diff --git a/debian/patches/series b/debian/patches/series
index 1e2152a..3dc3319 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -10,3 +10,4 @@ manpage-has-bad-whatis-entry.patch
pdl-ldflags.patch
absolute-doc-paths.patch
spelling-errors2.patch
+reproducible-build.patch
signature.asc
Description: Digital signature

