From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Subject: bug#22533: Non-determinism in python-3 ".pyc" bytecode Date: Tue, 02 Feb 2016 21:41:19 +0100 Message-ID: <87powezvyo.fsf@gnu.org> References: <20160202051544.GA11744@jasmine> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47903) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQhm2-0000TY-74 for bug-guix@gnu.org; Tue, 02 Feb 2016 15:42:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aQhly-0000pG-73 for bug-guix@gnu.org; Tue, 02 Feb 2016 15:42:06 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:48554) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQhly-0000p8-4j for bug-guix@gnu.org; Tue, 02 Feb 2016 15:42:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aQhlx-0004LW-U0 for bug-guix@gnu.org; Tue, 02 Feb 2016 15:42:01 -0500 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <20160202051544.GA11744@jasmine> (Leo Famulari's message of "Tue, 2 Feb 2016 00:15:44 -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-bounces+gcggb-bug-guix=m.gmane.org@gnu.org To: Leo Famulari Cc: 22533@debbugs.gnu.org --=-=-= Content-Type: text/plain Leo Famulari skribis: > We fixed this in python-2 with the patch > python-2.7-source-date-epoch.patch, but I don't know how to write this > patch for python-3. I would imagine something like this (untested): --=-=-= Content-Type: text/x-patch Content-Disposition: inline --- Python-3.4.3/Lib/importlib/_bootstrap.py 2016-02-02 21:38:48.655809055 +0100 +++ Python-3.4.3/Lib/importlib/_bootstrap.py.new 2016-02-02 21:38:43.659769251 +0100 @@ -667,7 +667,10 @@ def _code_to_bytecode(code, mtime=0, sou """Compile a code object into bytecode for writing out to a byte-compiled file.""" data = bytearray(MAGIC_NUMBER) - data.extend(_w_long(mtime)) + if 'SOURCE_DATE_EPOCH' in _os.environ: + data.extend(_w_long(string.atoi(_os.environ['SOURCE_DATE_EPOCH']))) + else: + data.extend(_w_long(mtime)) data.extend(_w_long(source_size)) data.extend(marshal.dumps(code)) return data --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Could you give it a try and refine as needed? :-) > I asked about this on #debian-reproducible and they said that it wasn't > an issue for Debian since they don't ship bytecode, but instead generate > it at install time. Of course, that doesn't really apply to Guix. I=E2=80=99d recommend trying #reproducible-builds on OFTC, which is more generic. Also, in some cases, it=E2=80=99s useful to look at , which contains notes about non-reproducible packages (currently partly Debian-specific, but we need to lobby to make it more generic. ;-)) Thanks, Ludo=E2=80=99. --=-=-=--