lang/python/python-package-install.sh: assign SOURCE_DATE_EPOCH to PYTHONHASHSEED
authorAlexandru Ardelean <redacted>
Wed, 7 Mar 2018 18:43:35 +0000 (20:43 +0200)
committerAlexandru Ardelean <redacted>
Wed, 7 Mar 2018 18:52:15 +0000 (20:52 +0200)
Following a discussion on bugs.python.org:
* https://bugs.python.org/issue29708
* https://bugs.python.org/msg313384

It seems that setting a fixed value to PYTHONHASHSEED guarantees that
the bytecodes are generated consistently/in a reproducible manner.

Hopefully, this is the last bit to make Python3 build reproducible.
Tested this locally on a few files [that were not reproducible without
this change].

The PYTHONHASHSEED is only assigned to the host Python/Python3 during
compilation of byte-codes [from python source].

Signed-off-by: Alexandru Ardelean <redacted>
lang/python/python-package-install.sh

index d5a50322f4a711a49bda38947e0ec5deb8d0a268..e5f6ec89389f23cb38993e4cec3182b98ac5380e 100644 (file)
@@ -1,6 +1,11 @@
 #!/bin/sh
 set -e
 
+[ -z "$SOURCE_DATE_EPOCH" ] || {
+       PYTHONHASHSEED="$SOURCE_DATE_EPOCH"
+       export PYTHONHASHSEED
+}
+
 process_filespec() {
        local src_dir="$1"
        local dst_dir="$2"
git clone https://git.99rst.org/PROJECT