From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Kost Subject: Re: Timestamps in ...-autoloads.el files Date: Sat, 14 Nov 2015 14:32:08 +0300 Message-ID: <87mvug7r5z.fsf@gmail.com> References: <87zize1mmq.fsf@gnu.org> <87si55h205.fsf@gmail.com> <87mvvde3h0.fsf@gnu.org> <87vba0mkwy.fsf@gmail.com> <87y4ew88km.fsf@gnu.org> <87y4egny5y.fsf@gmail.com> <87wptzz00j.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33538) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZxZ42-0007V9-Qs for guix-devel@gnu.org; Sat, 14 Nov 2015 06:32:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZxZ3x-00034B-OK for guix-devel@gnu.org; Sat, 14 Nov 2015 06:32:14 -0500 List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: guix-devel --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s (2015-11-03 16:27 +0300) wrote: > Alex Kost skribis: > >> Ludovic Court=C3=A8s (2015-10-21 19:55 +0300) wrote: >> >>> Alex Kost skribis: >>> >>>> I like the idea to honor SOURCE_DATE_EPOCH, so I'm attaching a patch f= or >>>> this. But now I don't know how to make Guix set this variable during >>>> the build process :-( Need help. >>> >>> Ahem, eventually, we=E2=80=99ll have to set it in =E2=80=98gnu-build=E2= =80=99 in (guix build >>> gnu-build-system) in the next =E2=80=98core-updates=E2=80=99 cycle. >> >> So would it be as simple as this (?): >> >> diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-syst= em.scm >> index ff7646b..92e15d1 100644 >> --- a/guix/build/gnu-build-system.scm >> +++ b/guix/build/gnu-build-system.scm >> @@ -576,6 +576,9 @@ in order. Return #t if all the PHASES succeeded, #f= otherwise." >> ;; Encoding/decoding errors shouldn't be silent. >> (fluid-set! %default-port-conversion-strategy 'error) >>=20=20 >> + ;; Avoid non-determinism related to generated timestamps. >> + (setenv "SOURCE_DATE_EPOCH" "1") >> + >> ;; The trick is to #:allow-other-keys everywhere, so that each proced= ure in >> ;; PHASES can pick the keyword arguments it's interested in. >> (every (match-lambda > > Yes, as simple as this. Great, thanks! I see that you used (setenv "SOURCE_DATE_EPOCH" "0") in 'tk-update' commit, so I also changed the value to "0". >>> In the interim, we can set it in a phase of =E2=80=98emacs-build-system= =E2=80=99, which >>> would entail few rebuilds. >>> >>> WDYT? >> >> I think it is not so important to make a temporary workaround for >> master. What about just fixing it in core-updates? > > Sure, makes sense. It=E2=80=99ll be several weeks before it is merged, t= hough, > but we can probably live with that. So is it OK to push the attached patches to 'core-updates'? >>>> +++ b/gnu/packages/patches/emacs-source-date-epoch.patch >>>> @@ -0,0 +1,20 @@ >>>> +Honor SOURCE_DATE_EPOCH variable to avoid non-determinism in generated >>>> +"autoloads" files. >>>> + >>>> +--- a/lisp/emacs-lisp/autoload.el >>>> ++++ b/lisp/emacs-lisp/autoload.el >>>> +@@ -378,8 +378,12 @@ >>>> + "Insert the section-header line, >>>> + which lists the file name and which functions are in it, etc." >>>> + (insert generate-autoload-section-header) >>>> +- (prin1 `(autoloads ,autoloads ,load-name ,file ,time) >>>> +- outbuf) >>>> ++ (let* ((env (getenv "SOURCE_DATE_EPOCH")) >>>> ++ (time (if env >>>> ++ (seconds-to-time (string-to-number env)) >>>> ++ time))) >>>> ++ (prin1 `(autoloads ,autoloads ,load-name ,file ,time) >>>> ++ outbuf)) >>>> + (terpri outbuf) >>>> + ;; Break that line at spaces, to avoid very long lines. >>>> + ;; Make each sub-line into a comment. >>> >>> Could you also submit it upstream, Cc=E2=80=99ing guix-devel and >>> reproducible-builds@lists.alioth.debian.org? Hopefully that is >>> acceptable. (I searched a bit but didn=E2=80=99t find a similar patch = by the >>> Debian Reproducible team, but patch-tracker.debian.org is unreachable.) >> >> I'm afraid it's a too hard task for me, sorry. I wouldn't like to mail >> to so many places. > > Or email only emacs-devel if you prefer. > > An experienced Emacs hacker like you shouldn=E2=80=99t have to be afraid = of that. After fighting with myself for all these days, I must admit I'm not brave enough for this task yet, sorry. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0001-build-system-gnu-Set-SOURCE_DATE_EPOCH.patch Content-Transfer-Encoding: quoted-printable >From a99fb41a7b84dd28c1a5b3f53cf14ca3c43785e7 Mon Sep 17 00:00:00 2001 From: Alex Kost Date: Sat, 14 Nov 2015 14:04:43 +0300 Subject: [PATCH 1/2] build-system/gnu: Set 'SOURCE_DATE_EPOCH'. MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit Suggested by Ludovic Court=C3=A8s . * guix/build/gnu-build-system.scm (gnu-build): Set SOURCE_DATE_EPOCH for deterministic builds. --- guix/build/gnu-build-system.scm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.= scm index ff7646b..011ccf8 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -576,6 +576,9 @@ in order. Return #t if all the PHASES succeeded, #f ot= herwise." ;; Encoding/decoding errors shouldn't be silent. (fluid-set! %default-port-conversion-strategy 'error) =20 + ;; Avoid non-determinism related to generated timestamps. + (setenv "SOURCE_DATE_EPOCH" "0") + ;; The trick is to #:allow-other-keys everywhere, so that each procedure= in ;; PHASES can pick the keyword arguments it's interested in. (every (match-lambda --=20 2.5.0 --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0002-gnu-emacs-Honor-SOURCE_DATE_EPOCH.patch Content-Transfer-Encoding: quoted-printable >From 8ee244b6470b11928aa207cf21527ca33cef31f5 Mon Sep 17 00:00:00 2001 From: Alex Kost Date: Wed, 21 Oct 2015 15:59:23 +0300 Subject: [PATCH 2/2] gnu: emacs: Honor 'SOURCE_DATE_EPOCH'. MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit Suggested by Ludovic Court=C3=A8s . * gnu/packages/patches/emacs-source-date-epoch.patch: New patch. * gnu-system.am (dist_patch_DATA): Add it. * gnu/packages/emacs.scm (emacs)[source]: Use it. --- gnu-system.am | 1 + gnu/packages/emacs.scm | 3 ++- gnu/packages/patches/emacs-source-date-epoch.patch | 20 ++++++++++++++++++= ++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/emacs-source-date-epoch.patch diff --git a/gnu-system.am b/gnu-system.am index d43358d..92370a2 100644 --- a/gnu-system.am +++ b/gnu-system.am @@ -437,6 +437,7 @@ dist_patch_DATA =3D \ gnu/packages/patches/duplicity-test_selection-tmp.patch \ gnu/packages/patches/elfutils-tests-ptrace.patch \ gnu/packages/patches/emacs-exec-path.patch \ + gnu/packages/patches/emacs-source-date-epoch.patch \ gnu/packages/patches/eudev-rules-directory.patch \ gnu/packages/patches/expat-CVE-2015-1283.patch \ gnu/packages/patches/fastcap-mulGlobal.patch \ diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm index 6416b00..9751125 100644 --- a/gnu/packages/emacs.scm +++ b/gnu/packages/emacs.scm @@ -70,7 +70,8 @@ (sha256 (base32 "0kn3rzm91qiswi0cql89kbv6mqn27rwsyjfb8xmwy9m5s8fxfiyx")) - (patches (list (search-patch "emacs-exec-path.patch"))))) + (patches (list (search-patch "emacs-exec-path.patch") + (search-patch "emacs-source-date-epoch.patch")= )))) (build-system glib-or-gtk-build-system) (arguments '(#:phases (alist-cons-before diff --git a/gnu/packages/patches/emacs-source-date-epoch.patch b/gnu/packa= ges/patches/emacs-source-date-epoch.patch new file mode 100644 index 0000000..41c03ef --- /dev/null +++ b/gnu/packages/patches/emacs-source-date-epoch.patch @@ -0,0 +1,20 @@ +Honor SOURCE_DATE_EPOCH variable to avoid non-determinism in generated +"autoloads" files. + +--- a/lisp/emacs-lisp/autoload.el ++++ b/lisp/emacs-lisp/autoload.el +@@ -378,8 +378,12 @@ + "Insert the section-header line, + which lists the file name and which functions are in it, etc." + (insert generate-autoload-section-header) +- (prin1 `(autoloads ,autoloads ,load-name ,file ,time) +- outbuf) ++ (let* ((env (getenv "SOURCE_DATE_EPOCH")) ++ (time (if env ++ (seconds-to-time (string-to-number env)) ++ time))) ++ (prin1 `(autoloads ,autoloads ,load-name ,file ,time) ++ outbuf)) + (terpri outbuf) + ;; Break that line at spaces, to avoid very long lines. + ;; Make each sub-line into a comment. --=20 2.5.0 --=-=-=--