Package: libextutils-xsbuilder-perl
Version: 0.28-2
Severity: wishlist
Tags: patch
User: reproducible-builds@lists.alioth.debian.org
Usertags: randomness toolchain
X-Debbugs-Cc: reproducible-builds@lists.alioth.debian.org

While working on the "reproducible builds" effort [1], we have noticed
that the libapreq2 package could not be built reproducibly. The XS code
generated by ExtUtils::XSBuilder varies between builds. The attached
patches to libextutils-xsbuilder-perl fix this.

Please note that I had some whitespace grief, as the patched module
has DOS linefeeds. These patches should be OK for dpkg-source / quilt,
but git-am may need the '--ignore-whitespace' option.

[1]: https://wiki.debian.org/ReproducibleBuilds
-- 
Niko Tyni   nt...@debian.org
>From 7fb4db40af72b6fe203bf48988680eec3b794a6c Mon Sep 17 00:00:00 2001
From: Niko Tyni <nt...@debian.org>
Date: Sat, 17 Oct 2015 14:05:03 +0300
Subject: [PATCH 1/2] Sort the xs_includes() directory list for reproducibility

The generated XS code will have #include lines in this order, so sorting
helps make the code stable between builds.
---
 XSBuilder/WrapXS.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/XSBuilder/WrapXS.pm b/XSBuilder/WrapXS.pm
index b25cf5a..6c76e69 100644
--- a/XSBuilder/WrapXS.pm
+++ b/XSBuilder/WrapXS.pm
@@ -205,7 +205,7 @@ sub xs_includes
     
 
     return [ 
-                keys %includes, 
+                sort(keys %includes),
                 -f $self -> xs_include_dir . '/'. $fixup1?$fixup1:(),
                 'EXTERN.h', 'perl.h', 'XSUB.h',             
                 -f $self -> xs_include_dir . '/'. $fixup2?$fixup2:(),
-- 
2.5.1

>From 0ec5e5a19e32e39b05a60fd32a59287c6dc1db85 Mon Sep 17 00:00:00 2001
From: Niko Tyni <nt...@debian.org>
Date: Sat, 17 Oct 2015 14:05:08 +0300
Subject: [PATCH 2/2] Sort the order of function_list() elements for
 reproducibility

This is the order that get_function() gets called in, so sorting
helps make the generated code stable between builds.
---
 XSBuilder/WrapXS.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/XSBuilder/WrapXS.pm b/XSBuilder/WrapXS.pm
index 6c76e69..ed662e9 100644
--- a/XSBuilder/WrapXS.pm
+++ b/XSBuilder/WrapXS.pm
@@ -325,7 +325,8 @@ sub function_list {
     my $self = shift;
     my(@list) = @{ function_table($self) };
 
-    while (my($name, $val) = each %{ $self->typemap->function_map }) {
+    for my $name (sort keys %{ $self->typemap->function_map }) {
+        my $val = $self->typemap->function_map->{$name};
         #entries that do not exist in C::Scan generated tables
         next unless $name =~ /^DEFINE_/;
         push @list, $val;
-- 
2.5.1

_______________________________________________
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