SHA256
1
0
forked from pool/mvapich2
mvapich2/reproducible.patch

111 lines
3.8 KiB
Diff
Raw Normal View History

commit bf7afdf34ad71b1e644dda34053e491653ca59e7
Author: Bernhard M. Wiedemann <bwiedemann@suse.de>
Date: Mon Mar 25 11:12:56 2019 +0100
reproducible
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.
Signed-off-by: Nicolas Morey-Chaisemartin <nmoreychaisemartin@suse.com>
Also remove any unreproducible timestamps from generated files.
diff --git maint/extractcvars.in maint/extractcvars.in
index b627a6f8d937..879de7bf6d5a 100755
--- maint/extractcvars.in
+++ maint/extractcvars.in
@@ -125,7 +125,7 @@ foreach my $p (@cvars) {
print "Categories include: \n".Dumper(@categories) if $debug;
print "Cvars include :\n".Dumper(@cvars)."\n" if $debug;
-my $run_timestamp = localtime();
+my $run_timestamp = localtime($ENV{"SOURCE_DATE_EPOCH"} || time);
my $uc_ns = uc($ns);
# Setup output files
@@ -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") {
diff --git maint/extractfixme.in maint/extractfixme.in
index 6b2567f037ed..7636fad296b8 100644
--- maint/extractfixme.in
+++ 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;
}
diff --git maint/extractstrings.in maint/extractstrings.in
index 4e8a599c89ca..449a8c007499 100644
--- maint/extractstrings.in
+++ maint/extractstrings.in
@@ -73,7 +73,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/) {
@@ -246,7 +246,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; }
@@ -273,7 +273,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; }
diff --git maint/gen_subcfg_m4 maint/gen_subcfg_m4
index 80654263401d..34cb19ed0649 100755
--- maint/gen_subcfg_m4
+++ 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 "..";
diff --git maint/getcoverage.in maint/getcoverage.in
index c9c69f299261..f4fc35be72f6 100644
--- maint/getcoverage.in
+++ maint/getcoverage.in
@@ -779,7 +779,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;
}