[PATCH] docs: Add build timestamps to generated html/php pages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 docs/Makefile.am | 13 +++++++++----
 docs/newapi.xsl  |  2 ++
 docs/page.xsl    |  4 ++++
 docs/site.xsl    |  1 +
 docs/subsite.xsl |  1 +
 5 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/docs/Makefile.am b/docs/Makefile.am
index e32758f4aa36..67a945a334f3 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -196,6 +196,8 @@ MAINTAINERCLEANFILES = \
   $(addprefix $(srcdir)/,$(dot_php)) \
   $(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
 
 api: $(srcdir)/libvirt-api.xml $(srcdir)/libvirt-refs.xml
@@ -255,7 +257,8 @@ MAINTAINERCLEANFILES += \
 	    $(MKDIR_P) $$dir; \
 	    style=subsite.xsl; \
 	  fi; \
-	  $(XSLTPROC) --stringparam pagename $$name --nonet \
+	  $(XSLTPROC) --stringparam pagename $$name \
+	    --stringparam timestamp $(timestamp) --nonet \
 	    $(top_srcdir)/docs/$$style $< > $@ \
 	    || { rm $@ && exit 1; }; fi
 
@@ -270,9 +273,10 @@ MAINTAINERCLEANFILES += \
 	  else echo "missing XHTML1 DTD"; cat $< > $(srcdir)/$@ ; fi ; fi
 
 %.php.tmp: %.php.in site.xsl page.xsl
-	@if [ -x $(XSLTPROC) ] ; then \
+	if [ -x $(XSLTPROC) ] ; then \
 	  echo "Generating $@"; \
-	  $(XSLTPROC) --stringparam pagename $(@:.tmp=) --nonet \
+	  $(XSLTPROC) --stringparam pagename $(@:.tmp=) \
+	    --stringparam timestamp $(timestamp) --nonet \
 	    $(top_srcdir)/docs/site.xsl $< > $@ \
 	    || { rm $@ && exit 1; }; fi
 
@@ -289,6 +293,7 @@ html/index.html: libvirt-api.xml newapi.xsl page.xsl $(APIBUILD_STAMP)
 	$(AM_V_GEN)if [ -x $(XSLTPROC) ] ; then \
 	  $(XSLTPROC) --nonet -o $(srcdir)/ \
 	  --stringparam builddir '$(abs_top_builddir)' \
+	  --stringparam timestamp $(timestamp) \
 	  $(srcdir)/newapi.xsl $(srcdir)/libvirt-api.xml ; fi && \
 	if test -x $(XMLLINT) && test -x $(XMLCATALOG) ; then \
 	  if $(XMLCATALOG) '$(XML_CATALOG_FILE)' "-//W3C//DTD XHTML 1.0 Strict//EN" \
@@ -299,7 +304,7 @@ html/index.html: libvirt-api.xml newapi.xsl page.xsl $(APIBUILD_STAMP)
 
 $(addprefix $(srcdir)/,$(devhelphtml)): $(srcdir)/libvirt-api.xml $(devhelpxsl)
 	$(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
 
 
diff --git a/docs/newapi.xsl b/docs/newapi.xsl
index 9dd961507af4..d45bfc192d63 100644
--- a/docs/newapi.xsl
+++ b/docs/newapi.xsl
@@ -818,6 +818,7 @@
       doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
       <xsl:apply-templates select="exsl:node-set($mainpage)" mode="page">
         <xsl:with-param name="pagename" select="concat($htmldir, '/index.html')"/>
+        <xsl:with-param name="timestamp" select="$timestamp"/>
       </xsl:apply-templates>
     </xsl:document>
 
@@ -834,6 +835,7 @@
         doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
         <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="timestamp" select="$timestamp"/>
         </xsl:apply-templates>
       </xsl:document>
     </xsl:for-each>
diff --git a/docs/page.xsl b/docs/page.xsl
index 1d662c670686..5d8e6e8263c3 100644
--- a/docs/page.xsl
+++ b/docs/page.xsl
@@ -75,11 +75,15 @@
   <!-- This is the master page structure -->
   <xsl:template match="/" mode="page">
     <xsl:param name="pagename"/>
+    <xsl:param name="timestamp"/>
     <html>
       <xsl:comment>
         This file is autogenerated from <xsl:value-of select="$pagename"/>.in
         Do not edit this file. Changes will be lost.
       </xsl:comment>
+      <xsl:comment>
+        This page was generated at <xsl:value-of select="$timestamp"/>.
+      </xsl:comment>
       <head>
         <link rel="stylesheet" type="text/css" href="{$href_base}main.css"/>
         <link rel="SHORTCUT ICON" href="{$href_base}32favicon.png"/>
diff --git a/docs/site.xsl b/docs/site.xsl
index ce354c32fb59..b84630e39029 100644
--- a/docs/site.xsl
+++ b/docs/site.xsl
@@ -29,6 +29,7 @@
   <xsl:template match="/">
     <xsl:apply-templates select="." mode="page">
       <xsl:with-param name="pagename" select="$pagename"/>
+      <xsl:with-param name="timestamp" select="$timestamp"/>
     </xsl:apply-templates>
   </xsl:template>
 
diff --git a/docs/subsite.xsl b/docs/subsite.xsl
index 108d0d83e509..6d2453f98e9c 100644
--- a/docs/subsite.xsl
+++ b/docs/subsite.xsl
@@ -19,6 +19,7 @@
   <xsl:template match="/">
     <xsl:apply-templates select="." mode="page">
       <xsl:with-param name="pagename" select="$pagename"/>
+      <xsl:with-param name="timestamp" select="$timestamp"/>
     </xsl:apply-templates>
   </xsl:template>
 
-- 
2.13.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux