blob: e072a6ddf3e37bcc8e2c3573c8e35dc7980a3570 [file] [log] [blame]
From 46e0558c7153791480b853dc1ab9ccc0c906f71f Mon Sep 17 00:00:00 2001
From: Anders Kaseorg <andersk@mit.edu>
Date: Wed, 30 Nov 2016 22:21:15 -0500
Subject: Normalize generated asciidoc timestamps with SOURCE_DATE_EPOCH
This is needed to pass the Debian build reproducibility test
(https://wiki.debian.org/ReproducibleBuilds/TimestampsProposal).
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
---
Documentation/Makefile | 7 +++++--
Documentation/technical/api-index.sh | 4 ++++
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index b43d66eae..3a201c238 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -390,6 +390,7 @@ $(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml
howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
$(QUIET_GEN)$(RM) $@+ $@ && \
'$(SHELL_PATH_SQ)' ./howto-index.sh $(sort $(wildcard howto/*.txt)) >$@+ && \
+ $(if $(SOURCE_DATE_EPOCH),touch -d '@$(SOURCE_DATE_EPOCH)' $@+ &&) \
mv $@+ $@
$(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
@@ -400,8 +401,10 @@ WEBDOC_DEST = /pub/software/scm/git/docs
howto/%.html: ASCIIDOC_EXTRA += -a git-relative-html-prefix=../
$(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
$(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
- sed -e '1,/^$$/d' $< | \
- $(TXT_TO_HTML) - >$@+ && \
+ sed -e '1,/^$$/d' $< > $<+ && \
+ $(if $(SOURCE_DATE_EPOCH),touch -d '@$(SOURCE_DATE_EPOCH)' $<+ &&) \
+ $(TXT_TO_HTML) -o $@+ $<+ && \
+ rm $<+ && \
mv $@+ $@
install-webdoc : html
diff --git a/Documentation/technical/api-index.sh b/Documentation/technical/api-index.sh
index 9c3f4131b..87c9a9d22 100755
--- a/Documentation/technical/api-index.sh
+++ b/Documentation/technical/api-index.sh
@@ -20,6 +20,10 @@
sed -n -e '/^\/\/ table of contents end/,$p' "$skel"
) >api-index.txt+
+if [ "$SOURCE_DATE_EPOCH" ]; then
+ touch -d "@$SOURCE_DATE_EPOCH" api-index.txt+
+fi
+
if test -f api-index.txt && cmp api-index.txt api-index.txt+ >/dev/null
then
rm -f api-index.txt+
--
2.11.0