]> xenbits.xensource.com Git - libvirt.git/commitdiff
docs: Add build timestamps to generated html/php pages
authorMartin Kletzander <mkletzan@redhat.com>
Wed, 26 Jul 2017 15:04:37 +0000 (17:04 +0200)
committerMartin Kletzander <mkletzan@redhat.com>
Wed, 26 Jul 2017 15:47:25 +0000 (17:47 +0200)
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>
docs/Makefile.am
docs/newapi.xsl
docs/page.xsl
docs/site.xsl
docs/subsite.xsl

index e32758f4aa36f6b7e30f0dd84331b35cfda243e0..a5bff7de1c9d5fb102637ecc964ac382b6ead467 100644 (file)
@@ -196,6 +196,13 @@ 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 +262,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 +278,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 +298,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 +309,8 @@ 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
 
 
index 9dd961507af47e6f75fdaf6fc5d3afbd827c5f52..d45bfc192d6324673921f0275de5db4e6d3264a7 100644 (file)
       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>
 
         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>
index 1d662c670686ac3d8584d6e54eb1b60bbf25fcf6..5d8e6e8263c3290e4d46f61b7d6e140bbbf3cee6 100644 (file)
   <!-- 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"/>
index ce354c32fb596aab7f8b7d16b885b1978df144d0..b84630e390295f3e0a93fcd07b3cad356b1d7bb8 100644 (file)
@@ -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>
 
index 108d0d83e50974f174c6a29fee798b5d33b34997..6d2453f98e9c56546f55c26e4f7d9b93a64242db 100644 (file)
@@ -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>