Source: pcbasic Version: 2.0.2-1 Severity: wishlist Tags: patch User: [email protected] Usertags: timestamps X-Debbugs-Cc: [email protected]
Hi, Whilst working on the Reproducible Builds effort [0] we noticed that pcbasic could not be built reproducibly. This is because it embedded the current build date in a couple of places. Patch attached that leverages SOURCE_DATE_EPOCH [1]. [0] https://reproducible-builds.org/ [1] https://reproducible-builds.org/specs/source-date-epoch/ Regards, -- ,''`. : :' : Chris Lamb `. `'` [email protected] / chris-lamb.co.uk `-
--- a/debian/patches/0002_reproducible_build.patch 1970-01-01 01:00:00.000000000 +0100 --- b/debian/patches/0002_reproducible_build.patch 2020-01-14 10:41:09.155777469 +0000 @@ -0,0 +1,45 @@ +Description: Make the build reproducible +Author: Chris Lamb <[email protected]> +Last-Update: 2020-01-14 + +--- pcbasic-2.0.2.orig/docsrc/makedoc.py ++++ pcbasic-2.0.2/docsrc/makedoc.py +@@ -5,6 +5,7 @@ import shutil + from io import StringIO + from datetime import datetime + from io import open ++import time + + from lxml import etree + import markdown +@@ -145,7 +146,7 @@ def makedoc(header=None, output=None, em + predoc.write(licenses_html) + predoc.write(open(basepath + '/footer.html', 'r').read()) + predoc.seek(0) +- now = datetime.now().strftime('%Y-%m-%d %H:%M:%S') ++ now = time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(int(os.environ.get('SOURCE_DATE_EPOCH', time.time())))) + if embedded_style: + subheader_html = u""" + <header> +--- pcbasic-2.0.2.orig/setup.py ++++ pcbasic-2.0.2/setup.py +@@ -58,12 +58,18 @@ except (EnvironmentError, CalledProcessE + TAG = u'' + COMMIT = u'' + ++# https://reproducible-builds.org/specs/source-date-epoch/ ++try: ++ TIMESTAMP = str(datetime.datetime.utcfromtimestamp(int(os.environ['SOURCE_DATE_EPOCH']))) ++except KeyError: ++ TIMESTAMP = str(datetime.datetime.now()) ++ + # release info + RELEASE_ID = { + u'version': VERSION, + u'tag': TAG, + u'commit': COMMIT, +- u'timestamp': str(datetime.datetime.now()) ++ u'timestamp': TIMESTAMP, + } + + --- a/debian/patches/series 2020-01-14 10:30:00.443590713 +0000 --- b/debian/patches/series 2020-01-14 10:40:03.858813617 +0000 @@ -1 +1,2 @@ 0001_remove_headerid.patch +0002_reproducible_build.patch

