From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: [PATCH PING] Honor 'SOURCE_DATE_EPOCH' when generating autoloads. Date: Sun, 27 Dec 2015 15:26:28 -0800 Organization: UCLA Computer Science Department Message-ID: <568073A4.3010604@cs.ucla.edu> References: <87k2ph3mgx.fsf@gnu.org> <87io4lnkyz.fsf@gnu.org> <83mvtwoktg.fsf@gnu.org> <878u5gkakj.fsf@gnu.org> <83a8pwoesc.fsf@gnu.org> <87two3475d.fsf@gnu.org> <5665D6B9.4030309@cs.ucla.edu> <5665DAA1.2080208@cs.ucla.edu> <83k2o9t6t1.fsf@gnu.org> <56771D52.2070406@cs.ucla.edu> <83fuytp1au.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------030805060105070002080405" X-Trace: ger.gmane.org 1451258826 7199 80.91.229.3 (27 Dec 2015 23:27:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 27 Dec 2015 23:27:06 +0000 (UTC) Cc: emacs-devel@gnu.org To: Philipp Stephani , Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Dec 28 00:26:49 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aDKi8-0004a3-Ih for ged-emacs-devel@m.gmane.org; Mon, 28 Dec 2015 00:26:48 +0100 Original-Received: from localhost ([::1]:43052 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aDKi7-0007CO-Ug for ged-emacs-devel@m.gmane.org; Sun, 27 Dec 2015 18:26:47 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59766) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aDKi1-0007CF-Ep for emacs-devel@gnu.org; Sun, 27 Dec 2015 18:26:44 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aDKhy-0003TB-A8 for emacs-devel@gnu.org; Sun, 27 Dec 2015 18:26:41 -0500 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:45358) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aDKhs-0003Sc-As; Sun, 27 Dec 2015 18:26:32 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 8DE08160CC0; Sun, 27 Dec 2015 15:26:31 -0800 (PST) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 4xfjNCoKIs59; Sun, 27 Dec 2015 15:26:29 -0800 (PST) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id F10C8160D25; Sun, 27 Dec 2015 15:26:28 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id tDLTVfLJo0hB; Sun, 27 Dec 2015 15:26:28 -0800 (PST) Original-Received: from [192.168.1.9] (pool-100-32-155-148.lsanca.fios.verizon.net [100.32.155.148]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id C13AA160CC0; Sun, 27 Dec 2015 15:26:28 -0800 (PST) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 131.179.128.68 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:196986 Archived-At: This is a multi-part message in MIME format. --------------030805060105070002080405 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Philipp Stephani wrote: > It would be great to defer > the discussion about naming, string vs. nil etc. until later so that this > project can make progress; there's still enough time to discuss until the > changes get releases. Better yet, let's just get that stuff done now. I'm attaching a followup that I hope works well enough. The first patch is a copy of yours, except with the commit message reformatted a bit for Emacs standards. The second patch is the followup. The third patch is the two patches combined; this should be easier to review than looking at the individual patches. The basic ideas behind the second patch: * Document the changes in etc/NEWS and in the relevant part of the manual. * Use "deterministic-build", not "deterministic-dump", for the name. I didn't understand the need for two variables here; we can add another one if needed. * Represent unknown values with nil, not with magic strings like "elided" or "unknown". * Make emacs-build-time deterministic, too. * Adjust the output of emacs-version and similar functions to omit the build date. * Remove what appears to be an unnecessary initialization in 'main'. --------------030805060105070002080405 Content-Type: text/x-diff; name="0001-Remove-build-system-name-from-deterministic-dumps.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-Remove-build-system-name-from-deterministic-dumps.patch" >From a6364c408a156a413d1833992790877f974187d1 Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Sun, 20 Dec 2015 01:57:34 +0100 Subject: [PATCH 1/2] Remove build system name from deterministic dumps * configure.ac (DETERMINISTIC_DUMP): New configuration option. * lisp/version.el (emacs-build-time): Add a comment to make the build time deterministic if requested. (emacs-build-system): Make variable deterministic if requested. * src/emacs.c (main): Initialize `deterministic-dump' from the configuration option. (syms_of_emacs): New constant `deterministic-dump'. * src/sysdep.c (init_system_name): Use a constant if a deterministic dump is requested. --- configure.ac | 13 +++++++++++++ lisp/version.el | 7 ++++--- src/emacs.c | 10 ++++++++++ src/sysdep.c | 7 +++++++ 4 files changed, 34 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 0b7b403..abbe7f8 100644 --- a/configure.ac +++ b/configure.ac @@ -542,6 +542,19 @@ AC_ARG_ENABLE(gtk-deprecation-warnings, [Show Gtk+/Gdk deprecation warnings for Gtk+ >= 3.0])], [ac_enable_gtk_deprecation_warnings="${enableval}"],[]) +AC_ARG_ENABLE(deterministic-dump, +[AS_HELP_STRING([--enable-deterministic-dump], + [Make dumping deterministic by removing system-specific + information from the dump, such as host names and + timestamps.])]) +if test "x${enableval}" = xno ; then + AC_DEFINE(DETERMINISTIC_DUMP, false, + [Set this to true to make dumping deterministic.]) +else + AC_DEFINE(DETERMINISTIC_DUMP, true, + [Set this to true to make dumping deterministic.]) +fi + dnl This used to use changequote, but, apart from 'changequote is evil' dnl per the autoconf manual, we can speed up autoconf somewhat by quoting dnl the great gob of text. Thus it's not processed for possible expansion. diff --git a/lisp/version.el b/lisp/version.el index 43103fd..a3f0ea0 100644 --- a/lisp/version.el +++ b/lisp/version.el @@ -38,12 +38,13 @@ emacs-minor-version "Minor version number of this version of Emacs. This variable first existed in version 19.23.") +;; FIXME: The next variable should also be a constant if +;; `deterministic-dump' is t. (defconst emacs-build-time (current-time) "Time at which Emacs was dumped out.") -;; I think this should be obsoleted/removed. It's just one more meaningless -;; difference between different builds. It's usually not even an fqdn. -(defconst emacs-build-system (system-name) +(defconst emacs-build-system + (if deterministic-dump "elided" (system-name)) "Name of the system on which Emacs was built.") (defvar motif-version-string) diff --git a/src/emacs.c b/src/emacs.c index 2e9f950..863473a 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -925,6 +925,9 @@ main (int argc, char **argv) SET_BINARY (fileno (stdout)); #endif /* MSDOS */ + if (DETERMINISTIC_DUMP) + Vdeterministic_dump = Qt; + /* Skip initial setlocale if LC_ALL is "C", as it's not needed in that case. The build procedure uses this while dumping, to ensure that the dumped Emacs does not have its system locale tables initialized, @@ -2566,6 +2569,13 @@ libraries; only those already known by Emacs will be loaded. */); Vdynamic_library_alist = Qnil; Fput (intern_c_string ("dynamic-library-alist"), Qrisky_local_variable, Qt); + DEFVAR_BOOL ("deterministic-dump", Vdeterministic_dump, + doc: /* If non-nil, attempt to make dumping deterministic by +avoiding sources of nondeterminism such as absolute file names, the +hostname, or timestamps. */); + Vdeterministic_dump = DETERMINISTIC_DUMP ? Qt : Qnil; + XSYMBOL (intern_c_string ("deterministic-dump"))->constant = 1; + #ifdef WINDOWSNT Vlibrary_cache = Qnil; staticpro (&Vlibrary_cache); diff --git a/src/sysdep.c b/src/sysdep.c index 1af323e..5bbf723 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -1399,6 +1399,13 @@ setup_pty (int fd) void init_system_name (void) { + if (DETERMINISTIC_DUMP && (might_dump || ! NILP (Vpurify_flag))) + { + /* If we're dumping, set the hostname to a literal so that the + dump is deterministic. */ + Vsystem_name = build_pure_c_string ("elided"); + return; + } char *hostname_alloc = NULL; char *hostname; #ifndef HAVE_GETHOSTNAME -- 2.5.0 --------------030805060105070002080405 Content-Type: text/x-diff; name="0002-Deterministic-build-improvements.patch" Content-Disposition: attachment; filename="0002-Deterministic-build-improvements.patch" Content-Transfer-Encoding: quoted-printable >From 63ece9364a72fc981778a93eb4359db1d33fdd74 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 27 Dec 2015 14:50:27 -0800 Subject: [PATCH 2/2] Deterministic build improvements * configure.ac (DETERMINISTIC_BUILD): Rename from DETERMINISTIC_DUMP. All uses changed. Change option to --enable-deterministic-build. * doc/lispref/internals.texi (Building Emacs): * etc/NEWS: Document --enable-deterministic-build. * doc/lispref/intro.texi (Version Info): Remove documentation for emacs-build-time. It is no longer correct, and this variable should not be documented in the intro, any more than emacs-build-system should be documented. * lisp/erc/erc-compat.el (erc-emacs-build-time): Now nil with deterministic builds. * lisp/erc/erc.el (erc-cmd-SV): * lisp/version.el (emacs-version): Do not output build time if deterministic build. * lisp/version.el (emacs-build-time, emacs-build-system): Now nil if deterministic build. * src/emacs.c: Rename var from deterministic-dump to deterministic-build. All uses changed. (main): Remove unnecessary initialization of Vdeterministic_build. (syms_of_emacs): Set Vdeterministic_build to a boolean, not to a Lisp_Object. No need to set it if it is false, since false is the default. * src/sysdep.c (init_system_name): When dumping and deterministic build, set system-name to nil, not to "elided". --- configure.ac | 13 ++++++------- doc/lispref/internals.texi | 8 ++++++++ doc/lispref/intro.texi | 13 ------------- etc/NEWS | 8 ++++++++ lisp/erc/erc-compat.el | 5 ++--- lisp/erc/erc.el | 6 ++++-- lisp/version.el | 23 +++++++++++++---------- src/emacs.c | 15 ++++++--------- src/sysdep.c | 7 +++---- 9 files changed, 50 insertions(+), 48 deletions(-) diff --git a/configure.ac b/configure.ac index abbe7f8..9dce607 100644 --- a/configure.ac +++ b/configure.ac @@ -542,16 +542,15 @@ AC_ARG_ENABLE(gtk-deprecation-warnings, [Show Gtk+/Gdk deprecation warnings for Gtk+ >=3D 3.0])], [ac_enable_gtk_deprecation_warnings=3D"${enableval}"],[]) =20 -AC_ARG_ENABLE(deterministic-dump, -[AS_HELP_STRING([--enable-deterministic-dump], - [Make dumping deterministic by removing system-specific - information from the dump, such as host names and - timestamps.])]) +AC_ARG_ENABLE(deterministic-build, +[AS_HELP_STRING([--enable-deterministic-build], + [Make the build deterministic by omitting host names, + time stamps, etc. from the output.])]) if test "x${enableval}" =3D xno ; then - AC_DEFINE(DETERMINISTIC_DUMP, false, + AC_DEFINE(DETERMINISTIC_BUILD, false, [Set this to true to make dumping deterministic.]) else - AC_DEFINE(DETERMINISTIC_DUMP, true, + AC_DEFINE(DETERMINISTIC_BUILD, true, [Set this to true to make dumping deterministic.]) fi =20 diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi index e620da0..1b7dcfa 100644 --- a/doc/lispref/internals.texi +++ b/doc/lispref/internals.texi @@ -64,6 +64,14 @@ Building Emacs and are not able to implement dumping, then Emacs must load @file{loadup.el} each time it starts. =20 +@cindex deterministic build +@cindex @option{--enable-deterministic-build} option to @command{configu= re} + By default the dumped @file{emacs} executable contains details such +as the build time and host name. Use the +@option{--enable-determistic-build} option of @command{configure} to +suppress these details, so that building and installing Emacs twice +from the same sources should result in identical copies of Emacs. + @cindex @file{site-load.el} You can specify additional files to preload by writing a library named @file{site-load.el} that loads them. You may need to rebuild Emacs diff --git a/doc/lispref/intro.texi b/doc/lispref/intro.texi index 865c698..24a7131 100644 --- a/doc/lispref/intro.texi +++ b/doc/lispref/intro.texi @@ -491,19 +491,6 @@ Version Info giving a prefix argument makes @var{here} non-@code{nil}. @end deffn =20 -@defvar emacs-build-time -The value of this variable indicates the time at which Emacs was -built. It is a list of four integers, like the value of -@code{current-time} (@pxref{Time of Day}). - -@example -@group -emacs-build-time - @result{} (20614 63694 515336 438000) -@end group -@end example -@end defvar - @defvar emacs-version The value of this variable is the version of Emacs being run. It is a string such as @code{"23.1.1"}. The last number in this string is not diff --git a/etc/NEWS b/etc/NEWS index 20a1232..e0ddc79 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -25,6 +25,14 @@ otherwise leave it unmarked. =0C * Installation Changes in Emacs 25.2 =20 +** New configure option =E2=80=98--enable-deterministic-build=E2=80=99 a= ttempts to +build an Emacs that is reproducible; that is, if you build and +install Emacs twice, the second installation is a copy of the first. +Deterministic builds omit the build date from the output of the +emacs-version and erc-cmd-SV functions, and the leave the following +variables nil: emacs-build-system, emacs-build-time, +erc-emacs-build-time. + ** 'configure' detects the kqueue file notification library on *BSD and Mac OS X machines. =20 diff --git a/lisp/erc/erc-compat.el b/lisp/erc/erc-compat.el index d8af692..7c7edd1 100644 --- a/lisp/erc/erc-compat.el +++ b/lisp/erc/erc-compat.el @@ -54,10 +54,10 @@ erc-set-write-file-functions (set (make-local-variable 'write-file-functions) new-val)) =20 (defvar erc-emacs-build-time - (if (stringp emacs-build-time) + (if (or (stringp emacs-build-time) (not emacs-build-time)) emacs-build-time (format-time-string "%Y-%m-%d" emacs-build-time)) - "Time at which Emacs was dumped out.") + "Time at which Emacs was dumped out, or nil if not available.") =20 ;; Emacs 21 and XEmacs do not have user-emacs-directory, but XEmacs ;; has user-init-directory. @@ -164,4 +164,3 @@ erc-subseq ;; indent-tabs-mode: t ;; tab-width: 8 ;; End: - diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index cd8e427..3ff919a 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -3574,7 +3574,7 @@ gtk-version-string =20 (defun erc-cmd-SV () "Say the current ERC and Emacs version into channel." - (erc-send-message (format "I'm using ERC with %s %s (%s%s) of %s." + (erc-send-message (format "I'm using ERC with %s %s (%s%s)%s." (if (featurep 'xemacs) "XEmacs" "GNU Emacs") emacs-version system-configuration @@ -3595,7 +3595,9 @@ erc-cmd-SV x-toolkit-scroll-b= ars))) "") (if (featurep 'multi-tty) ", multi-tty" "")= ) - erc-emacs-build-time)) + (if erc-emacs-build-time + (concat " of " erc-emacs-build-time) + ""))) t) =20 (defun erc-cmd-SM () diff --git a/lisp/version.el b/lisp/version.el index a3f0ea0..a6686e1 100644 --- a/lisp/version.el +++ b/lisp/version.el @@ -38,14 +38,12 @@ emacs-minor-version "Minor version number of this version of Emacs. This variable first existed in version 19.23.") =20 -;; FIXME: The next variable should also be a constant if -;; `deterministic-dump' is t. -(defconst emacs-build-time (current-time) - "Time at which Emacs was dumped out.") +(defconst emacs-build-time (if (not deterministic-build) (current-time)) + "Time at which Emacs was dumped out, or nil if not available.") =20 (defconst emacs-build-system - (if deterministic-dump "elided" (system-name)) - "Name of the system on which Emacs was built.") + (if (not deterministic-build) (system-name)) + "Name of the system on which Emacs was built, or nil if not available.= ") =20 (defvar motif-version-string) (defvar gtk-version-string) @@ -59,9 +57,7 @@ emacs-version to the system configuration; look at `system-configuration' instead." (interactive "P") (let ((version-string - (format (if (not (called-interactively-p 'interactive)) - "GNU Emacs %s (%s%s%s%s)\n of %s" - "GNU Emacs %s (%s%s%s%s) of %s") + (format "GNU Emacs %s (%s%s%s%s)%s" emacs-version system-configuration (cond ((featurep 'motif) @@ -80,7 +76,14 @@ emacs-version (format ", %s scroll bars" (capitalize (symbol-name x-toolkit-scroll-bars))) "") - (format-time-string "%Y-%m-%d" emacs-build-time)))) + (if emacs-build-time + (format-time-string (concat + (if (called-interactively-p + 'interactive) + "" "\n") + " of %Y-%m-%d") + emacs-build-time) + "")))) (if here (insert version-string) (if (called-interactively-p 'interactive) diff --git a/src/emacs.c b/src/emacs.c index 863473a..e7c153f 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -925,9 +925,6 @@ main (int argc, char **argv) SET_BINARY (fileno (stdout)); #endif /* MSDOS */ =20 - if (DETERMINISTIC_DUMP) - Vdeterministic_dump =3D Qt; - /* Skip initial setlocale if LC_ALL is "C", as it's not needed in that= case. The build procedure uses this while dumping, to ensure that the dumped Emacs does not have its system locale tables initialized, @@ -2569,12 +2566,12 @@ libraries; only those already known by Emacs will= be loaded. */); Vdynamic_library_alist =3D Qnil; Fput (intern_c_string ("dynamic-library-alist"), Qrisky_local_variable= , Qt); =20 - DEFVAR_BOOL ("deterministic-dump", Vdeterministic_dump, - doc: /* If non-nil, attempt to make dumping deterministic by -avoiding sources of nondeterminism such as absolute file names, the -hostname, or timestamps. */); - Vdeterministic_dump =3D DETERMINISTIC_DUMP ? Qt : Qnil; - XSYMBOL (intern_c_string ("deterministic-dump"))->constant =3D 1; + DEFVAR_BOOL ("deterministic-build", Vdeterministic_build, + doc: /* If non-nil, make builds deterministic by omitting +host names, time stamps, etc. from the output. */); + if (DETERMINISTIC_BUILD) + Vdeterministic_build =3D true; + XSYMBOL (intern_c_string ("deterministic-build"))->constant =3D 1; =20 #ifdef WINDOWSNT Vlibrary_cache =3D Qnil; diff --git a/src/sysdep.c b/src/sysdep.c index 5bbf723..8147afe 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -1399,11 +1399,10 @@ setup_pty (int fd) void init_system_name (void) { - if (DETERMINISTIC_DUMP && (might_dump || ! NILP (Vpurify_flag))) + if (DETERMINISTIC_BUILD && (might_dump || ! NILP (Vpurify_flag))) { - /* If we're dumping, set the hostname to a literal so that the - dump is deterministic. */ - Vsystem_name =3D build_pure_c_string ("elided"); + /* Set system-name to nil so that the build is deterministic. */ + Vsystem_name =3D Qnil; return; } char *hostname_alloc =3D NULL; --=20 2.5.0 --------------030805060105070002080405 Content-Type: text/x-diff; name="combined.patch" Content-Disposition: attachment; filename="combined.patch" Content-Transfer-Encoding: quoted-printable diff --git a/configure.ac b/configure.ac index 0b7b403..9dce607 100644 --- a/configure.ac +++ b/configure.ac @@ -542,6 +542,18 @@ AC_ARG_ENABLE(gtk-deprecation-warnings, [Show Gtk+/Gdk deprecation warnings for Gtk+ >=3D 3.0])], [ac_enable_gtk_deprecation_warnings=3D"${enableval}"],[]) =20 +AC_ARG_ENABLE(deterministic-build, +[AS_HELP_STRING([--enable-deterministic-build], + [Make the build deterministic by omitting host names, + time stamps, etc. from the output.])]) +if test "x${enableval}" =3D xno ; then + AC_DEFINE(DETERMINISTIC_BUILD, false, + [Set this to true to make dumping deterministic.]) +else + AC_DEFINE(DETERMINISTIC_BUILD, true, + [Set this to true to make dumping deterministic.]) +fi + dnl This used to use changequote, but, apart from 'changequote is evil' dnl per the autoconf manual, we can speed up autoconf somewhat by quotin= g dnl the great gob of text. Thus it's not processed for possible expansi= on. diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi index e620da0..1b7dcfa 100644 --- a/doc/lispref/internals.texi +++ b/doc/lispref/internals.texi @@ -64,6 +64,14 @@ Building Emacs and are not able to implement dumping, then Emacs must load @file{loadup.el} each time it starts. =20 +@cindex deterministic build +@cindex @option{--enable-deterministic-build} option to @command{configu= re} + By default the dumped @file{emacs} executable contains details such +as the build time and host name. Use the +@option{--enable-determistic-build} option of @command{configure} to +suppress these details, so that building and installing Emacs twice +from the same sources should result in identical copies of Emacs. + @cindex @file{site-load.el} You can specify additional files to preload by writing a library named @file{site-load.el} that loads them. You may need to rebuild Emacs diff --git a/doc/lispref/intro.texi b/doc/lispref/intro.texi index 865c698..24a7131 100644 --- a/doc/lispref/intro.texi +++ b/doc/lispref/intro.texi @@ -491,19 +491,6 @@ Version Info giving a prefix argument makes @var{here} non-@code{nil}. @end deffn =20 -@defvar emacs-build-time -The value of this variable indicates the time at which Emacs was -built. It is a list of four integers, like the value of -@code{current-time} (@pxref{Time of Day}). - -@example -@group -emacs-build-time - @result{} (20614 63694 515336 438000) -@end group -@end example -@end defvar - @defvar emacs-version The value of this variable is the version of Emacs being run. It is a string such as @code{"23.1.1"}. The last number in this string is not diff --git a/etc/NEWS b/etc/NEWS index 20a1232..e0ddc79 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -25,6 +25,14 @@ otherwise leave it unmarked. =0C * Installation Changes in Emacs 25.2 =20 +** New configure option =E2=80=98--enable-deterministic-build=E2=80=99 a= ttempts to +build an Emacs that is reproducible; that is, if you build and +install Emacs twice, the second installation is a copy of the first. +Deterministic builds omit the build date from the output of the +emacs-version and erc-cmd-SV functions, and the leave the following +variables nil: emacs-build-system, emacs-build-time, +erc-emacs-build-time. + ** 'configure' detects the kqueue file notification library on *BSD and Mac OS X machines. =20 diff --git a/lisp/erc/erc-compat.el b/lisp/erc/erc-compat.el index d8af692..7c7edd1 100644 --- a/lisp/erc/erc-compat.el +++ b/lisp/erc/erc-compat.el @@ -54,10 +54,10 @@ erc-set-write-file-functions (set (make-local-variable 'write-file-functions) new-val)) =20 (defvar erc-emacs-build-time - (if (stringp emacs-build-time) + (if (or (stringp emacs-build-time) (not emacs-build-time)) emacs-build-time (format-time-string "%Y-%m-%d" emacs-build-time)) - "Time at which Emacs was dumped out.") + "Time at which Emacs was dumped out, or nil if not available.") =20 ;; Emacs 21 and XEmacs do not have user-emacs-directory, but XEmacs ;; has user-init-directory. @@ -164,4 +164,3 @@ erc-subseq ;; indent-tabs-mode: t ;; tab-width: 8 ;; End: - diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index cd8e427..3ff919a 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -3574,7 +3574,7 @@ gtk-version-string =20 (defun erc-cmd-SV () "Say the current ERC and Emacs version into channel." - (erc-send-message (format "I'm using ERC with %s %s (%s%s) of %s." + (erc-send-message (format "I'm using ERC with %s %s (%s%s)%s." (if (featurep 'xemacs) "XEmacs" "GNU Emacs") emacs-version system-configuration @@ -3595,7 +3595,9 @@ erc-cmd-SV x-toolkit-scroll-b= ars))) "") (if (featurep 'multi-tty) ", multi-tty" "")= ) - erc-emacs-build-time)) + (if erc-emacs-build-time + (concat " of " erc-emacs-build-time) + ""))) t) =20 (defun erc-cmd-SM () diff --git a/lisp/version.el b/lisp/version.el index 43103fd..a6686e1 100644 --- a/lisp/version.el +++ b/lisp/version.el @@ -38,13 +38,12 @@ emacs-minor-version "Minor version number of this version of Emacs. This variable first existed in version 19.23.") =20 -(defconst emacs-build-time (current-time) - "Time at which Emacs was dumped out.") +(defconst emacs-build-time (if (not deterministic-build) (current-time)) + "Time at which Emacs was dumped out, or nil if not available.") =20 -;; I think this should be obsoleted/removed. It's just one more meaning= less -;; difference between different builds. It's usually not even an fqdn. -(defconst emacs-build-system (system-name) - "Name of the system on which Emacs was built.") +(defconst emacs-build-system + (if (not deterministic-build) (system-name)) + "Name of the system on which Emacs was built, or nil if not available.= ") =20 (defvar motif-version-string) (defvar gtk-version-string) @@ -58,9 +57,7 @@ emacs-version to the system configuration; look at `system-configuration' instead." (interactive "P") (let ((version-string - (format (if (not (called-interactively-p 'interactive)) - "GNU Emacs %s (%s%s%s%s)\n of %s" - "GNU Emacs %s (%s%s%s%s) of %s") + (format "GNU Emacs %s (%s%s%s%s)%s" emacs-version system-configuration (cond ((featurep 'motif) @@ -79,7 +76,14 @@ emacs-version (format ", %s scroll bars" (capitalize (symbol-name x-toolkit-scroll-bars))) "") - (format-time-string "%Y-%m-%d" emacs-build-time)))) + (if emacs-build-time + (format-time-string (concat + (if (called-interactively-p + 'interactive) + "" "\n") + " of %Y-%m-%d") + emacs-build-time) + "")))) (if here (insert version-string) (if (called-interactively-p 'interactive) diff --git a/src/emacs.c b/src/emacs.c index 2e9f950..e7c153f 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -2566,6 +2566,13 @@ libraries; only those already known by Emacs will = be loaded. */); Vdynamic_library_alist =3D Qnil; Fput (intern_c_string ("dynamic-library-alist"), Qrisky_local_variable= , Qt); =20 + DEFVAR_BOOL ("deterministic-build", Vdeterministic_build, + doc: /* If non-nil, make builds deterministic by omitting +host names, time stamps, etc. from the output. */); + if (DETERMINISTIC_BUILD) + Vdeterministic_build =3D true; + XSYMBOL (intern_c_string ("deterministic-build"))->constant =3D 1; + #ifdef WINDOWSNT Vlibrary_cache =3D Qnil; staticpro (&Vlibrary_cache); diff --git a/src/sysdep.c b/src/sysdep.c index 1af323e..8147afe 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -1399,6 +1399,12 @@ setup_pty (int fd) void init_system_name (void) { + if (DETERMINISTIC_BUILD && (might_dump || ! NILP (Vpurify_flag))) + { + /* Set system-name to nil so that the build is deterministic. */ + Vsystem_name =3D Qnil; + return; + } char *hostname_alloc =3D NULL; char *hostname; #ifndef HAVE_GETHOSTNAME --------------030805060105070002080405--