Source: zzzeeksphinx
Version: 1.4.0-1
Severity: wishlist
Tags: patch
User: reproducible-bui...@lists.alioth.debian.org
Usertags: toolchain timestamps
X-Debbugs-Cc: reproducible-b...@lists.alioth.debian.org

Hi,

Whilst working on the Reproducible Builds effort [0], we noticed that
zzzeeksphinx was generating output that was not reproducible.

This is because the template includes:

    % if show_sphinx:
        Created using <a href="http://sphinx.pocoo.org/";>Sphinx</a> 
${sphinx_version|h}.
    % endif

    Documentation last generated: ${datetime.datetime.now().strftime("%c")}
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This was affecting the reproduciblity of (at least) the mako in
Debian. A patch is attached that makes this use SOURCE_DATE_EPOCH
instead.

  [0] https://reproducible-builds.org/


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      la...@debian.org / chris-lamb.co.uk
       `-
diff --git a/zzzeeksphinx/themes/zsbase/layout.mako 
b/zzzeeksphinx/themes/zsbase/layout.mako
index 969b6df..dfea0e1 100644
--- a/zzzeeksphinx/themes/zsbase/layout.mako
+++ b/zzzeeksphinx/themes/zsbase/layout.mako
@@ -1,8 +1,14 @@
 ## coding: utf-8
 
 <%!
+    import os
+    import time
     import datetime
 
+    now = datetime.datetime.utcfromtimestamp(
+        int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))
+    )
+
     local_script_files = []
 
     default_css_files = [
@@ -307,7 +313,7 @@ withsidebar = bool(toc) and (
         Created using <a href="http://sphinx.pocoo.org/";>Sphinx</a> 
${sphinx_version|h}.
     % endif
 
-    Documentation last generated: ${datetime.datetime.now().strftime("%c")}
+    Documentation last generated: ${now.strftime("%c")}
 
     </div>
 </div>

Reply via email to