From 5291fc7e08a0e0d50111cd53d79074bc3d2aa11451eb38a1c95bbceb17a928fa Mon Sep 17 00:00:00 2001 From: Nicolas Morey-Chaisemartin Date: Tue, 4 Jun 2019 05:59:12 +0000 Subject: [PATCH] Accepting request 705701 from home:bmwiedemann:branches:science:HPC Add reproducible.patch to sort readdir to make package build reproducible (boo#1041090) OBS-URL: https://build.opensuse.org/request/show/705701 OBS-URL: https://build.opensuse.org/package/show/science:HPC/mvapich2?expand=0&rev=60 --- mvapich2.changes | 6 +++ mvapich2.spec | 2 + reproducible.patch | 100 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 108 insertions(+) create mode 100644 reproducible.patch diff --git a/mvapich2.changes b/mvapich2.changes index 774f21a..2766a68 100644 --- a/mvapich2.changes +++ b/mvapich2.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon May 27 15:14:10 UTC 2019 - Bernhard Wiedemann + +- Add reproducible.patch to sort readdir to make package build reproducible + (boo#1041090) + ------------------------------------------------------------------- Mon May 13 07:59:22 UTC 2019 - Nicolas Morey-Chaisemartin diff --git a/mvapich2.spec b/mvapich2.spec index 49cd117..f4e1b41 100644 --- a/mvapich2.spec +++ b/mvapich2.spec @@ -167,6 +167,7 @@ Patch2: mvapich2-arm-support.patch # PATCH-FIX-UPSTREAM 0001-Drop-GCC-check.patch (bnc#1129421) # It's been merged upstream, should be removed with the next release Patch3: 0001-Drop-GCC-check.patch +Patch4: reproducible.patch Url: http://mvapich.cse.ohio-state.edu/overview/mvapich2/ BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -297,6 +298,7 @@ is based on MPICH2 and MVICH. This package contains the static libraries %patch0 %patch2 %patch3 +%patch4 -p1 cp /usr/share/automake*/config.* . %build diff --git a/reproducible.patch b/reproducible.patch new file mode 100644 index 0000000..cedecad --- /dev/null +++ b/reproducible.patch @@ -0,0 +1,100 @@ +http://mailman.cse.ohio-state.edu/pipermail/mvapich-discuss/2019-April/006837.html + +commit 2d6233b60e419059240e054e40fc6ece6fd94929 +Author: Bernhard M. Wiedemann +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; + }