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/
This commit is contained in:
Todd Zullinger 2019-02-15 19:11:25 -05:00
parent f506af1ff5
commit 233359ed66

View File

@ -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 <tmz@pobox.com>
- Set SOURCE_DATE_EPOCH and TZ to improve build reproducibility
* Wed Feb 13 2019 Todd Zullinger <tmz@pobox.com> - 2.21.0-0.1.rc1
- Update to 2.21.0.rc1