[Python-modules-commits] r33911 - in packages/sphinx/trunk/debian (6 files)
mitya57 at users.alioth.debian.org
mitya57 at users.alioth.debian.org
Thu Aug 20 09:08:14 UTC 2015
Date: Thursday, August 20, 2015 @ 09:08:12
Author: mitya57
Revision: 33911
* Fix remaining reproducibility issues (closes: #795976):
- Export SOURCE_DATE_EPOCH in debian/rules.
- Set PYTHONHASHSEED=0 when generating grammar files.
- Make grammar generation deterministic (reproducible_grammar.diff).
- Make inventory generation deterministic (reproducible_inventory.diff).
- Make JavaScript locales deterministic (reproducible_js_locale.diff).
Many thanks to Val Lorentz for the patches.
Added:
packages/sphinx/trunk/debian/patches/reproducible_grammar.diff
packages/sphinx/trunk/debian/patches/reproducible_inventory.diff
packages/sphinx/trunk/debian/patches/reproducible_js_locale.diff
Modified:
packages/sphinx/trunk/debian/changelog
packages/sphinx/trunk/debian/patches/series
packages/sphinx/trunk/debian/rules
Modified: packages/sphinx/trunk/debian/changelog
===================================================================
--- packages/sphinx/trunk/debian/changelog 2015-08-20 09:01:26 UTC (rev 33910)
+++ packages/sphinx/trunk/debian/changelog 2015-08-20 09:08:12 UTC (rev 33911)
@@ -1,3 +1,15 @@
+sphinx (1.3.1-5) UNRELEASED; urgency=medium
+
+ * Fix remaining reproducibility issues (closes: #795976):
+ - Export SOURCE_DATE_EPOCH in debian/rules.
+ - Set PYTHONHASHSEED=0 when generating grammar files.
+ - Make grammar generation deterministic (reproducible_grammar.diff).
+ - Make inventory generation deterministic (reproducible_inventory.diff).
+ - Make JavaScript locales deterministic (reproducible_js_locale.diff).
+ Many thanks to Val Lorentz for the patches.
+
+ -- Dmitry Shachnev <mitya57 at debian.org> Thu, 20 Aug 2015 11:56:56 +0300
+
sphinx (1.3.1-4) unstable; urgency=medium
* Fix message when calling sphinx-build without arguments
Added: packages/sphinx/trunk/debian/patches/reproducible_grammar.diff
===================================================================
--- packages/sphinx/trunk/debian/patches/reproducible_grammar.diff (rev 0)
+++ packages/sphinx/trunk/debian/patches/reproducible_grammar.diff 2015-08-20 09:08:12 UTC (rev 33911)
@@ -0,0 +1,57 @@
+Description: make grammar generation deterministic
+Author: Val Lorentz <progval at progval.net>
+Forwarded: https://github.com/sphinx-doc/sphinx/pull/2009
+Last-Update: 2015-08-20
+
+--- a/sphinx/pycode/pgen2/pgen.py
++++ b/sphinx/pycode/pgen2/pgen.py
+@@ -4,6 +4,7 @@
+ from __future__ import print_function
+
+ from six import iteritems
++from collections import OrderedDict
+
+ # Pgen imports
+
+@@ -57,7 +58,7 @@
+ def make_first(self, c, name):
+ rawfirst = self.first[name]
+ first = {}
+- for label in rawfirst:
++ for label in sorted(rawfirst):
+ ilabel = self.make_label(c, label)
+ ##assert ilabel not in first # X X X failed on <> ... !=
+ first[ilabel] = 1
+@@ -138,8 +139,8 @@
+ totalset[label] = 1
+ overlapcheck[label] = {label: 1}
+ inverse = {}
+- for label, itsfirst in iteritems(overlapcheck):
+- for symbol in itsfirst:
++ for label, itsfirst in sorted(overlapcheck.items()):
++ for symbol in sorted(itsfirst):
+ if symbol in inverse:
+ raise ValueError("rule %s is ambiguous; %s is in the"
+ " first sets of %s as well as %s" %
+@@ -349,6 +350,9 @@
+ assert isinstance(next, NFAState)
+ self.arcs.append((label, next))
+
++ def __hash__(self):
++ return hash(tuple(x[0] for x in self.arcs))
++
+ class DFAState(object):
+
+ def __init__(self, nfaset, final):
+@@ -357,7 +361,10 @@
+ assert isinstance(final, NFAState)
+ self.nfaset = nfaset
+ self.isfinal = final in nfaset
+- self.arcs = {} # map from label to DFAState
++ self.arcs = OrderedDict() # map from label to DFAState
++
++ def __hash__(self):
++ return hash(tuple(self.arcs))
+
+ def addarc(self, next, label):
+ assert isinstance(label, str)
Added: packages/sphinx/trunk/debian/patches/reproducible_inventory.diff
===================================================================
--- packages/sphinx/trunk/debian/patches/reproducible_inventory.diff (rev 0)
+++ packages/sphinx/trunk/debian/patches/reproducible_inventory.diff 2015-08-20 09:08:12 UTC (rev 33911)
@@ -0,0 +1,16 @@
+Description: make inventory generation deterministic
+Author: Val Lorentz <progval at progval.net>
+Forwarded: https://github.com/sphinx-doc/sphinx/pull/2009
+Last-Update: 2015-08-20
+
+--- a/sphinx/builders/html.py
++++ b/sphinx/builders/html.py
+@@ -824,7 +824,7 @@
+ u'# The remainder of this file is compressed using zlib.\n'
+ % (self.config.project, self.config.version)).encode('utf-8'))
+ compressor = zlib.compressobj(9)
+- for domainname, domain in iteritems(self.env.domains):
++ for domainname, domain in sorted(self.env.domains.items()):
+ for name, dispname, type, docname, anchor, prio in \
+ sorted(domain.get_objects()):
+ if anchor.endswith(name):
Added: packages/sphinx/trunk/debian/patches/reproducible_js_locale.diff
===================================================================
--- packages/sphinx/trunk/debian/patches/reproducible_js_locale.diff (rev 0)
+++ packages/sphinx/trunk/debian/patches/reproducible_js_locale.diff 2015-08-20 09:08:12 UTC (rev 33911)
@@ -0,0 +1,16 @@
+Description: make JavaScript locale generation deterministic
+Author: Val Lorentz <progval at progval.net>
+Forwarded: https://github.com/sphinx-doc/sphinx/pull/2009
+Last-Update: 2015-08-20
+
+--- a/setup.py
++++ b/setup.py
+@@ -162,7 +162,7 @@
+ messages=jscatalog,
+ plural_expr=catalog.plural_expr,
+ locale=str(catalog.locale)
+- ), outfile)
++ ), outfile, sort_keys=True)
+ outfile.write(');')
+ finally:
+ outfile.close()
Modified: packages/sphinx/trunk/debian/patches/series
===================================================================
--- packages/sphinx/trunk/debian/patches/series 2015-08-20 09:01:26 UTC (rev 33910)
+++ packages/sphinx/trunk/debian/patches/series 2015-08-20 09:08:12 UTC (rev 33911)
@@ -8,3 +8,6 @@
addto_only_babel.diff
print_help.diff
compat_css.diff
+reproducible_grammar.diff
+reproducible_inventory.diff
+reproducible_js_locale.diff
Modified: packages/sphinx/trunk/debian/rules
===================================================================
--- packages/sphinx/trunk/debian/rules 2015-08-20 09:01:26 UTC (rev 33910)
+++ packages/sphinx/trunk/debian/rules 2015-08-20 09:08:12 UTC (rev 33911)
@@ -3,6 +3,7 @@
include /usr/share/python/python.mk
+export SOURCE_DATE_EPOCH=$(shell date -d "$$(dpkg-parsechangelog --count 1 -SDate)" +%s)
export NO_PKG_MANGLE=1
export PYTHONWARNINGS=d
export PYTHONHASHSEED=random
@@ -63,8 +64,8 @@
xvfb-run -a ./debian/jstest/run-tests build/html/
endif
# import sphinx.pycode to generate grammar pickle files
- cd build/py2/ && python -c "import sphinx.pycode"
- cd build/py3/ && python3 -c "import sphinx.pycode"
+ cd build/py2/ && PYTHONHASHSEED=0 python -c "import sphinx.pycode"
+ cd build/py3/ && PYTHONHASHSEED=0 python3 -c "import sphinx.pycode"
touch build-stamp
.PHONY: binary binary-arch binary-indep
More information about the Python-modules-commits
mailing list