Your message dated Wed, 14 Sep 2016 23:25:46 +0300
with message-id <[email protected]>
and subject line Re: reopening 795976
has caused the Debian Bug report #795976,
regarding sphinx: please make the build reproducible (timestamps, randomness)
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
795976: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=795976
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Source: sphinx
Version: 1.3.1-4
Severity: wishlist
Tags: patch
User: [email protected]
Usertags: timestamps randomness
X-Debbugs-Cc: [email protected]

Hi!

While working on the “reproducible builds” effort [1], we have noticed
that sphinx could not be built reproducibly.

The attached patch removes build timestamp from the output
documentation, makes domains sorted in HTML documentation, and makes
generated automata (and their pickle dump) deterministic. Once applied,
sphinx (and packages using sphinx) can be built reproducibly in our
current experimental framework.

 [1]: https://wiki.debian.org/ReproducibleBuilds

Regards,
Val
diff -ru sphinx-1.3.1.old/debian/rules sphinx-1.3.1/debian/rules
--- sphinx-1.3.1.old/debian/rules	2015-08-17 17:41:44.557345555 +0000
+++ sphinx-1.3.1/debian/rules	2015-08-18 12:26:01.040804815 +0000
@@ -3,11 +3,14 @@
 
 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
 export http_proxy=http://127.0.0.1:9/
 
+# For deterministic pickling
+export PYTHONHASHSEED=0
+
 here = $(dir $(firstword $(MAKEFILE_LIST)))/..
 debian_version = $(word 2,$(shell cd $(here) && dpkg-parsechangelog | grep ^Version:))
 upstream_version = $(subst ~,,$(firstword $(subst -, ,$(debian_version))))
diff -ru sphinx-1.3.1.old/setup.py sphinx-1.3.1/setup.py
--- sphinx-1.3.1.old/setup.py	2015-08-17 17:41:44.557345555 +0000
+++ sphinx-1.3.1/setup.py	2015-08-18 11:41:20.000000000 +0000
@@ -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()
diff -ru sphinx-1.3.1.old/sphinx/builders/html.py sphinx-1.3.1/sphinx/builders/html.py
--- sphinx-1.3.1.old/sphinx/builders/html.py	2015-08-17 17:41:44.565345555 +0000
+++ sphinx-1.3.1/sphinx/builders/html.py	2015-08-17 19:46:48.000000000 +0000
@@ -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):
diff -ru sphinx-1.3.1.old/sphinx/pycode/pgen2/pgen.py sphinx-1.3.1/sphinx/pycode/pgen2/pgen.py
--- sphinx-1.3.1.old/sphinx/pycode/pgen2/pgen.py	2015-08-17 17:41:44.561345555 +0000
+++ sphinx-1.3.1/sphinx/pycode/pgen2/pgen.py	2015-08-18 12:06:30.000000000 +0000
@@ -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)

Attachment: signature.asc
Description: OpenPGP digital signature


--- End Message ---
--- Begin Message ---
OK, closing then.

On September 14, 2016 2:56:14 AM GMT+03:00, "Jelmer Vernooij" 
<[email protected]> wrote:
> On Fri, Sep 09, 2016 at 12:04:09PM +0300, Dmitry Shachnev wrote:
> > Hi Jelmer,
> > 
> > On Sun, May 15, 2016 at 06:29:21PM +0000, Jelmer Vernooij wrote:
> > > reopen 795976
> > > thanks
> > 
> > Should this bug be still open?
> > 
> > Sphinx build should be reproducible. It FTBFS on
> reproducible-builds.org
> > because of some problem with WebKit, but that is an unrelated issue,
> and
> > I have disabled the tests in the current packaging Git.
> 
> Feel free to close it again; I don't see my comment explaining why I
> reopened it at the time. :-/
> 
> Jelmer

--
Dmitry Shachnev

--- End Message ---
_______________________________________________
Python-modules-team mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/python-modules-team

Reply via email to