Add reproducible.patch to override build date and build host (boo#1047218, boo#1084909) now also type 1 patch markup OBS-URL: https://build.opensuse.org/request/show/861900 OBS-URL: https://build.opensuse.org/package/show/server:monitoring/tiptop?expand=0&rev=5
44 lines
1.5 KiB
Diff
44 lines
1.5 KiB
Diff
From: Bernhard M. Wiedemann <bwiedemann suse de>
|
|
Date: 2020-11-08
|
|
Subject: make package build reproducible
|
|
References: boo#1047218, boo#1084909
|
|
Upstream: submitted
|
|
|
|
https://bugzilla.opensuse.org/show_bug.cgi?id=1047218
|
|
https://bugzilla.opensuse.org/show_bug.cgi?id=1084909
|
|
|
|
Allow to override hostname and build date
|
|
|
|
See https://reproducible-builds.org/ for why this is good
|
|
and https://reproducible-builds.org/specs/source-date-epoch/
|
|
for the definition of this variable.
|
|
|
|
This date works with different `date` implementations.
|
|
|
|
Also consistently use ISO 8601 date format to be understood everywhere.
|
|
Also use UTC to be independent of timezone.
|
|
Index: tiptop-2.3.1/src/Makefile.in
|
|
===================================================================
|
|
--- tiptop-2.3.1.orig/src/Makefile.in
|
|
+++ tiptop-2.3.1/src/Makefile.in
|
|
@@ -46,10 +46,17 @@ Makefile: Makefile.in ../config.status
|
|
cd .. && ./config.status --recheck
|
|
|
|
|
|
+DATE_FMT = -Iseconds
|
|
+ifdef SOURCE_DATE_EPOCH
|
|
+ BUILD_DATE ?= $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" "$(DATE_FMT)" 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" "$(DATE_FMT)" 2>/dev/null || date -u "$(DATE_FMT)")
|
|
+else
|
|
+ BUILD_DATE ?= $(shell date "$(DATE_FMT)")
|
|
+endif
|
|
+
|
|
|
|
version.o: version.c
|
|
- $(CC) $(CFLAGS) -DCOMPILE_HOST="\""`hostname`"\"" \
|
|
- -DCOMPILE_DATE="\"`date`\"" \
|
|
+ $(CC) $(CFLAGS) -DCOMPILE_HOST="\""$${HOSTNAME:-`hostname`}"\"" \
|
|
+ -DCOMPILE_DATE="\"$(BUILD_DATE)\"" \
|
|
-c $(srcdir)/version.c
|
|
|
|
|