File reproducible.patch of Package mvapich2.25423

http://mailman.cse.ohio-state.edu/pipermail/mvapich-discuss/2019-April/006837.html

commit 2d6233b60e419059240e054e40fc6ece6fd94929
Author: Bernhard M. Wiedemann <bwiedemann@suse.de>
Date:   Mon Mar 25 11:12:56 2019 +0100

    Sort input file list
    
    so that mpich builds in a reproducible way
    in spite of indeterministic filesystem readdir order
    
    See https://reproducible-builds.org/ for why this is good.
    
    Without this patch,
    README.envvar, /usr/lib64/mpi/gcc/mpich/bin/mpivars and other
    output files varied between builds.

Index: mvapich2-2.2/maint/extractcvars.in
===================================================================
--- mvapich2-2.2.orig/maint/extractcvars.in
+++ mvapich2-2.2/maint/extractcvars.in
@@ -594,7 +594,7 @@ sub ExpandDir {
     my @subdirs = ();
     my $DIR_HANDLE;
     opendir $DIR_HANDLE, "$dir" or die "Error: open directory $dir -- $!\n";
-    while (my $filename = readdir $DIR_HANDLE) {
+    for my $filename (sort readdir $DIR_HANDLE) {
         if ($filename =~ /^\./) {
             next;
         } elsif (-d "$dir/$filename") {
Index: mvapich2-2.2/maint/extractfixme.in
===================================================================
--- mvapich2-2.2.orig/maint/extractfixme.in
+++ mvapich2-2.2/maint/extractfixme.in
@@ -114,7 +114,7 @@ sub ExpandDir {
     my @otherdirs = ();
     my @files = ();
     opendir DIR, "$dir";
-    while ($filename = readdir DIR) {
+    for $filename (sort readdir DIR) {
 	if ($filename =~ /^\./ || $filename eq ".svn") {
 	    next;
 	}
Index: mvapich2-2.2/maint/extractstrings.in
===================================================================
--- mvapich2-2.2.orig/maint/extractstrings.in
+++ mvapich2-2.2/maint/extractstrings.in
@@ -71,7 +71,7 @@ sub GetFileNamesInDirectory {
     my @filesFound = ();
 
     opendir DIR, $dir || die "Could not open $dir\n";
-    while (my $file = readdir DIR) {
+    for my $file (sort readdir DIR) {
 	if (! -f "$dir/$file") { next; }
 	if ($file =~ /^\.$/ || $file =~ /^\.\.$/) { next; }
 	if ($file =~ /$pattern/) {
@@ -244,7 +244,7 @@ sub processDirs {
     my @dirs = ();
     # Find the directories
     opendir DIR, "$dir" || die "Cannot open $dir\n";
-    while (my $file = readdir DIR) {
+    for my $file (sort readdir DIR) {
 	if (! -d "$dir/$file") { next; }
 	if ($file =~ /^\./) { next; }
 	if ($file =~ /^.svn/) { next; }
@@ -271,7 +271,7 @@ sub processDirsAndAction {
     my @dirs = ();
     # Find the directories
     opendir DIR, "$dir" || die "Cannot open $dir\n";
-    while (my $file = readdir DIR) {
+    for my $file (sort readdir DIR) {
 	if (! -d "$dir/$file") { next; }
 	if ($file =~ /^\./) { next; }
 	if ($file =~ /^.svn/) { next; }
Index: mvapich2-2.2/maint/gen_subcfg_m4
===================================================================
--- mvapich2-2.2.orig/maint/gen_subcfg_m4
+++ mvapich2-2.2/maint/gen_subcfg_m4
@@ -118,7 +118,7 @@ while (my $dir = pop @dirstack) {
     # the stack to continue the traversal
     opendir DH, $dir
         or die "unable to open dir='$dir', stopped";
-    my @contents = readdir DH;
+    my @contents = sort readdir DH;
     foreach my $f (@contents) {
         # avoid endless recursion
         next if $f eq "." || $f eq "..";
Index: mvapich2-2.2/maint/getcoverage.in
===================================================================
--- mvapich2-2.2.orig/maint/getcoverage.in
+++ mvapich2-2.2/maint/getcoverage.in
@@ -773,7 +773,7 @@ sub ExpandDir {
     my @otherdirs = ();
     my @files = ();
     opendir DIR, "$dir";
-    while ($filename = readdir DIR) {
+    for $filename (sort readdir DIR) {
 	if ($filename =~ /^\./ || $filename eq ".svn") {
 	    next;
 	}
openSUSE Build Service is sponsored by