From 9d3f35e52d0fbe1448ae4690b10dee0c45ab523fb1aea72f3c2ce7ad125fbb80 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Wed, 1 Jul 2020 12:12:03 +0000 Subject: [PATCH] Accepting request 817958 from home:bmwiedemann:branches:Base:System Use deterministic profile.sh script to make package build reproducible (boo#1040589) OBS-URL: https://build.opensuse.org/request/show/817958 OBS-URL: https://build.opensuse.org/package/show/Base:System/grep?expand=0&rev=100 --- grep.changes | 6 ++++++ grep.spec | 6 +++--- profile.sh | 14 ++++++++++++++ 3 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 profile.sh diff --git a/grep.changes b/grep.changes index c356cf5..2ad1606 100644 --- a/grep.changes +++ b/grep.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Jul 1 03:30:01 UTC 2020 - Bernhard Wiedemann + +- Use deterministic profile.sh script to make package build + reproducible (boo#1040589) + ------------------------------------------------------------------- Tue Jan 21 10:57:16 UTC 2020 - Andreas Schwab diff --git a/grep.spec b/grep.spec index 9914ec7..726a835 100644 --- a/grep.spec +++ b/grep.spec @@ -26,6 +26,7 @@ URL: https://www.gnu.org/software/grep/ Source0: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz Source2: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz.sig Source3: https://savannah.gnu.org/project/memberlist-gpgkeys.php?group=grep&download=1#/%{name}.keyring +Source4: profile.sh BuildRequires: fdupes BuildRequires: makeinfo BuildRequires: pcre-devel @@ -48,9 +49,8 @@ match to a specified pattern. By default, grep prints the matching lines. --without-included-regex \ %{nil} %if 0%{?do_profiling} - make %{?_smp_mflags} CFLAGS="%{optflags} %{cflags_profile_generate} -fno-profile-values" - # do not run profiling in parallel for reproducible builds (boo#1040589) - make CFLAGS="%{optflags} %{cflags_profile_generate}" check + make %{?_smp_mflags} CFLAGS="%{optflags} %{cflags_profile_generate}" + sh %{SOURCE4} # profiling run make clean make %{?_smp_mflags} CFLAGS="%{optflags} %{cflags_profile_feedback}" %else diff --git a/profile.sh b/profile.sh new file mode 100644 index 0000000..5569668 --- /dev/null +++ b/profile.sh @@ -0,0 +1,14 @@ +#!/bin/sh +# profiling script for profile-guided-optimizations (PGO) +# must be fully deterministic in what it does for reproducible builds +# should cover most code for good PGO optimization benefit +# See https://github.com/bmwiedemann/theunreproduciblepackage/tree/master/pgo +# for background information on PGO reproducibility + +grep=src/grep +t=COPYING +exec > /dev/null +for param in "" "-v" "-i" "-h" "-H" "-l" "-L" "-q" "-n" "-Z" "-E" "-F" "-P" "-e" "-w" "-c" "-o" ; do + $grep $param "GNU" $t + $grep $param "G.*U" $t +done