From: Fabian Grünbichler Date: Tue, 20 Feb 2018 10:10:24 +0000 (+0100) Subject: export and respect SOURCE_DATE_EPOCH X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=b965ad63ad80b5967f5bc1f0327eb548b6049045;p=pve-docs.git export and respect SOURCE_DATE_EPOCH to improve reproducibility of pve-docs, pve-doc-generator and pve-doc-mediawiki builds, as well as man pages generated by pve-doc-generator when called via dpkg-buildpackage. timestamps embedded in the documentation now always reflect the last changelog entry of the package to which the documentation belongs (pve-docs for html, epub and pdf, individual packages for man pages). Signed-off-by: Fabian Grünbichler --- diff --git a/Makefile b/Makefile index 32f3fd5..dc776ac 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,8 @@ DOC_DEB=${DOC_PACKAGE}_${DOCRELEASE}-${PKGREL}_all.deb MEDIAWIKI_DEB=${MEDIAWIKI_PACKAGE}_${DOCRELEASE}-${PKGREL}_all.deb DOC_BUILDDEPS := asciidoc-dblatex, source-highlight, librsvg2-bin +export SOURCE_DATE_EPOCH ?= $(shell dpkg-parsechangelog -STimestamp) +SOURCE_DATE_HUMAN := $(shell date -d "@${SOURCE_DATE_EPOCH}") all: index.html @@ -81,7 +83,7 @@ INDEX_INCLUDES= \ man8-index-table.adoc \ $(sort $(addsuffix .html, ${MANUAL_PAGES}) ${CHAPTER_LIST}) -ADOC_STDARG=-b $(shell pwd)/asciidoc/pve-html -f asciidoc/asciidoc-pve.conf -a icons -a data-uri -a "date=$(shell date)" -a "revnumber=${DOCRELEASE}" +ADOC_STDARG=-b $(shell pwd)/asciidoc/pve-html -f asciidoc/asciidoc-pve.conf -a icons -a data-uri -a "date=${SOURCE_DATE_HUMAN}" -a "revnumber=${DOCRELEASE}" -a footer-style=revdate BROWSER?=xdg-open diff --git a/asciidoc-pve.in b/asciidoc-pve.in index 83f59eb..70848ca 100644 --- a/asciidoc-pve.in +++ b/asciidoc-pve.in @@ -300,7 +300,12 @@ sub compile_asciidoc { $leveloffset = - $doctype; - my $date = `date`; + my $date; + if (defined($ENV{SOURCE_DATE_EPOCH})) { + $date = `date -d "\@$ENV{SOURCE_DATE_EPOCH}"`; + } else { + $date = `date`; + } chomp $date; my $attributes = { @@ -308,6 +313,7 @@ sub compile_asciidoc { leveloffset => $leveloffset, revnumber => $release, revdate => $date, + 'footer-style' => 'revdate', }; my $mansection = $fileinfo->{mansection}->{$env}->{$infile};