Subject: Re: [bug#67260] [PATCH emacs-team v11 0/7] You thought it was term/internal.el, but it was me, Dio!

From: Liliana Marie Prikler <[email-masked]>
Date: Mon, 04 Mar 2024 20:59:32 +0100

Am Montag, dem 04.03.2024 um 10:13 +0300 schrieb Andrew Tropin:
> On 2024-02-24 09:04, Liliana Marie Prikler wrote:
> 
> > After a week of debugging the internals of how Emacs compiles,
> > loads,
> > and dumps (!) its .eln-files, I finally came up with the perfectly
> > cursed mix that enables us to actually load *and* graft our
> > natively
> > compiled packages with ease.
> > 
> > In unrelated news, I feel like I should wear a witch hat for faster
> > development cycles.
> > 
> > Liliana Marie Prikler (7):
> >   gnu: emacs: Build trampolines.
> >   gnu: emacs: Don't hash file names in native compilation.
> >   gnu: emacs: Check integrity of native-compiled files.
> >   gnu: emacs: Disable jit compilation.
> >   build-system: emacs: Compute relative file names.
> >   gnu: emacs-org: Fix native builds.
> >   gnu: emacs-magit: Fix native builds.
> > 
> >  Makefile.am                                   |   1 +
> >  gnu/local.mk                                  |   2 +
> >  .../aux-files/emacs/comp-integrity.el         | 126 +++++++
> >  gnu/packages/emacs-xyz.scm                    |  10 +-
> >  gnu/packages/emacs.scm                        |  20 +-
> >  .../emacs-disable-jit-compilation.patch       |  19 +
> >  .../emacs-native-comp-fix-filenames.patch     | 338
> > ++++++++++++++++++
> >  guix/build/emacs-utils.scm                    |   4 +-
> >  8 files changed, 516 insertions(+), 4 deletions(-)
> >  create mode 100644 gnu/packages/aux-files/emacs/comp-integrity.el
> >  create mode 100644 gnu/packages/patches/emacs-disable-jit-
> > compilation.patch
> >  create mode 100644 gnu/packages/patches/emacs-native-comp-fix-
> > filenames.patch
> > 
> > 
> > base-commit: aae61f54ff6acf5cc0e0355dc85babf29f625660
> 
> For usual emacs it seems to work, (require 'magit) with clean eln
> cache
> doesn't trigger any builds. For emacs-pgtk it fails to build emacs:
> 
> guix time-machine --
> url='https://git.guix-patches.cbaines.net/git/guix-patches' --
> branch=issue-67260 --disable-authentication -- shell emacs-pgtk
> emacs-magit --pure -E '.*GTK.*|.*XDG.*|.*DISPLAY.*' -- emacs -Q
> 
> --8<---------------cut here---------------start------------->8---
>    passed  94/97  expect-window-right-native (0.002412 sec)
> Test expect-x-dnd-init-frame-native backtrace:
>   signal(void-function (x-dnd-init-frame))
>   apply(signal (void-function (x-dnd-init-frame)))
>   (setq value-477 (apply fn-475 args-476))
>   (unwind-protect (setq value-477 (apply fn-475 args-476)) (setq
> form-
>   (if (unwind-protect (setq value-477 (apply fn-475 args-476)) (setq
> f
>   (let (form-description-479) (if (unwind-protect (setq value-477
> (app
>   (let ((value-477 'ert-form-evaluation-aborted-478)) (let (form-
> descr
>   (let* ((fn-475 #'eq) (args-476 (condition-case err (let ((signal-
> hoo
>   (lambda nil (let* ((fn-475 #'eq) (args-476 (condition-case err (let
>   ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-
> test
>   ert-run-test(#s(ert-test :name expect-x-dnd-init-frame-native
> :docum
>   ert-run-or-rerun-test(#s(ert--stats :selector t :tests ... :test-
> map
>   ert-run-tests(t #f(compiled-function (event-type &rest event-args)
> #
>   ert-run-tests-batch(nil)
>   ert-run-tests-batch-and-exit()
>   command-line-1(("--load"
> "/gnu/store/ql9y5r4ydz4dl8jjf2b2bz9fqhxmbm3
>   command-line()
>   normal-top-level()
> Test expect-x-dnd-init-frame-native condition:
>     (void-function x-dnd-init-frame)
>    FAILED  95/97  expect-x-dnd-init-frame-native (0.000082 sec) at
> ../../../gnu/store/ql9y5r4ydz4dl8jjf2b2bz9fqhxmbm3x-comp-
> integrity.el:1
> Test expect-x-handle-no-bitmap-icon-native backtrace:
>   signal(void-function (x-handle-no-bitmap-icon))
>   apply(signal (void-function (x-handle-no-bitmap-icon)))
>   (setq value-482 (apply fn-480 args-481))
>   (unwind-protect (setq value-482 (apply fn-480 args-481)) (setq
> form-
>   (if (unwind-protect (setq value-482 (apply fn-480 args-481)) (setq
> f
>   (let (form-description-484) (if (unwind-protect (setq value-482
> (app
>   (let ((value-482 'ert-form-evaluation-aborted-483)) (let (form-
> descr
>   (let* ((fn-480 #'eq) (args-481 (condition-case err (let ((signal-
> hoo
>   (lambda nil (let* ((fn-480 #'eq) (args-481 (condition-case err (let
>   ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-
> test
>   ert-run-test(#s(ert-test :name expect-x-handle-no-bitmap-icon-
> native
>   ert-run-or-rerun-test(#s(ert--stats :selector t :tests ... :test-
> map
>   ert-run-tests(t #f(compiled-function (event-type &rest event-args)
> #
>   ert-run-tests-batch(nil)
>   ert-run-tests-batch-and-exit()
>   command-line-1(("--load"
> "/gnu/store/ql9y5r4ydz4dl8jjf2b2bz9fqhxmbm3
>   command-line()
>   normal-top-level()
> Test expect-x-handle-no-bitmap-icon-native condition:
>     (void-function x-handle-no-bitmap-icon)
>    FAILED  96/97  expect-x-handle-no-bitmap-icon-native (0.000111
> sec) at ../../../gnu/store/ql9y5r4ydz4dl8jjf2b2bz9fqhxmbm3x-comp-
> integrity.el:1
>    passed  97/97  expect-x-setup-function-keys-native (0.004165 sec)
> 
> Ran 97 tests, 95 results as expected, 2 unexpected (2024-03-02
> 05:46:28+0000, 0.361428 sec)
> 
> 2 unexpected results:
>    FAILED  expect-x-dnd-init-frame-native
>    FAILED  expect-x-handle-no-bitmap-icon-native
> 
> error: in phase 'validate-comp-integrity': uncaught exception:
> %exception #<&invoke-error program:
> "/gnu/store/m01icx06dw1vs1krcj4jbmw71nv430dp-emacs-pgtk-
> 29.2/bin/emacs" arguments: ("--batch" "--load"
> "/gnu/store/ql9y5r4ydz4dl8jjf2b2bz9fqhxmbm3x-comp-integrity.el" "-f"
> "ert-run-tests-batch-and-exit") exit-status: 1 term-signal: #f stop-
> signal: #f> 
> phase `validate-comp-integrity' failed after 0.5 seconds
> command "/gnu/store/m01icx06dw1vs1krcj4jbmw71nv430dp-emacs-pgtk-
> 29.2/bin/emacs" "--batch" "--load"
> "/gnu/store/ql9y5r4ydz4dl8jjf2b2bz9fqhxmbm3x-comp-integrity.el" "-f"
> "ert-run-tests-batch-and-exit" failed with status 1
> --8<---------------cut here---------------end--------------->8---
> 
> Thank you very much for working on it!
Try the attached patch and let me know if there's other failing
Emacsen.

Cheers
From 19fc252ab7e86ad1443a8d16f68467c61bf23179 Mon Sep 17 00:00:00 2001
Message-ID: <19fc252[email-masked]>
From: Liliana Marie Prikler <[email-masked]>
Date: Mon, 4 Mar 2024 20:54:49 +0100
Subject: [PATCH] aux-files: comp-integrity: Adjust for emacs-pgtk.

* gnu/packages/aux-files/emacs/comp-integrity.el (x-dnd-init-frame): Require
x-dnd.
(x-handle-no-bitmap-icon): Only test this if it's bound.
---
 gnu/packages/aux-files/emacs/comp-integrity.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/aux-files/emacs/comp-integrity.el b/gnu/packages/aux-files/emacs/comp-integrity.el
index 9692d9bf97..191e2ddb98 100644
--- a/gnu/packages/aux-files/emacs/comp-integrity.el
+++ b/gnu/packages/aux-files/emacs/comp-integrity.el
@@ -125,5 +125,6 @@
 (expect-native emacs-version)
 (expect-native define-widget)
 (expect-native window-right)
-(expect-native x-dnd-init-frame)
-(expect-native x-handle-no-bitmap-icon)
+(expect-native x-dnd-init-frame x-dnd)
+(and (boundp 'x-handle-no-bitmap-icon)
+     (expect-native x-handle-no-bitmap-icon))

base-commit: 3d4fc910f73220f47e5f2459853333a7c83c5d1d
prerequisite-patch-id: 96ae24a3419fccea142d2726b11ff20e798bfbd0
prerequisite-patch-id: e908853224bffffa285088dc6e31abaf12c12e02
-- 
2.41.0