From 233359ed666459b64870497e5da67f9accac1339 Mon Sep 17 00:00:00 2001 From: Todd Zullinger Date: Fri, 15 Feb 2019 19:11:25 -0500 Subject: [PATCH] Set SOURCE_DATE_EPOCH and TZ to improve build reproducibility The documentation tools respect these variables when generating dates in the man and html docs. This is a small step toward making the package builds reproducible. An alternate method to set SOURCE_DATE_EPOCH would be to set the rpm %source_date_epoch_from_changelog macro. Using the version file from the tarball is a little nicer as the date is printed in the man pages. We'd still need to set TZ anyway, as the html documentation sets the 'last updated' footer entry based on the timestamp of the corresponding txt file. [Note: It is possible to avoid the 'last updated' footer entirely by setting the asciidoc footer-style attribute to none. This would need to be done via sed or a patch, as there's not currently a way to set this in config.mak -- but perhaps there should be.] Reference: https://reproducible-builds.org/specs/source-date-epoch/ --- git.spec | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/git.spec b/git.spec index 69479c2..38c087b 100644 --- a/git.spec +++ b/git.spec @@ -532,6 +532,10 @@ sed -i 's@"++GITWEB_HOME_LINK_STR++"@$ENV{"SERVER_NAME"} ? "git://" . $ENV{"SERV mv contrib/{contacts,subtree}/git-*.txt Documentation/ %build +# Improve build reproducibility +export TZ=UTC +export SOURCE_DATE_EPOCH=$(date -r version +%%s 2>/dev/null) + %make_build all %{?with_docs:doc} %make_build -C contrib/contacts/ all @@ -942,6 +946,9 @@ rmdir --ignore-fail-on-non-empty "$testdir" %{?with_docs:%{_pkgdocdir}/git-svn.html} %changelog +* Fri Feb 15 2019 Todd Zullinger +- Set SOURCE_DATE_EPOCH and TZ to improve build reproducibility + * Wed Feb 13 2019 Todd Zullinger - 2.21.0-0.1.rc1 - Update to 2.21.0.rc1