blob: e58692486444ecf8fb5eb632f54043370b081458 [file] [log] [blame]
From 443641ef740ee43401efc98135c9e44ab1e2433c 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 6232143cb9..7d490a17d3 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -412,6 +412,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
@@ -422,8 +423,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 9c3f4131b8..87c9a9d223 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.17.0.921.gf22659ad46