Source: libparse-recdescent-perl
Version: 1.967009+dfsg-1
Severity: wishlist
Tags: patch
User: reproducible-builds@lists.alioth.debian.org
Usertags: toolchain randomness
Forwarded: https://rt.cpan.org/Public/Bug/Display.html?id=102160

Hi!

While working on Debian's “reproducible builds” effort [1], we have
noticed that libparse-recdescent-perl produces grammar files with
elements in random order, which results in other packages being
unreproducible.

The attached patch, which I have already forwarded upstream,
fixes this.

Regards,
 Reiner

[1]: https://wiki.debian.org/ReproducibleBuilds
diff --git a/debian/patches/reproducible_grammar.patch b/debian/patches/reproducible_grammar.patch
new file mode 100644
index 0000000..3404321
--- /dev/null
+++ b/debian/patches/reproducible_grammar.patch
@@ -0,0 +1,25 @@
+Author: Reiner Herrmann <rei...@reiner-h.de>
+Description: produce reproducible grammar files
+Forwarded: https://rt.cpan.org/Public/Bug/Display.html?id=102160
+
+Index: libparse-recdescent-perl-1.967009+dfsg/lib/Parse/RecDescent.pm
+===================================================================
+--- libparse-recdescent-perl-1.967009+dfsg.orig/lib/Parse/RecDescent.pm
++++ libparse-recdescent-perl-1.967009+dfsg/lib/Parse/RecDescent.pm
+@@ -144,6 +144,7 @@ sub Precompile
+     print OUT "my ";
+ 
+     require Data::Dumper;
++    $Data::Dumper::Sortkeys = 1;
+     $code = Data::Dumper->Dump([$self], [qw(self)]);
+     if ($opt{-standalone}) {
+         $code =~ s/Parse::RecDescent/$runtime_package/gs;
+@@ -3082,7 +3083,7 @@ local \$SIG{__WARN__} = sub {0};
+     $self->{"startcode"} = '';
+ 
+     my $rule;
+-    foreach $rule ( values %{$self->{"rules"}} )
++    foreach $rule ( sort { $a->{name} cmp $b->{name} } values %{$self->{"rules"}} )
+     {
+         if ($rule->{"changed"})
+         {
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..d2c4421
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+reproducible_grammar.patch

Attachment: signature.asc
Description: OpenPGP 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