Subject: Re: bug#44249: [PATCH] gnu: emacs: Make strip-double-wrap more robust

From: Ludovic Courtès <[email-masked]>
Date: Fri, 15 Jan 2021 14:28:26 +0100

Hi Morgan,

[email-masked] skribis:

> From: Morgan Smith <[email-masked]>
>
> * gnu/packages/emacs.scm (emacs) [strip-double-wrap]: Use regex to find emacs
> executable.  This works even when the version is changed by package
> transformations (e.g., version=git.master).

[...]

>               (with-directory-excursion (assoc-ref outputs "out")
> -               (copy-file (string-append
> -                           "bin/emacs-"
> -                           ,(let ((this-version (package-version this-package)))
> -                              (or (false-if-exception
> -                                   (version-major+minor+point this-version))
> -                                  (version-major+minor this-version))))
> -                          "bin/emacs")
> +               (copy-file
> +                (match (find-files "bin" "^emacs-")
> +                  ((executable . _) executable))

If we assume there should be just one “^emacs-” executable, you can
change the match clause to reflect it:

  (match (find-files "bin" "^emacs-")
    ((executable) executable))

To be even more defensive, you could refine the regexp to
“^emacs-[0-9]”.

> +                "bin/emacs")

[...]

> +       ((#:modules modules)
> +        `((guix build gnu-build-system)
> +          (guix build utils)
> +          (ice-9 match)))))

Unless I’m missing something, you don’t need to repeat #:modules in
every variant: the ‘arguments’ field is inherited by those variants, and
that includes #:modules.

You can check easily that re-adding #:modules has no effect by checking
the output of, say:

  ./pre-inst-env guix build emacs-xwidgets -d --no-grafts

before and after removing the ((#:modules modules) …) bit.

Could you send an updated patch?

This is the last missing bit before one can run things like:

  guix install emacs-next --with-branch=emacs-next=master

:-)

Thanks,
Ludo’.