docs: Add build timestamps to generated html/php pages

In order not to make the build even less reproducible, honour
SOURCE_DATE_EPOCH environment variable as specified:

  https://reproducible-builds.org/specs/source-date-epoch/

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
Martin Kletzander 2017-07-26 17:04:37 +02:00
parent 0ca4e369bb
commit a54c962286
5 changed files with 23 additions and 4 deletions

View File

@ -196,6 +196,13 @@ MAINTAINERCLEANFILES = \
$(addprefix $(srcdir)/,$(dot_php)) \ $(addprefix $(srcdir)/,$(dot_php)) \
$(srcdir)/hvsupport.html.in $(srcdir)/aclperms.htmlinc $(srcdir)/hvsupport.html.in $(srcdir)/aclperms.htmlinc
timestamp="$(shell if test -n "$$SOURCE_DATE_EPOCH"; \
then \
date --date="@$$SOURCE_DATE_EPOCH"; \
else \
date; \
fi)"
all-am: web all-am: web
api: $(srcdir)/libvirt-api.xml $(srcdir)/libvirt-refs.xml api: $(srcdir)/libvirt-api.xml $(srcdir)/libvirt-refs.xml
@ -255,7 +262,8 @@ MAINTAINERCLEANFILES += \
$(MKDIR_P) $$dir; \ $(MKDIR_P) $$dir; \
style=subsite.xsl; \ style=subsite.xsl; \
fi; \ fi; \
$(XSLTPROC) --stringparam pagename $$name --nonet \ $(XSLTPROC) --stringparam pagename $$name \
--stringparam timestamp $(timestamp) --nonet \
$(top_srcdir)/docs/$$style $< > $@ \ $(top_srcdir)/docs/$$style $< > $@ \
|| { rm $@ && exit 1; }; fi || { rm $@ && exit 1; }; fi
@ -270,9 +278,10 @@ MAINTAINERCLEANFILES += \
else echo "missing XHTML1 DTD"; cat $< > $(srcdir)/$@ ; fi ; fi else echo "missing XHTML1 DTD"; cat $< > $(srcdir)/$@ ; fi ; fi
%.php.tmp: %.php.in site.xsl page.xsl %.php.tmp: %.php.in site.xsl page.xsl
@if [ -x $(XSLTPROC) ] ; then \ if [ -x $(XSLTPROC) ] ; then \
echo "Generating $@"; \ echo "Generating $@"; \
$(XSLTPROC) --stringparam pagename $(@:.tmp=) --nonet \ $(XSLTPROC) --stringparam pagename $(@:.tmp=) \
--stringparam timestamp $(timestamp) --nonet \
$(top_srcdir)/docs/site.xsl $< > $@ \ $(top_srcdir)/docs/site.xsl $< > $@ \
|| { rm $@ && exit 1; }; fi || { rm $@ && exit 1; }; fi
@ -289,6 +298,7 @@ html/index.html: libvirt-api.xml newapi.xsl page.xsl $(APIBUILD_STAMP)
$(AM_V_GEN)if [ -x $(XSLTPROC) ] ; then \ $(AM_V_GEN)if [ -x $(XSLTPROC) ] ; then \
$(XSLTPROC) --nonet -o $(srcdir)/ \ $(XSLTPROC) --nonet -o $(srcdir)/ \
--stringparam builddir '$(abs_top_builddir)' \ --stringparam builddir '$(abs_top_builddir)' \
--stringparam timestamp $(timestamp) \
$(srcdir)/newapi.xsl $(srcdir)/libvirt-api.xml ; fi && \ $(srcdir)/newapi.xsl $(srcdir)/libvirt-api.xml ; fi && \
if test -x $(XMLLINT) && test -x $(XMLCATALOG) ; then \ if test -x $(XMLLINT) && test -x $(XMLCATALOG) ; then \
if $(XMLCATALOG) '$(XML_CATALOG_FILE)' "-//W3C//DTD XHTML 1.0 Strict//EN" \ if $(XMLCATALOG) '$(XML_CATALOG_FILE)' "-//W3C//DTD XHTML 1.0 Strict//EN" \
@ -299,7 +309,8 @@ html/index.html: libvirt-api.xml newapi.xsl page.xsl $(APIBUILD_STAMP)
$(addprefix $(srcdir)/,$(devhelphtml)): $(srcdir)/libvirt-api.xml $(devhelpxsl) $(addprefix $(srcdir)/,$(devhelphtml)): $(srcdir)/libvirt-api.xml $(devhelpxsl)
$(AM_V_GEN)if [ -x $(XSLTPROC) ] ; then \ $(AM_V_GEN)if [ -x $(XSLTPROC) ] ; then \
$(XSLTPROC) --nonet -o $(srcdir)/devhelp/ \ $(XSLTPROC) --stringparam timestamp $(timestamp) \
--nonet -o $(srcdir)/devhelp/ \
$(top_srcdir)/docs/devhelp/devhelp.xsl $(srcdir)/libvirt-api.xml ; fi $(top_srcdir)/docs/devhelp/devhelp.xsl $(srcdir)/libvirt-api.xml ; fi

View File

@ -818,6 +818,7 @@
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<xsl:apply-templates select="exsl:node-set($mainpage)" mode="page"> <xsl:apply-templates select="exsl:node-set($mainpage)" mode="page">
<xsl:with-param name="pagename" select="concat($htmldir, '/index.html')"/> <xsl:with-param name="pagename" select="concat($htmldir, '/index.html')"/>
<xsl:with-param name="timestamp" select="$timestamp"/>
</xsl:apply-templates> </xsl:apply-templates>
</xsl:document> </xsl:document>
@ -834,6 +835,7 @@
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<xsl:apply-templates select="exsl:node-set($subpage)" mode="page"> <xsl:apply-templates select="exsl:node-set($subpage)" mode="page">
<xsl:with-param name="pagename" select="concat($htmldir, '/libvirt-', @name, '.html')"/> <xsl:with-param name="pagename" select="concat($htmldir, '/libvirt-', @name, '.html')"/>
<xsl:with-param name="timestamp" select="$timestamp"/>
</xsl:apply-templates> </xsl:apply-templates>
</xsl:document> </xsl:document>
</xsl:for-each> </xsl:for-each>

View File

@ -75,11 +75,15 @@
<!-- This is the master page structure --> <!-- This is the master page structure -->
<xsl:template match="/" mode="page"> <xsl:template match="/" mode="page">
<xsl:param name="pagename"/> <xsl:param name="pagename"/>
<xsl:param name="timestamp"/>
<html> <html>
<xsl:comment> <xsl:comment>
This file is autogenerated from <xsl:value-of select="$pagename"/>.in This file is autogenerated from <xsl:value-of select="$pagename"/>.in
Do not edit this file. Changes will be lost. Do not edit this file. Changes will be lost.
</xsl:comment> </xsl:comment>
<xsl:comment>
This page was generated at <xsl:value-of select="$timestamp"/>.
</xsl:comment>
<head> <head>
<link rel="stylesheet" type="text/css" href="{$href_base}main.css"/> <link rel="stylesheet" type="text/css" href="{$href_base}main.css"/>
<link rel="SHORTCUT ICON" href="{$href_base}32favicon.png"/> <link rel="SHORTCUT ICON" href="{$href_base}32favicon.png"/>

View File

@ -29,6 +29,7 @@
<xsl:template match="/"> <xsl:template match="/">
<xsl:apply-templates select="." mode="page"> <xsl:apply-templates select="." mode="page">
<xsl:with-param name="pagename" select="$pagename"/> <xsl:with-param name="pagename" select="$pagename"/>
<xsl:with-param name="timestamp" select="$timestamp"/>
</xsl:apply-templates> </xsl:apply-templates>
</xsl:template> </xsl:template>

View File

@ -19,6 +19,7 @@
<xsl:template match="/"> <xsl:template match="/">
<xsl:apply-templates select="." mode="page"> <xsl:apply-templates select="." mode="page">
<xsl:with-param name="pagename" select="$pagename"/> <xsl:with-param name="pagename" select="$pagename"/>
<xsl:with-param name="timestamp" select="$timestamp"/>
</xsl:apply-templates> </xsl:apply-templates>
</xsl:template> </xsl:template>