]> git.proxmox.com Git - pve-docs.git/commitdiff
export and respect SOURCE_DATE_EPOCH
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Tue, 20 Feb 2018 10:10:24 +0000 (11:10 +0100)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Thu, 22 Feb 2018 15:31:08 +0000 (16:31 +0100)
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 <f.gruenbichler@proxmox.com>
Makefile
asciidoc-pve.in

index 32f3fd531f51ceee7b4b059a107b0476636e0197..dc776ac6d019650abfbcf38abd482b795a09505b 100644 (file)
--- 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
 
index 83f59ebb383cd4558ab0bebcb32e4b2811c62d6e..70848ca79df250b98723b719b87f8e933cf79b7f 100644 (file)
@@ -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};