cfengine/reproducible.patch
Adam Majer 04cfaf3c35 Accepting request 507666 from home:bmwiedemann:branches:systemsmanagement
Use gzip -n to not add timestamps to .gz header
Add reproducible.patch to override man page date
to make package build fully reproducible

OBS-URL: https://build.opensuse.org/request/show/507666
OBS-URL: https://build.opensuse.org/package/show/systemsmanagement/cfengine?expand=0&rev=162
2017-07-03 09:56:35 +00:00

29 lines
1.1 KiB
Diff

commit fb4e70f9be4b37ab40505118553caf5a5b7c7daf
Author: Bernhard M. Wiedemann <bwiedemann@suse.de>
Date: Sun Jul 2 11:17:14 2017 +0200
libutils/man.c: allow to override build time
in order to enable reproducible builds.
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.
diff --git a/libutils/man.c b/libutils/man.c
index ef2cd1a28..ba46ba895 100644
--- a/libutils/man.c
+++ b/libutils/man.c
@@ -206,6 +206,11 @@ void ManPageWrite(Writer *out, const char *program, time_t last_modified,
const struct option options[],
const char *const option_hints[], bool accepts_file_argument)
{
+ time_t overridetime;
+ char *source_date_epoch = getenv("SOURCE_DATE_EPOCH");
+ if (source_date_epoch != NULL &&
+ (overridetime = (time_t)strtoll(source_date_epoch, NULL, 10)) > 0)
+ last_modified = overridetime;
WriteCopyright(out);
WriteHeader(out, program, last_modified);
WriteName(out, program, short_description);