Source: python-mkdocs Version: 0.15.3-3 Severity: wishlist Tags: patch User: reproducible-bui...@lists.alioth.debian.org Usertags: timestamps X-Debbugs-Cc: reproducible-bui...@lists.alioth.debian.org
Hi, Whilst working on the "reproducible builds" effort [0], we noticed that python-mkdocs could not be built reproducibly. Patch attached. [0] https://wiki.debian.org/ReproducibleBuilds Regards, -- ,''`. : :' : Chris Lamb `. `'` la...@debian.org / chris-lamb.co.uk `-
--- a/debian/patches/0003-Reproducible-build.patch 1970-01-01 02:00:00.000000000 +0200 --- b/debian/patches/0003-Reproducible-build.patch 2016-07-18 09:31:37.521770351 +0200 @@ -0,0 +1,37 @@ +Author: Chris Lamb <la...@debian.org> +Last-Update: 2016-07-18 + +--- python-mkdocs-0.15.3.orig/mkdocs/nav.py ++++ python-mkdocs-0.15.3/mkdocs/nav.py +@@ -137,7 +137,11 @@ class Page(object): + self.abs_url = url + self.active = False + self.url_context = url_context +- self.update_date = datetime.datetime.now().strftime("%Y-%m-%d") ++ ++ try: ++ self.update_date = datetime.datetime.utcfromtimestamp(int(os.environ['SOURCE_DATE_EPOCH'])) ++ except KeyError: ++ self.update_date = datetime.datetime.now().strftime("%Y-%m-%d") + + # Relative paths to the input markdown file and output html file. + self.input_path = path +--- python-mkdocs-0.15.3.orig/mkdocs/commands/build.py ++++ python-mkdocs-0.15.3/mkdocs/commands/build.py +@@ -5,6 +5,7 @@ from datetime import datetime + import io + import logging + import os ++import time + + from jinja2.exceptions import TemplateNotFound + import jinja2 +@@ -83,7 +84,7 @@ def get_global_context(nav, config): + 'google_analytics': config['google_analytics'], + + 'mkdocs_version': mkdocs.__version__, +- 'build_date_utc': datetime.utcnow(), ++ 'build_date_utc': datetime.utcfromtimestamp(int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))), + + 'config': config + } --- a/debian/patches/series 2016-07-18 09:23:05.649622618 +0200 --- b/debian/patches/series 2016-07-18 09:26:53.785371530 +0200 @@ -1,2 +1,3 @@ 0001-Remove-faulty-tests.patch 0002-Use-themes-from-usr-share-mkdocs-themes.patch +0003-Reproducible-build.patch