Source: pdl
Version: 1:2.016-2
Severity: wishlist
Tags: patch upstream
User: reproducible-builds@lists.alioth.debian.org
Usertags: randomness toolchain
X-Debbugs-Cc: reproducible-builds@lists.alioth.debian.org

Hi!

While working on the "reproducible builds" effort [1], we have noticed
that pdl creates unsorted output.

The attached patch fixes this.
This is required to make some packages using pdl reproducible.

Regards,
 Reiner

[1]: https://wiki.debian.org/ReproducibleBuilds
diff --git a/debian/patches/series b/debian/patches/series
index 1e2152a..181e361 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
+sorted_output.patch
diff --git a/debian/patches/sorted_output.patch b/debian/patches/sorted_output.patch
new file mode 100644
index 0000000..41be8e2
--- /dev/null
+++ b/debian/patches/sorted_output.patch
@@ -0,0 +1,52 @@
+Author: Reiner Herrmann <rei...@reiner-h.de>
+Description: Sort output to make generated code reproducible
+
+--- a/Basic/Gen/PP.pm
++++ b/Basic/Gen/PP.pm
+@@ -2616,7 +2616,7 @@
+ 	my($parnames,$parobjs,$dimobjs,$havethreading) = @_;
+ 	my $str = ($havethreading?"pdl_thread __pdlthread; ":"").
+ 	  (join '',map {$parobjs->{$_}->get_incdecls} @$parnames).
+-	    (join '',map {$_->get_decldim} values %$dimobjs);
++	    (join '',sort map {$_->get_decldim} values %$dimobjs);
+ 	return ($str,undef);
+ }
+ 
+@@ -2627,7 +2627,7 @@
+ 	 : "").
+ 	 (join '',map {$parobjs->{$_}->get_incdecl_copy(sub{"\$PRIV($_[0])"},
+ 	 						sub{"$copyname->$_[0]"})} @$parnames).
+-	 (join '',map {$_->get_copydim(sub{"\$PRIV($_[0])"},
++	 (join '',sort map {$_->get_copydim(sub{"\$PRIV($_[0])"},
+ 						sub{"$copyname->$_[0]"})} values %$dimobjs);
+ 
+ }
+@@ -2790,7 +2790,7 @@
+     my $nn = $#$pnames;
+     my @privname = map { "\$PRIV(pdls[$_])" } ( 0 .. $nn );
+     $str .= $npdls ? "PDL_Indx __creating[$npdls];\n" : "PDL_Indx __creating[1];\n";
+-    $str .= join '',map {$_->get_initdim."\n"} values %$dobjs;
++    $str .= join '',sort map {$_->get_initdim."\n"} values %$dobjs;
+ 
+     # if FlagCreat is NOT true, then we set __creating[] to 0
+     # and we can use this knowledge below, and in hdrcheck()
+--- a/Basic/Gen/PP/PDLCode.pm
++++ b/Basic/Gen/PP/PDLCode.pm
+@@ -75,7 +75,7 @@
+         Name => $name,
+     }, $type;
+ 
+-    my $inccode = join '',map {$_->get_incregisters();} (values %{$this->{ParObjs}});
++    my $inccode = join '',sort map {$_->get_incregisters();} (values %{$this->{ParObjs}});
+ 
+     # First, separate the code into an array of C fragments (strings),
+     # variable references (strings starting with $) and
+@@ -165,7 +165,7 @@
+ 
+     # Then, in this form, put it together what we want the code to actually do.
+     print "SIZEPRIVS: ",(join ',',%$sizeprivs),"\n" if $::PP_VERBOSE;
+-    $this->{Code} = "{".(join '',values %$sizeprivs).
++    $this->{Code} = "{".(join '',sort values %$sizeprivs).
+        $coderef->get_str($this,[])
+        ."}";
+     $this->{Code};

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds

Reply via email to