Source: osc Version: 0.154.0-2 Severity: wishlist Tags: patch upstream User: reproducible-bui...@lists.alioth.debian.org Usertags: timestamps X-Debbugs-Cc: reproducible-bui...@lists.alioth.debian.org
Dear Maintainer, While working on the `reproducible builds' effort [1], we have noticed that 'osc' could not be built reproducibly. The attached patch honours the SOURCE_DATE_EPOCH environment variable [2] to get a reproducible man page date from the last debian changelog entry. Once applied, osc can be built reproducibly in our current experimental framework. Regards, Alexis Bienvenüe. [1]: https://wiki.debian.org/ReproducibleBuilds [2]: https://reproducible-builds.org/specs/source-date-epoch/
Description: Reproducible man page date Set the man page date from the environment variable SOURCE_DATE_EPOCH (if set), to make the build reproducible. See https://reproducible-builds.org/specs/source-date-epoch/ Author: Alexis Bienvenüe <p...@passoire.fr> --- osc-0.154.0.orig/osc/cmdln.py +++ osc-0.154.0/osc/cmdln.py @@ -45,8 +45,8 @@ import re import cmd import optparse import sys +import time from pprint import pprint -from datetime import date # this is python 2.x style def introspect_handler_2(handler): @@ -619,9 +619,13 @@ class RawCmdln(cmd.Cmd): usage: ${name} man """ + if os.getenv("SOURCE_DATE_EPOCH"): + srcdate = time.gmtime(int(os.getenv("SOURCE_DATE_EPOCH"))) + else: + srcdate = time.localtime() self.stdout.write(bytes( self.man_header % { - 'date': date.today().strftime('%b %Y'), + 'date': time.strftime('%b %Y',srcdate), 'version': self.get_version(), 'name': self.name, 'ucname': self.name.upper()