Source: zim Version: 0.65-2 Severity: wishlist Tags: patch upstream User: reproducible-bui...@lists.alioth.debian.org Usertags: timestamps locale fileordering X-Debbugs-Cc: reproducible-bui...@lists.alioth.debian.org
Hi! While working on the "reproducible builds" effort [1], we have noticed that zim could not be built reproducibly. It embeds a locale-dependent timestamp into a manpage and doesn't sort a list of plugins embedded in a Python file. The attached patch fixes those issues. Regards, Reiner [1]: https://wiki.debian.org/ReproducibleBuilds
diff --git a/debian/patches/reproducible-build.patch b/debian/patches/reproducible-build.patch new file mode 100644 index 0000000..fb32272 --- /dev/null +++ b/debian/patches/reproducible-build.patch @@ -0,0 +1,40 @@ +Author: Reiner Herrmann <rei...@reiner-h.de> +Description: Enable reproducible building + - Honour SOURCE_DATE_EPOCH for manpage timestamp, if it is defined + - Use C locale for embedded time + - Sort list of plugins + +--- a/makeman.py ++++ b/makeman.py +@@ -6,7 +6,8 @@ + + import os + +-from time import strftime ++from time import strftime, gmtime, time ++from locale import setlocale, LC_TIME + + from zim import __version__, __url__, \ + __author__, __copyright__, __license__ +@@ -42,8 +43,9 @@ + os.mkdir('man') + except OSError: + pass # dir already exists ++ setlocale(LC_TIME, "C") + manpage = open('man/zim.1', 'w') +- manpage.write('.TH ZIM "1" "%s" "zim %s" "User Commands"\n' % (strftime('%B %Y'), __version__)) ++ manpage.write('.TH ZIM "1" "%s" "zim %s" "User Commands"\n' % (strftime('%B %Y', gmtime(int(os.environ.get('SOURCE_DATE_EPOCH', time())))), __version__)) + manpage.write('.SH NAME\nzim \\- %s\n\n' % tagline) + manpage.write('.SH SYNOPSIS\n%s\n' % HelpCommand.usagehelp.replace('-', r'\-')) + manpage.write('.SH DESCRIPTION\n%s\n' % about) +--- a/setup.py ++++ b/setup.py +@@ -290,7 +290,7 @@ + + for i, line in enumerate(lines): + if line.startswith('\t\tplugins = set('): +- lines[i] = '\t\tplugins = set(%r) # DEFAULT PLUGINS COMPILED IN BY SETUP.PY\n' % plugins ++ lines[i] = '\t\tplugins = set(%r) # DEFAULT PLUGINS COMPILED IN BY SETUP.PY\n' % sorted(plugins) + break + else: + assert False, 'Missed line for plugin list' diff --git a/debian/patches/series b/debian/patches/series index 2c4455a..f13156f 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1 +1,2 @@ reload-pages.patch +reproducible-build.patch
signature.asc
Description: Digital signature