Source: polymake
Version: 2.14-2
Severity: wishlist
Tags: patch
User: reproducible-builds@lists.alioth.debian.org
Usertags: randomness
X-Debbugs-Cc: reproducible-builds@lists.alioth.debian.org

Hi,

While working on the "reproducible builds" effort [1], we have noticed
that polymake could not be built reproducibly.

The attached patch removes randomness from the build system caused by
Perl hash order. Once applied, polymake can be built reproducibly in
our reproducible toolchain.

 [1]: https://wiki.debian.org/ReproducibleBuilds


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      la...@debian.org / chris-lamb.co.uk
       `-
diff --git a/perllib/Polymake/Configure.pm b/perllib/Polymake/Configure.pm
index 8f87e49..03e9824 100644
--- a/perllib/Polymake/Configure.pm
+++ b/perllib/Polymake/Configure.pm
@@ -268,7 +268,7 @@ sub write_conf_vars {
    no strict 'refs';
    my ($pkg, $conf)=@_;
 
-   foreach my $var (@{"$pkg\::make_vars"}, @{"$pkg\::make_export_vars"}) {
+   foreach my $var (sort @{"$pkg\::make_vars"}, sort 
@{"$pkg\::make_export_vars"}) {
       if (defined (my $value=${"$pkg\::$var"})) {
          if ($pkg ne __PACKAGE__ && $var =~ /(?:flags|libs)/i) {
             print $conf "$var := $value \${$var}\n";
@@ -279,7 +279,7 @@ sub write_conf_vars {
    }
 
    if (my @export=grep { defined(${"$pkg\::$_"}) } 
@{"$pkg\::make_export_vars"}) {
-      print $conf "export ", join(" ", @export), "\n";
+      print $conf "export ", join(" ", sort @export), "\n";
    }
 }
 
###############################################################################################
@@ -288,13 +288,13 @@ sub write_config_command_line {
    my ($conf, $options, $allowed_with, $vars, $ext_failed)=@_;
 
    if (defined $vars) {
-      while (my ($item, $value)=each %$vars) {
+      while (my ($item, $value)=sort each %$vars) {
          $value="'$value'" if $value =~ /[\s(){}\[\]\$]/;
          print $conf " $item=$value";
       }
    }
 
-   while (my ($item, $value)=each %$options) {
+   while (my ($item, $value)=sort each %$options) {
       if ($value eq ".none.") {
          unless ($ext_failed && $ext_failed->{$item}) {
             print $conf " --without-$item";
_______________________________________________
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