File reproducible.patch of Package openmpi.8971

Author: Bernhard M. Wiedemann <bwiedemann suse de>
Date: 2017-06-29

make package build reproducible
by sorting entries
and using fixed date + hostname

https://github.com/open-mpi/ompi/issues/3759

Index: openmpi-1.10.7/autogen.pl
===================================================================
--- openmpi-1.10.7.orig/autogen.pl
+++ openmpi-1.10.7/autogen.pl
@@ -83,7 +83,7 @@ if ($^O eq "solaris") {
 }
 
 $username = getpwuid($>);
-$full_hostname = `hostname`;
+$full_hostname = "reproduciblehostname";
 chomp($full_hostname);
 $hostname = $full_hostname;
 $hostname =~ s/^([\w\-]+)\..+/\1/;
@@ -314,7 +314,7 @@ sub mca_process_framework {
             $mca_found->{$pname}->{$framework}->{found} = 1;
             opendir(DIR, $dir) || 
                 my_die "Can't open $dir directory";
-            foreach my $d (readdir(DIR)) {
+            foreach my $d (sort(readdir(DIR))) {
                 # Skip any non-directory, "base", or any dir that
                 # begins with "."
                 next
@@ -609,7 +609,7 @@ sub mpiext_run_global {
     my $dir = "$topdir/$ext_prefix";
     opendir(DIR, $dir) || 
         my_die "Can't open $dir directory";
-    foreach my $d (readdir(DIR)) {
+    foreach my $d (sort(readdir(DIR))) {
         # Skip any non-directory, "base", or any dir that begins with "."
         next
             if (! -d "$dir/$d" || $d eq "base" || substr($d, 0, 1) eq ".");
@@ -696,7 +696,7 @@ sub mpicontrib_run_global {
     my $dir = "$topdir/$contrib_prefix";
     opendir(DIR, $dir) || 
         my_die "Can't open $dir directory";
-    foreach my $d (readdir(DIR)) {
+    foreach my $d (sort(readdir(DIR))) {
         # Skip any non-directory, "base", or any dir that begins with "."
         next
             if (! -d "$dir/$d" || $d eq "base" || substr($d, 0, 1) eq ".");
@@ -1105,7 +1105,7 @@ if ($no_ompi_arg == 1 && $no_orte_arg ==
 
 #---------------------------------------------------------------------------
 
-$full_hostname = `hostname`;
+$full_hostname = "reproduciblehostname";
 chomp($full_hostname);
 
 $m4 = "dnl
Index: openmpi-1.10.7/config/opal_functions.m4
===================================================================
--- openmpi-1.10.7.orig/config/opal_functions.m4
+++ openmpi-1.10.7/config/opal_functions.m4
@@ -79,8 +79,8 @@ EOF
 #
 
 OPAL_CONFIGURE_USER="`whoami`"
-OPAL_CONFIGURE_HOST="`hostname | head -n 1`"
-OPAL_CONFIGURE_DATE="`date`"
+OPAL_CONFIGURE_HOST="reproduciblehostname"
+OPAL_CONFIGURE_DATE="reproducibledate"
 
 #
 # Save these details so that they can be used in ompi_info later
@@ -99,8 +99,8 @@ AC_DEFUN([OPAL_BASIC_SETUP],[
 #
 
 OPAL_CONFIGURE_USER="`whoami`"
-OPAL_CONFIGURE_HOST="`hostname | head -n 1`"
-OPAL_CONFIGURE_DATE="`date`"
+OPAL_CONFIGURE_HOST="reproduciblehostname"
+OPAL_CONFIGURE_DATE="reproducibledate"
 
 #
 # Make automake clean emacs ~ files for "make clean"
Index: openmpi-1.10.7/config/opal_get_version.m4
===================================================================
--- openmpi-1.10.7.orig/config/opal_get_version.m4
+++ openmpi-1.10.7/config/opal_get_version.m4
@@ -91,7 +91,7 @@ m4_define([OPAL_GET_VERSION],[
                     $2_REPO_REV=`git describe --tags --always`
                 fi
             else
-                $2_REPO_REV="date`date '+%Y-%m-%d'`"
+                $2_REPO_REV="date"
             fi
         fi
 
Index: openmpi-1.10.7/ompi/tools/ompi_info/Makefile.am
===================================================================
--- openmpi-1.10.7.orig/ompi/tools/ompi_info/Makefile.am
+++ openmpi-1.10.7/ompi/tools/ompi_info/Makefile.am
@@ -25,8 +25,8 @@ AM_CFLAGS = \
             -DOPAL_CONFIGURE_HOST="\"@OPAL_CONFIGURE_HOST@\"" \
             -DOPAL_CONFIGURE_DATE="\"@OPAL_CONFIGURE_DATE@\"" \
             -DOMPI_BUILD_USER="\"$$USER\"" \
-            -DOMPI_BUILD_HOST="\"`hostname`\"" \
-            -DOMPI_BUILD_DATE="\"`date`\"" \
+            -DOMPI_BUILD_HOST="\"reproduciblehostname\"" \
+            -DOMPI_BUILD_DATE="\"reproducibledate\"" \
             -DOMPI_BUILD_CFLAGS="\"@CFLAGS@\"" \
             -DOMPI_BUILD_CPPFLAGS="\"@CPPFLAGS@\"" \
             -DOMPI_BUILD_CXXFLAGS="\"@CXXFLAGS@\"" \
Index: openmpi-1.10.7/orte/tools/orte-info/Makefile.am
===================================================================
--- openmpi-1.10.7.orig/orte/tools/orte-info/Makefile.am
+++ openmpi-1.10.7/orte/tools/orte-info/Makefile.am
@@ -23,8 +23,8 @@ AM_CFLAGS = \
             -DOPAL_CONFIGURE_HOST="\"@OPAL_CONFIGURE_HOST@\"" \
             -DOPAL_CONFIGURE_DATE="\"@OPAL_CONFIGURE_DATE@\"" \
             -DOMPI_BUILD_USER="\"$$USER\"" \
-            -DOMPI_BUILD_HOST="\"`hostname`\"" \
-            -DOMPI_BUILD_DATE="\"`date`\"" \
+            -DOMPI_BUILD_HOST="\"reproduciblehostname\"" \
+            -DOMPI_BUILD_DATE="\"reproducibledate\"" \
             -DOMPI_BUILD_CFLAGS="\"@CFLAGS@\"" \
             -DOMPI_BUILD_CPPFLAGS="\"@CPPFLAGS@\"" \
             -DOMPI_BUILD_CXXFLAGS="\"@CXXFLAGS@\"" \
Index: openmpi-1.10.7/oshmem/tools/oshmem_info/Makefile.am
===================================================================
--- openmpi-1.10.7.orig/oshmem/tools/oshmem_info/Makefile.am
+++ openmpi-1.10.7/oshmem/tools/oshmem_info/Makefile.am
@@ -14,8 +14,8 @@ AM_CPPFLAGS = \
             -DOPAL_CONFIGURE_HOST="\"@OPAL_CONFIGURE_HOST@\"" \
             -DOPAL_CONFIGURE_DATE="\"@OPAL_CONFIGURE_DATE@\"" \
             -DOMPI_BUILD_USER="\"$$USER\"" \
-            -DOMPI_BUILD_HOST="\"`hostname`\"" \
-            -DOMPI_BUILD_DATE="\"`date`\"" \
+            -DOMPI_BUILD_HOST="\"reproduciblehostname\"" \
+            -DOMPI_BUILD_DATE="\"reproducibledate\"" \
             -DOMPI_BUILD_CFLAGS="\"@CFLAGS@\"" \
             -DOMPI_BUILD_CPPFLAGS="\"@CPPFLAGS@\"" \
             -DOMPI_BUILD_CXXFLAGS="\"@CXXFLAGS@\"" \
openSUSE Build Service is sponsored by