emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master dfaf8bec4e 2/2: * `batch-byte+native-compile' produce .eln younge


From: Andrea Corallo
Subject: master dfaf8bec4e 2/2: * `batch-byte+native-compile' produce .eln younger than .elc (bug#52912)
Date: Tue, 25 Jan 2022 11:50:56 -0500 (EST)

branch: master
commit dfaf8bec4e47eac2282e76d23e2ecc03c062ec39
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>

    * `batch-byte+native-compile' produce .eln younger than .elc (bug#52912)
    
    * lisp/emacs-lisp/comp.el (batch-native-compile): Add return
    value.
    (batch-byte+native-compile): Touch the produced .eln after the
    corresponding .elc is produced.
---
 lisp/emacs-lisp/comp.el | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 71914b2f2b..a23169aa0f 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -4195,9 +4195,9 @@ last directory in `native-comp-eln-load-path')."
              if (or (null byte+native-compile)
                     (cl-notany (lambda (re) (string-match re file))
                                native-comp-bootstrap-deny-list))
-             do (comp--native-compile file)
+             collect (comp--native-compile file)
              else
-             do (byte-compile-file file))))
+             collect (byte-compile-file file))))
 
 ;;;###autoload
 (defun batch-byte+native-compile ()
@@ -4211,13 +4211,18 @@ variable 'NATIVE_DISABLED' is set, only byte compile."
   (if (equal (getenv "NATIVE_DISABLED") "1")
       (batch-byte-compile)
     (cl-assert (length= command-line-args-left 1))
-    (let ((byte+native-compile t)
-          (byte-to-native-output-buffer-file nil))
-      (batch-native-compile)
+    (let* ((byte+native-compile t)
+           (byte-to-native-output-buffer-file nil)
+           (eln-file (car (batch-native-compile))))
       (pcase byte-to-native-output-buffer-file
         (`(,temp-buffer . ,target-file)
          (unwind-protect
-             (byte-write-target-file temp-buffer target-file)
+             (progn
+               (byte-write-target-file temp-buffer target-file)
+               ;; Touch the .eln in order to have it older than the
+               ;; corresponding .elc.
+               (when (stringp eln-file)
+                 (set-file-times eln-file)))
            (kill-buffer temp-buffer))))
       (setq command-line-args-left (cdr command-line-args-left)))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]