Source: libwx-perl
Version: 1:0.9923-4
Severity: wishlist
Tags: patch
User: reproducible-bui...@lists.alioth.debian.org
Usertags: randomness
X-Debbugs-CC: reproducible-bui...@lists.alioth.debian.org

Hi!

While working on Debian's “reproducible builds” effort [1], we have
noticed that libwx-perl doesn't build reproducibly.
One issue is that some files generated during build contain lines in
random order.
The attached patch fixes this by sorting the results.

There is also another issue. .c/.h files generated during build
with ExtUtils::ParseXS (xsubpp) are also undeterministic, which
leads to differing .so files, also shown in the diff [2].
But this problem has to be solved in the ParseXS module, not in this
package.


Regards,
 Reiner

[1]: https://wiki.debian.org/ReproducibleBuilds
[2]: https://reproducible.debian.net/rb-pkg/unstable/amd64/libwx-perl.html
diff --git a/debian/patches/reproducible_output.patch b/debian/patches/reproducible_output.patch
new file mode 100644
index 0000000..a663d2a
--- /dev/null
+++ b/debian/patches/reproducible_output.patch
@@ -0,0 +1,70 @@
+Author: Reiner Herrmann <rei...@reiner-h.de>
+Description: Produce sorted output to get reproducible results
+
+Index: libwx-perl-0.9923/build/Wx/build/MakeMaker/Any_OS.pm
+===================================================================
+--- libwx-perl-0.9923.orig/build/Wx/build/MakeMaker/Any_OS.pm
++++ libwx-perl-0.9923/build/Wx/build/MakeMaker/Any_OS.pm
+@@ -200,6 +200,7 @@ sub postamble_core {
+   # strictly necessary, but it's better to keep them in case the
+   # dependencies here are changed
+   require Data::Dumper;
++  $Data::Dumper::Sortkeys = 1;
+   Wx::build::Utils::write_string( 'files.lst',
+                                   Data::Dumper->Dump( [ \%files ] ) );
+   # $exp and fix_alien depend on wxt_copy_files to ensure that blib/lib/Wx
+Index: libwx-perl-0.9923/build/Wx/build/Options.pm
+===================================================================
+--- libwx-perl-0.9923.orig/build/Wx/build/Options.pm
++++ libwx-perl-0.9923/build/Wx/build/Options.pm
+@@ -164,6 +164,7 @@ sub write_config_file {
+   my $file = shift;
+ 
+   require Data::Dumper;
++  $Data::Dumper::Sortkeys = 1;
+   my $str = Data::Dumper->Dump( [ { extra_libs   => $extra_libs,
+                                     extra_cflags => $extra_cflags,
+                                     alien_key    => $alien_key,
+Index: libwx-perl-0.9923/script/fix_alien_path.pl
+===================================================================
+--- libwx-perl-0.9923.orig/script/fix_alien_path.pl
++++ libwx-perl-0.9923/script/fix_alien_path.pl
+@@ -20,6 +20,8 @@ use Config;
+ use Data::Dumper;
+ use File::Spec::Functions qw(splitpath splitdir);
+ 
++$Data::Dumper::Sortkeys = 1;
++
+ # we do not care about the options, just that Alien::wxWidgets
+ # is initialized with the correct key
+ Wx::build::Options->get_makemaker_options( 'saved' );
+Index: libwx-perl-0.9923/script/make_exp_list.pl
+===================================================================
+--- libwx-perl-0.9923.orig/script/make_exp_list.pl
++++ libwx-perl-0.9923/script/make_exp_list.pl
+@@ -95,7 +95,11 @@ print OUT <<EOT;
+ 
+ package ${package};
+ 
+-push \@EXPORT_OK, qw(@{$packages{$package}{exp_ok}});
++push \@EXPORT_OK, qw(
++EOT
++print OUT join("\n", sort @{$packages{$package}{exp_ok}});
++print OUT <<EOT;
++);
+ 
+ \$EXPORT_TAGS{'everything'} = \\\@EXPORT_OK;
+ 
+@@ -104,7 +108,11 @@ EOT
+   foreach my $tag ( sort keys %{ $packages{$package}{tags} } ) {
+     next unless length $tag;
+     print OUT <<EOT;
+-\$EXPORT_TAGS{'$tag'} = [ qw(@{ $packages{$package}{tags}{$tag} }) ];
++\$EXPORT_TAGS{'$tag'} = [ qw(
++EOT
++print OUT join("\n", sort @{ $packages{$package}{tags}{$tag} });
++print OUT <<EOT;
++) ];
+ EOT
+   }
+ }
diff --git a/debian/patches/series b/debian/patches/series
index 3ca106b..8bbd329 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -4,3 +4,4 @@ hashbang.patch
 fix-fake-pod.patch
 spelling.patch
 0001-Fix-Wx-_load_plugin-segfaulting-when-wxPluginManager.patch
+reproducible_output.patch

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to