python-sphinx creates unreproducible documentation by:
- embedding object memory addresses,
- producing unsorted files:
- searchindex.js
- objects.inv
- linking against remote documentation repositories with the intersphinx module
- generating unsorted section IDs and anchors in texinfo output (affects info pages)
- PDF output generated by Sphinx is similarly unreproducible.
Detection
Example debbindiff output with memory references and an unsorted index file
Example diff with and without network access:
-<li><strong>to_addr</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.6)"><em>str</em></a>) – the email to use as “to” (defaults to +<li><strong>to_addr</strong> (<em>str</em>) – the email to use as “to” (defaults to
Solution
For unsorted stuff, patch submitted as 776443.
For info pages, patch forwarded upstream in 907352 (not yet applied in Debian).
For PDFs, TODO: info page bug may contain a hint for a solution.
For the external links, either link to the packaged docs, or include a snapshot of the remote inventory and use that to construct the remote links.
An example of linking to the local docs:
intersphinx_mapping = { 'python': ('/usr/share/doc/python3-doc/html/', None), }
Make sure you add the right build-dep for the docs packages referenced (in the above case, python3-doc ).
An example of including a snapshot of the remote inventory is at the following links. Note that the inventory is included in the debian directory, so the build is fully reproducible.
https://salsa.debian.org/python-team/packages/mypy/-/blob/ad750c49e543acf813f07111a7922d8ef3d743df/debian/rules#L96 https://salsa.debian.org/python-team/packages/mypy/-/blob/ad750c49e543acf813f07111a7922d8ef3d743df/debian/patches/intersphinx#L24