Bug#845325: wheel: please make the output of METADATA files reproducible

Chris Lamb lamby at debian.org
Tue Nov 22 12:53:57 UTC 2016


Source: wheel
Version: 0.29.0-1
Severity: wishlist
Tags: patch
User: reproducible-builds at lists.alioth.debian.org
Usertags: randomness toolchain
X-Debbugs-Cc: reproducible-bugs at lists.alioth.debian.org

Hi,

Whilst working on the Reproducible Builds effort [0], we noticed
that wheel generates nondeterminstic output.

For example, in python-pip's urllib3-1.15.1.dist-info/METADATA, a
``Requires-Dist header`` has two version constraints and they appear
in a nondeterminstic order:

      │   │   │   │   │ -Requires-Dist: PySocks (>=1.5.6,<2.0); extra == 'socks'
      │   │   │   │   │ +Requires-Dist: PySocks (<2.0,>=1.5.6); extra == 'socks'

Patch attached.

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


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      lamby at debian.org / chris-lamb.co.uk
       `-
-------------- next part --------------
diff --git a/wheel/metadata.py b/wheel/metadata.py
index b3cc65c..6da0cc4 100644
--- a/wheel/metadata.py
+++ b/wheel/metadata.py
@@ -223,7 +223,7 @@ def requires_to_requires_dist(requirement):
         requires_dist.append(op + ver)
     if not requires_dist:
         return ''
-    return " (%s)" % ','.join(requires_dist)
+    return " (%s)" % ','.join(sorted(requires_dist))
 
 def convert_requirements(requirements):
     """Yield Requires-Dist: strings for parsed requirements strings."""


More information about the Reproducible-bugs mailing list