Source: dh-python
Version: 2.20160818
Severity: wishlist
Tags: patch
Usertags: environment toolchain


Whilst working on the Reproducible Builds effort [0], I noticed
that some packages on i386 are not reproducible as they embed
debugging symbols that vary depending on whether a 32 or 64-bit
kernel is being used.

The root cause is because temporary build directories include the
uname output:

 -'build/bdist.linux-x86_64' does not exist -- can't clean it
 +'build/bdist.linux-i686' does not exist -- can't clean it

This value comes from ``sysconfig.get_platform``:

We can easily fix it for all dh-python packages by exporting
_PYTHON_HOST_PLATFORM in the environment (if not set!) to something
that does not vary depending on the kernel. For example, combining
DEB_TARGET_ARCH_OS and DEB_TARGET_ARCH (eg. "linux-i386").

Patch attached.



     : :'  :     Chris Lamb
     `. `'` /
diff --git a/dhpython/ b/dhpython/
index 6e47e17..93bde14 100644
--- a/dhpython/
+++ b/dhpython/
@@ -199,6 +199,18 @@ def execute(command, cwd=None, env=None, log_output=None, 
         * None if output should be included in the returned dict, or
         * False if output should be redirectored to stdout/stderr
+    if env is None:
+        env = os.environ
+    try:
+        # Override _PYTHON_HOST_PLATFORM if not set to ensure debugging symbols
+        # on, for example, i386 emded a constant name regardless of the
+        # 32/64-bit kernel.
+        env.setdefault(
+            '_PYTHON_HOST_PLATFORM',
+            '{env[DEB_TARGET_ARCH_OS]}-{env[DEB_TARGET_ARCH]}'.format(env=env),
+        )
+    except KeyError:
+        pass
     args = {'shell': shell, 'cwd': cwd, 'env': env}
     close = False
     if log_output is False:
Reproducible-builds mailing list

Reply via email to