Source: monkeysign
Version: 2.0.2
Severity: wishlist
Tags: patch
User: [email protected]
Usertags: timestamps
monkeysign currently embeds the timestamp in its documentation.
The attached patch should fix the problem.
--dkg
>From a38aef44ce7c256f0f948ff722844afa799f6d08 Mon Sep 17 00:00:00 2001
From: Daniel Kahn Gillmor <[email protected]>
Date: Thu, 7 May 2015 00:18:19 -0400
Subject: [PATCH] make monkeysign build reproducibly
The man pages are currently generated with today's date.
This change makes them set with the date based off the BUILD_TIMESTAMP
environment variable, if that variable is set; it also adjusts
debian/rules to export that variable based on the last entry in
debian/changelog.
---
debian/rules | 5 +++++
monkeysign/documentation.py | 3 ++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/debian/rules b/debian/rules
index a7baa54..01b4c9d 100755
--- a/debian/rules
+++ b/debian/rules
@@ -4,6 +4,11 @@
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
+LAST_CHANGE=$(shell dpkg-parsechangelog -S Date)
+BUILD_TIMESTAMP=$(shell LC_ALL=C date -u "+%s" -d "$(LAST_CHANGE)")
+
+export BUILD_TIMESTAMP
+
# This has to be exported to make some magic below work.
export DH_OPTIONS
diff --git a/monkeysign/documentation.py b/monkeysign/documentation.py
index d824738..2fa086e 100644
--- a/monkeysign/documentation.py
+++ b/monkeysign/documentation.py
@@ -4,6 +4,7 @@
import os
import datetime
+import time
from distutils.command.build import build
from distutils.core import Command
from distutils.errors import DistutilsOptionError
@@ -28,7 +29,7 @@ class build_manpage(Command):
raise DistutilsOptionError('\'output\' option is required')
if self.parsers is None:
raise DistutilsOptionError('\'parser\' option is required')
- self._today = datetime.date.today()
+ self._today = datetime.date.fromtimestamp(float(os.getenv('BUILD_TIMESTAMP', time.time())))
self._parsers = []
for parser in self.parsers.split():
scriptname, mod_name, func_name = parser.split(':')
--
2.1.4