Accepting request 818103 from Base:System

Use deterministic profile.sh script to make package build reproducible (boo#1040589) (forwarded request 817958 from bmwiedemann)

OBS-URL: https://build.opensuse.org/request/show/818103
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/grep?expand=0&rev=73
This commit is contained in:
Dominique Leuenberger 2020-07-04 23:09:37 +00:00 committed by Git OBS Bridge
commit 3b27e95d4f
3 changed files with 23 additions and 3 deletions

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Wed Jul 1 03:30:01 UTC 2020 - Bernhard Wiedemann <bwiedemann@suse.com>
- Use deterministic profile.sh script to make package build
reproducible (boo#1040589)
-------------------------------------------------------------------
Tue Jan 21 10:57:16 UTC 2020 - Andreas Schwab <schwab@suse.de>

View File

@ -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

14
profile.sh Normal file
View File

@ -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