Subject: Re: [bug#76690] [PATCH 3/4] guix: emacs-build-system: Add 'lisp-directory' key

From: Liliana Marie Prikler <[email-masked]>
Date: Sun, 02 Mar 2025 22:13:54 +0100

Am Sonntag, dem 02.03.2025 um 16:04 -0500 schrieb Morgan Smith:
> * guix/build-system/emacs.scm(emacs-build): Add 'lisp-directory' key.
> * guix/build/emacs-build-system.scm(unpack): Change into 'lisp-
> directory'
> after unpacking.
> 
> Change-Id: I3991af7188de72b29b1c6985ffe7185216cedb35
> ---
>  guix/build-system/emacs.scm       | 2 ++
>  guix/build/emacs-build-system.scm | 6 ++++--
>  2 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/guix/build-system/emacs.scm b/guix/build-
> system/emacs.scm
> index 06eec43ec4..27a029f258 100644
> --- a/guix/build-system/emacs.scm
> +++ b/guix/build-system/emacs.scm
> @@ -87,6 +87,7 @@ (define* (emacs-build name inputs
>                        (test-command ''("make" "check"))
>                        (phases '%standard-phases)
>                        (outputs '("out"))
> +                      (lisp-directory ".")
>                        (include (quote %default-include))
>                        (exclude (quote %default-exclude))
>                        (search-paths '())
> @@ -105,6 +106,7 @@ (define* (emacs-build name inputs
>            (use-modules #$@(sexp->gexp modules))
>            (emacs-build #:name #$name
>                         #:source #+source
> +                       #:lisp-directory #$lisp-directory
>                         #:system #$system
>                         #:test-command #$test-command
>                         #:tests? #$tests?
> diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-
> build-system.scm
> index aa083c6409..4e52122f22 100644
> --- a/guix/build/emacs-build-system.scm
> +++ b/guix/build/emacs-build-system.scm
> @@ -67,7 +67,7 @@ (define (store-file->elisp-source-file file)
>                      (strip-store-file-name file) suffix))))
>        (string-append name suffix))))
>  
> -(define* (unpack #:key source #:allow-other-keys)
> +(define* (unpack #:key source lisp-directory #:allow-other-keys)
>    "Unpack SOURCE into the build directory.  SOURCE may be a
> compressed
>  archive, a directory, or an Emacs Lisp file."
>    (if (string-suffix? ".el" source)
> @@ -76,7 +76,9 @@ (define* (unpack #:key source #:allow-other-keys)
>          (chdir "source")
>          (copy-file source (store-file->elisp-source-file source))
>          #t)
> -      (gnu:unpack #:source source)))
> +      (begin
> +        (gnu:unpack #:source source)
> +        (chdir lisp-directory))))
I would use (and=> lisp-directory chdir) and allow chdir to be #f.

Cheers