Subject: [bug#70632] [PATCH 1/2] aux-files: comp-integrity: Adjust for newer emacs.

From: Morgan Smith <[email-masked]>
Date: Mon, 29 Apr 2024 16:43:06 -0400

Liliana Marie Prikler <[email-masked]> writes:

> Hi,
>
> the change itself LGTM, but I think it should be accompanied by a
> change to Emacs 30 and also we should really try to version it because
> it rebuilds Emacs as a whole.  The emacs-team branch hasn't been used
> for a while and I think there's nothing big there; and neither is there
> a need to exercise it if we just add another file and replace the
> phase.
>
> Cheers

I think some people might want to build newer Emacs's before the 30
release.  Like how people wanted the pgtk and tree-sitter features
early.  People might want to try the new GC that's being developed.

I'm not a fan of adding another file so I came up with this solution.
See attached patch.

If we believe that a core-updates merge will occur before Emacs 30 then
I would like to see my original patch applied there.

Thanks,

Morgan

>From 0440fff5e554d442a113579fbc1330c05da98f6a Mon Sep 17 00:00:00 2001
Message-ID: <0440ff[email-masked]>
From: Morgan Smith <[email-masked]>
Date: Mon, 29 Apr 2024 15:27:59 -0400
Subject: [PATCH] gnu: emacs-next-minimal: Update to 30.0.50-3.ccb49ac.

* gnu/packages/emacs.scm (emacs-next-minimal): Update to 30.0.50-3.ccb49ac.
(emacs->emacs-next): Adjust 'validate-comp-integrity phase for newer Emacs.

Change-Id: Ib191d6044a4a3b56931f893c71dc998fc748245e
---
 gnu/packages/emacs.scm | 34 ++++++++++++++++++++++++++++++----
 1 file changed, 30 insertions(+), 4 deletions(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 411bea3ab6..022aac416f 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -553,8 +553,8 @@ (define-public emacs-wide-int
         #~(cons "--with-wide-int" #$flags))))))
 
 (define-public emacs-next-minimal
-  (let ((commit "170c6557922dad7e6e9bc0d6dadf6c080108fd42")
-        (revision "2"))
+  (let ((commit "ccb49acd2afb8cec9cec1afba16e16420b9f9261")
+        (revision "3"))
    (package
     (inherit emacs-minimal)
     (name "emacs-next-minimal")
@@ -567,7 +567,7 @@ (define-public emacs-next-minimal
              (commit commit)))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "04carva3b6h9fnlzazrsxsj41hcnjc26kxjij07l159azi40l6sk"))
+        (base32 "1hxwaqjm596yykq42wl28jicd0b8rqcabyb5xp958sirr3yi884b"))
        (patches
         (search-patches "emacs-next-exec-path.patch"
                         "emacs-fix-scheme-indent-function.patch"
@@ -585,7 +585,33 @@ (define* (emacs->emacs-next emacs #:optional name
                                   (string-drop (package-name emacs)
                                                (string-length "emacs"))))))
     (version version)
-    (source source)))
+    (source source)
+    (arguments
+     (substitute-keyword-arguments (package-arguments emacs)
+       ((#:phases phases)
+        #~(modify-phases #$phases
+            (replace 'validate-comp-integrity
+              (lambda* (#:key outputs #:allow-other-keys)
+                #$(cond
+                   ((%current-target-system)
+                    #~(display "Cannot validate native-comp on cross builds.\n"))
+                   ((member (%current-system) '("armhf-linux" "i686-linux"))
+                    #~(display "Integrity test is broken on armhf.\n"))
+                   (else
+                    #~(begin
+                        (copy-file #$(local-file
+                                      (search-auxiliary-file "emacs/comp-integrity.el"))
+                                   "comp-integrity.el")
+                        (substitute* "comp-integrity.el"
+                          (("\"native-compiled\"") "\"subr-native-elisp\"")
+                          (("\"byte-compiled\"") "\"byte-code-function\"")
+                          (("\"built-in\"") "\"primitive-function\""))
+                        (invoke
+                         (string-append (assoc-ref outputs "out") "/bin/emacs")
+                         "--batch"
+                         "--load"
+                         "comp-integrity.el"
+                         "-f" "ert-run-tests-batch-and-exit"))))))))))))
 
 (define-public emacs-next (emacs->emacs-next emacs))
 (define-public emacs-next-pgtk (emacs->emacs-next emacs-pgtk))
-- 
2.41.0