From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ricardo Wurmus Subject: bug#22010: bytecode timestamps Date: Tue, 05 Feb 2019 13:25:54 +0100 Message-ID: <87sgx2h165.fsf@elephly.net> References: <871tbef8jl.fsf@gnu.org> <20160207235839.GA4994@jasmine> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([209.51.188.92]:35205) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gqzof-0003Pl-MK for bug-guix@gnu.org; Tue, 05 Feb 2019 07:27:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gqzod-00083l-UG for bug-guix@gnu.org; Tue, 05 Feb 2019 07:27:05 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:60999) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gqzoc-00083Q-Pn for bug-guix@gnu.org; Tue, 05 Feb 2019 07:27:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gqzoc-0008TZ-Ik for bug-guix@gnu.org; Tue, 05 Feb 2019 07:27:02 -0500 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <20160207235839.GA4994@jasmine> (Leo Famulari's message of "Sun, 7 Feb 2016 18:58:39 -0500") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Leo Famulari Cc: 22010@debbugs.gnu.org Leo Famulari writes: > Those differing bytes are the timestamps of the .py sources files that > correspond to the compiled .pyc / .pyo files. So, the > python-2.7-source-date-epoch.patch is working for software compiled by > the patched compiler, but not on python-2.7 itself. > > It's related to . It looks easy to fix this: --8<---------------cut here---------------start------------->8--- diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm index 1c4ea720f..34c01bd50 100644 --- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm @@ -276,6 +276,38 @@ data types.") (search-patches "python2-CVE-2018-14647.patch" "python2-CVE-2018-1000802.patch"))= ))))) =20 +(define-public python-2-rekado + (package + (inherit python-2) + (name "python2-rekado") + (arguments + `(#:tests? #f ; XXX + ,@(substitute-keyword-arguments (package-arguments python-2) + ((#:phases phases) + `(modify-phases ,phases + (add-after 'remove-tests 'rebuild-bytecode + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out"))) + ;; Disable hash randomization to ensure the generated= .pycs + ;; are reproducible. + (setenv "PYTHONHASHSEED" "0") + (for-each + (lambda (opt) + (format #t "Compiling with optimization level: ~a\= n" + (if (null? opt) "none" (car opt))) + (for-each (lambda (file) + (apply invoke + `(,(string-append out "/bin/pyt= hon") + ,@opt + "-m" "compileall" + "-f" ; force rebuild + ;; Don't build lib2to3, becau= se it contains Python 3 code. + "-x" "lib2to3/.*" + ,file))) + (find-files out "\\.py$"))) + (list '() '("-O") '("-OO"))) + #t)))))))))) + (define-public python2-called-python ;; Both 2.x and 3.x used to be called "python". In commit ;; a7714d42de2c3082f3609d1e63c83d703fb39cf9 (March 2018), we renamed the --8<---------------cut here---------------end--------------->8--- This Python variant builds reproducibly (I disabled the tests for speed and did this in a separate package to avoid grafting shenanigans and rebuilds). The phase is virtually the same as the phase of the same name in the Python 3 package; only difference is the use of =E2=80=9C/bin/python=E2=80=9D instead of =E2=80=9C/bin/python3=E2=80=9D. I wonder if we can simplify this with (setenv "PYTHONHASHSEED" "0") before any pyc files are built, but I expect that to be problematic. ~~ Ricardo