Bug#1025801: sphinx: please make the build reproducible

Chris Lamb lamby at debian.org
Fri Dec 9 11:59:07 GMT 2022


Source: sphinx
Version: 5.3.0-2
Severity: wishlist
Tags: patch
User: reproducible-builds at lists.alioth.debian.org
Usertags: buildpath
X-Debbugs-Cc: reproducible-bugs at lists.alioth.debian.org

Hi,

Whilst working on the Reproducible Builds effort [0] we noticed that
sphinx could not be built reproducibly.

This is because a default argument for a method uses the path in
which that method is implemented (ie. it uses Python's __file__)
and then that (non-deterministic) default argument is included in
Sphinx's documentation. 

Patch attached that uses the typical; "fn(arg1=None) // if arg1 is
None: arg1=defaultval" pattern to avoid this.

 [0] https://reproducible-builds.org/


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      lamby at debian.org / chris-lamb.co.uk
       `-
-------------- next part --------------
--- a/debian/patches/reproducible_build.diff	1970-01-01 01:00:00.000000000 +0100
--- b/debian/patches/reproducible_build.diff	2022-12-09 10:51:24.160260646 +0000
@@ -0,0 +1,24 @@
+Description: Make the build reproducible
+Author: Chris Lamb <lamby at debian.org>
+Last-Update: 2022-12-09
+
+--- sphinx-5.3.0.orig/sphinx/locale/__init__.py
++++ sphinx-5.3.0/sphinx/locale/__init__.py
+@@ -163,13 +163,16 @@ _LOCALE_DIR = path.abspath(path.dirname(
+ 
+ 
+ def init_console(
+-    locale_dir: str = _LOCALE_DIR,
++    locale_dir: Optional[str] = None,
+     catalog: str = 'sphinx',
+ ) -> Tuple[NullTranslations, bool]:
+     """Initialize locale for console.
+ 
+     .. versionadded:: 1.8
+     """
++    if locale_dir is None:
++        locale_dir = _LOCALE_DIR
++
+     try:
+         # encoding is ignored
+         language, _ = locale.getlocale(locale.LC_MESSAGES)
--- a/debian/patches/series	2022-12-09 10:05:26.391272450 +0000
--- b/debian/patches/series	2022-12-09 10:51:22.984253932 +0000
@@ -9,3 +9,4 @@
 intersphinx_local.diff
 support_old_search_indexes.diff
 highlight_search_terms.diff
+reproducible_build.diff


More information about the Reproducible-bugs mailing list