unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#44249] [PATCH] gnu: emacs: Make strip-double-wrap more robust
@ 2020-10-27  2:01 Morgan.J.Smith
  2020-10-27 21:13 ` Nicolas Goaziou
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Morgan.J.Smith @ 2020-10-27  2:01 UTC (permalink / raw)
  To: 44249; +Cc: Morgan Smith

From: Morgan Smith <Morgan.J.Smith@outlook.com>

* 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 (ex: version=git.master)
---
 gnu/packages/emacs.scm | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 4963379d74..5c89e4c6b6 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -196,17 +196,13 @@
            (lambda* (#:key outputs #:allow-other-keys)
              ;; Directly copy emacs-X.Y to emacs, so that it is not wrapped
              ;; twice.  This also fixes a minor issue, where WMs would not be
-             ;; able to track emacs back to emacs.desktop.  The version is
-             ;; accessed using using THIS-PACKAGE so it "just works" for
-             ;; inherited Emacs packages of different versions.
+             ;; able to track emacs back to emacs.desktop.
              (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
+                (car
+                 (find-files
+                  "bin" (file-name-predicate "^emacs-([0-9]+\\.)+[0-9]+$")))
+                "bin/emacs")
                #t)))
          (add-before 'reset-gzip-timestamps 'make-compressed-files-writable
            ;; The 'reset-gzip-timestamps phase will throw a permission error
-- 
2.29.1





^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [bug#44249] [PATCH] gnu: emacs: Make strip-double-wrap more robust
  2020-10-27  2:01 [bug#44249] [PATCH] gnu: emacs: Make strip-double-wrap more robust Morgan.J.Smith
@ 2020-10-27 21:13 ` Nicolas Goaziou
  2020-11-02  4:35   ` [bug#44249] [PATCH v2] " Morgan.J.Smith
  2020-11-04 19:47 ` [bug#44249] [PATCH v3] " Morgan.J.Smith
  2021-01-31 20:30 ` bug#44249: " Ludovic Courtès
  2 siblings, 1 reply; 16+ messages in thread
From: Nicolas Goaziou @ 2020-10-27 21:13 UTC (permalink / raw)
  To: Morgan.J.Smith; +Cc: 44249

Hello,

Morgan.J.Smith@outlook.com writes:

> * 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 (ex: version=git.master)

Thank you.

> +               (copy-file
> +                (car

Please use pattern matching, i.e. `match', instead of `car'.

> +                 (find-files
> +                  "bin" (file-name-predicate "^emacs-([0-9]+\\.)+[0-9]+$")))
> +                "bin/emacs")

Would it be even more robust to simply catch any "emacs-" prefixed file
name?

Regards,
-- 
Nicolas Goaziou




^ permalink raw reply	[flat|nested] 16+ messages in thread

* [bug#44249] [PATCH v2] gnu: emacs: Make strip-double-wrap more robust
  2020-10-27 21:13 ` Nicolas Goaziou
@ 2020-11-02  4:35   ` Morgan.J.Smith
  2020-11-03  9:45     ` bug#44249: " Nicolas Goaziou
  0 siblings, 1 reply; 16+ messages in thread
From: Morgan.J.Smith @ 2020-11-02  4:35 UTC (permalink / raw)
  To: mail; +Cc: 44249, Morgan Smith

From: Morgan Smith <Morgan.J.Smith@outlook.com>

* 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 (ex: version=git.master)
---
 gnu/packages/emacs.scm | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 4963379d74..00441dee45 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -123,6 +123,9 @@
     (build-system glib-or-gtk-build-system)
     (arguments
      `(#:tests? #f                      ; no check target
+       #:modules ((guix build glib-or-gtk-build-system)
+                  (guix build utils)
+                  (ice-9 match))
        #:configure-flags (list "--with-modules"
                                "--with-cairo"
                                "--disable-build-details")
@@ -196,17 +199,13 @@
            (lambda* (#:key outputs #:allow-other-keys)
              ;; Directly copy emacs-X.Y to emacs, so that it is not wrapped
              ;; twice.  This also fixes a minor issue, where WMs would not be
-             ;; able to track emacs back to emacs.desktop.  The version is
-             ;; accessed using using THIS-PACKAGE so it "just works" for
-             ;; inherited Emacs packages of different versions.
+             ;; able to track emacs back to emacs.desktop.
              (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" (file-name-predicate "^emacs-"))
+                  (((? string? string)) string))
+                "bin/emacs")
                #t)))
          (add-before 'reset-gzip-timestamps 'make-compressed-files-writable
            ;; The 'reset-gzip-timestamps phase will throw a permission error
-- 
2.29.1





^ permalink raw reply related	[flat|nested] 16+ messages in thread

* bug#44249: [PATCH v2] gnu: emacs: Make strip-double-wrap more robust
  2020-11-02  4:35   ` [bug#44249] [PATCH v2] " Morgan.J.Smith
@ 2020-11-03  9:45     ` Nicolas Goaziou
  2020-11-03 12:48       ` [bug#44249] " Nicolas Goaziou
  0 siblings, 1 reply; 16+ messages in thread
From: Nicolas Goaziou @ 2020-11-03  9:45 UTC (permalink / raw)
  To: Morgan.J.Smith; +Cc: 44249-done

Hello,

Morgan.J.Smith@outlook.com writes:

> * 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 (ex: version=git.master)

I added missing final full stops in the commit message, and tweaked your
patter a bit. In particular, I removed the call to `string?', since
I don't think `find-files' can return a non-empty list with anything not
being a string.Let me know if you think I'm wrong.

Patch applied. Thank you.

Regards,
-- 
Nicolas Goaziou




^ permalink raw reply	[flat|nested] 16+ messages in thread

* [bug#44249] [PATCH v2] gnu: emacs: Make strip-double-wrap more robust
  2020-11-03  9:45     ` bug#44249: " Nicolas Goaziou
@ 2020-11-03 12:48       ` Nicolas Goaziou
  2020-11-03 14:49         ` Morgan Smith
  0 siblings, 1 reply; 16+ messages in thread
From: Nicolas Goaziou @ 2020-11-03 12:48 UTC (permalink / raw)
  To: 44249; +Cc: Morgan.J.Smith

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Patch applied. Thank you.

And patch reverted… It generates a build error: "No code
for module (guix build glib-or-gtk-build-system)".

What is the purpose of loading (guix build glib-or-gtk-build-system)?

Regards,




^ permalink raw reply	[flat|nested] 16+ messages in thread

* [bug#44249] [PATCH v2] gnu: emacs: Make strip-double-wrap more robust
  2020-11-03 12:48       ` [bug#44249] " Nicolas Goaziou
@ 2020-11-03 14:49         ` Morgan Smith
  2020-11-03 21:38           ` Nicolas Goaziou
  0 siblings, 1 reply; 16+ messages in thread
From: Morgan Smith @ 2020-11-03 14:49 UTC (permalink / raw)
  To: Nicolas Goaziou, 44249

So I need to use the module (ice-9 match) there to get the definition of
match. However, it seems to override the modules that where previously
available there so I have to add them back.

Can you confirm how you create the error? I did a checkout to the commit
before you did the revert (51482b93b6) and I couldn't find any errors.
This is what I did:

guix environment guix -C --pure -- make distclean
git clean -xfd
guix environment guix -C --pure -- ./bootstrap
guix environment guix -C --pure -- ./configure --localstatedir=/var
guix environment guix -C --pure -- make
./pre-inst-env guix build emacs
./pre-inst-env guix build emacs-next


On 11/3/20 7:48 AM, Nicolas Goaziou wrote:
> Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> 
>> Patch applied. Thank you.
> 
> And patch reverted… It generates a build error: "No code
> for module (guix build glib-or-gtk-build-system)".
> 
> What is the purpose of loading (guix build glib-or-gtk-build-system)?
> 
> Regards,
> 




^ permalink raw reply	[flat|nested] 16+ messages in thread

* [bug#44249] [PATCH v2] gnu: emacs: Make strip-double-wrap more robust
  2020-11-03 14:49         ` Morgan Smith
@ 2020-11-03 21:38           ` Nicolas Goaziou
  2020-11-03 22:09             ` zimoun
  0 siblings, 1 reply; 16+ messages in thread
From: Nicolas Goaziou @ 2020-11-03 21:38 UTC (permalink / raw)
  To: Morgan Smith; +Cc: 44249

Morgan Smith <Morgan.J.Smith@outlook.com> writes:

> So I need to use the module (ice-9 match) there to get the definition of
> match. However, it seems to override the modules that where previously
> available there so I have to add them back.

Ah. True.

> Can you confirm how you create the error?

I cannot. I tested your patch before applying it, and could compile
Emacs just fine. However, as Ludovic reported it on IRC this commit had
introduced issues in `emacs-minimal' package, hence the revert. See, if
I understand Guix Data correctly,

http://data.guix.gnu.org/revision/b107a19ffb6a6abb7bde3436f3fa359071bd1f5c/package/emacs-minimal/27.1

Regards,




^ permalink raw reply	[flat|nested] 16+ messages in thread

* [bug#44249] [PATCH v2] gnu: emacs: Make strip-double-wrap more robust
  2020-11-03 21:38           ` Nicolas Goaziou
@ 2020-11-03 22:09             ` zimoun
  0 siblings, 0 replies; 16+ messages in thread
From: zimoun @ 2020-11-03 22:09 UTC (permalink / raw)
  To: Nicolas Goaziou, Morgan Smith; +Cc: 44249

Dear,

On Tue, 03 Nov 2020 at 22:38, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:

>> Can you confirm how you create the error?
>
> I cannot. I tested your patch before applying it, and could compile
> Emacs just fine. However, as Ludovic reported it on IRC this commit had
> introduced issues in `emacs-minimal' package, hence the revert. See, if
> I understand Guix Data correctly,
>
> http://data.guix.gnu.org/revision/b107a19ffb6a6abb7bde3436f3fa359071bd1f5c/package/emacs-minimal/27.1

Another entry point is:

https://data.guix.gnu.org/repository/1/branch/master/package/emacs-minimal/output-history

Then click on “2020-11-03 09:43:20“ which is the (commit) date of the
first failing commit and you get the revision
b107a19ffb6a6abb7bde3436f3fa359071bd1f5c

https://data.guix.gnu.org/revision/b107a19ffb6a6abb7bde3436f3fa359071bd1f5c

then click on “(View cgit)” leads to:

https://git.savannah.gnu.org/cgit/guix.git/commit/?id=b107a19ffb6a6abb7bde3436f3fa359071bd1f5c

QED. :-)


Hope that helps,
simon

PS:
The attentive reader notice the difference of hours:
“2020-11-03 09:43:20“
    vs
2020-11-03 10:30:03 +0100 
Hum?!




^ permalink raw reply	[flat|nested] 16+ messages in thread

* [bug#44249] [PATCH v3] gnu: emacs: Make strip-double-wrap more robust.
  2020-10-27  2:01 [bug#44249] [PATCH] gnu: emacs: Make strip-double-wrap more robust Morgan.J.Smith
  2020-10-27 21:13 ` Nicolas Goaziou
@ 2020-11-04 19:47 ` Morgan.J.Smith
  2020-11-05 22:33   ` Nicolas Goaziou
  2021-01-15 13:28   ` [bug#44249] [PATCH] " Ludovic Courtès
  2021-01-31 20:30 ` bug#44249: " Ludovic Courtès
  2 siblings, 2 replies; 16+ messages in thread
From: Morgan.J.Smith @ 2020-11-04 19:47 UTC (permalink / raw)
  To: mail; +Cc: 44249, Morgan Smith

From: Morgan Smith <Morgan.J.Smith@outlook.com>

* 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).
---

(Can you reopen this bug report please?)

So I see 3 possible solutions:
1. Accept my first patch and give up on match
2. Accept this patch and modify almost every emacs varient (I did test building them all)
3. Figure out some proper module inheritence

I think option 3 is the most correct, but I'm lazy so I'm leaning towards option 1.
---
 gnu/packages/emacs.scm | 42 ++++++++++++++++++++++++++++--------------
 1 file changed, 28 insertions(+), 14 deletions(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 4963379d74..4d1080f9dd 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -123,6 +123,9 @@
     (build-system glib-or-gtk-build-system)
     (arguments
      `(#:tests? #f                      ; no check target
+       #:modules ((guix build glib-or-gtk-build-system)
+                  (guix build utils)
+                  (ice-9 match))
        #:configure-flags (list "--with-modules"
                                "--with-cairo"
                                "--disable-build-details")
@@ -196,17 +199,12 @@
            (lambda* (#:key outputs #:allow-other-keys)
              ;; Directly copy emacs-X.Y to emacs, so that it is not wrapped
              ;; twice.  This also fixes a minor issue, where WMs would not be
-             ;; able to track emacs back to emacs.desktop.  The version is
-             ;; accessed using using THIS-PACKAGE so it "just works" for
-             ;; inherited Emacs packages of different versions.
+             ;; able to track emacs back to emacs.desktop.
              (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))
+                "bin/emacs")
                #t)))
          (add-before 'reset-gzip-timestamps 'make-compressed-files-writable
            ;; The 'reset-gzip-timestamps phase will throw a permission error
@@ -328,7 +326,11 @@ languages.")
        ((#:phases phases)
         `(modify-phases ,phases
            (delete 'restore-emacs-pdmp)
-           (delete 'strip-double-wrap)))))
+           (delete 'strip-double-wrap)))
+       ((#:modules modules)
+        `((guix build gnu-build-system)
+          (guix build utils)
+          (ice-9 match)))))
     (inputs
      `(("guix-emacs.el" ,(search-auxiliary-file "emacs/guix-emacs.el"))
        ("ncurses" ,ncurses)))
@@ -348,7 +350,11 @@ editor (with xwidgets support)")
        ((#:phases phases)
         `(modify-phases ,phases
            (delete 'restore-emacs-pdmp)
-           (delete 'strip-double-wrap)))))
+           (delete 'strip-double-wrap)))
+       ((#:modules modules)
+        `((guix build gnu-build-system)
+          (guix build utils)
+          (ice-9 match)))))
     (inputs
      `(("webkitgtk" ,webkitgtk)
        ("libxcomposite" ,libxcomposite)
@@ -375,7 +381,11 @@ editor (console only)")
        ((#:phases phases)
         `(modify-phases ,phases
            (delete 'restore-emacs-pdmp)
-           (delete 'strip-double-wrap)))))))
+           (delete 'strip-double-wrap)))
+       ((#:modules modules)
+        `((guix build gnu-build-system)
+          (guix build utils)
+          (ice-9 match)))))))
 
 (define-public emacs-no-x-toolkit
   (package/inherit emacs
@@ -392,7 +402,11 @@ editor (without an X toolkit)" )
        ((#:phases phases)
         `(modify-phases ,phases
            (delete 'restore-emacs-pdmp)
-           (delete 'strip-double-wrap)))))))
+           (delete 'strip-double-wrap)))
+       ((#:modules modules)
+        `((guix build gnu-build-system)
+          (guix build utils)
+          (ice-9 match)))))))
 
 (define-public emacs-wide-int
   (package/inherit emacs
-- 
2.29.1





^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [bug#44249] [PATCH v3] gnu: emacs: Make strip-double-wrap more robust.
  2020-11-04 19:47 ` [bug#44249] [PATCH v3] " Morgan.J.Smith
@ 2020-11-05 22:33   ` Nicolas Goaziou
  2020-11-07 20:48     ` Marius Bakke
  2021-01-15 13:28   ` [bug#44249] [PATCH] " Ludovic Courtès
  1 sibling, 1 reply; 16+ messages in thread
From: Nicolas Goaziou @ 2020-11-05 22:33 UTC (permalink / raw)
  To: Morgan.J.Smith; +Cc: 44249

Hello,

> (Can you reopen this bug report please?)

I think you need to open a new one.

> So I see 3 possible solutions:
> 1. Accept my first patch and give up on match
> 2. Accept this patch and modify almost every emacs varient (I did test building them all)
> 3. Figure out some proper module inheritence
>
> I think option 3 is the most correct, but I'm lazy so I'm leaning
> towards option 1.

I think I cannot help you, as I'm not sure about how module inheritance
is handled. Maybe someone else can chime in.

Regards,
-- 
Nicolas Goaziou




^ permalink raw reply	[flat|nested] 16+ messages in thread

* [bug#44249] [PATCH v3] gnu: emacs: Make strip-double-wrap more robust.
  2020-11-05 22:33   ` Nicolas Goaziou
@ 2020-11-07 20:48     ` Marius Bakke
  0 siblings, 0 replies; 16+ messages in thread
From: Marius Bakke @ 2020-11-07 20:48 UTC (permalink / raw)
  To: Nicolas Goaziou, Morgan.J.Smith; +Cc: 44249

[-- Attachment #1: Type: text/plain, Size: 850 bytes --]

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Hello,
>
>> (Can you reopen this bug report please?)
>
> I think you need to open a new one.
>
>> So I see 3 possible solutions:
>> 1. Accept my first patch and give up on match
>> 2. Accept this patch and modify almost every emacs varient (I did test building them all)
>> 3. Figure out some proper module inheritence
>>
>> I think option 3 is the most correct, but I'm lazy so I'm leaning
>> towards option 1.
>
> I think I cannot help you, as I'm not sure about how module inheritance
> is handled. Maybe someone else can chime in.

I haven't followed the discussion in detail, but from skimming through
the thread, is it just about adding (ice-9 match) to the build system
modules?

In that case I think

  #:modules ((ice-9 match) ,@%glib-or-gtk-build-system-modules)

...should do the trick.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 507 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [bug#44249] [PATCH] gnu: emacs: Make strip-double-wrap more robust
  2020-11-04 19:47 ` [bug#44249] [PATCH v3] " Morgan.J.Smith
  2020-11-05 22:33   ` Nicolas Goaziou
@ 2021-01-15 13:28   ` Ludovic Courtès
  2021-01-15 19:49     ` Morgan Smith
  1 sibling, 1 reply; 16+ messages in thread
From: Ludovic Courtès @ 2021-01-15 13:28 UTC (permalink / raw)
  To: Morgan.J.Smith; +Cc: 44249

Hi Morgan,

Morgan.J.Smith@outlook.com skribis:

> From: Morgan Smith <Morgan.J.Smith@outlook.com>
>
> * 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’.




^ permalink raw reply	[flat|nested] 16+ messages in thread

* [bug#44249] [PATCH] gnu: emacs: Make strip-double-wrap more robust
  2021-01-15 13:28   ` [bug#44249] [PATCH] " Ludovic Courtès
@ 2021-01-15 19:49     ` Morgan Smith
  2021-01-16 21:54       ` Ludovic Courtès
  0 siblings, 1 reply; 16+ messages in thread
From: Morgan Smith @ 2021-01-15 19:49 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 44249

I've actually been sorta half working on this for a while now.

The problem is exactly that the modules field is inherited. See each
build system includes its own module in the modules field. The various
emacsen are built with different build systems. So emacs is going to
need to import (guix build glib-or-gtk-build-system) and emacs-minimal
is going to want (guix build gnu-build-system). By setting the modules
to be the glib-or-gtk-build-system, we override the default modules in
each inherited package. This means building emacs-minimal would result
in this error:

no code for module (guix build glib-or-gtk-build-system)

I'm not entirely certain why it worked for you but it looks like maybe
you included the gnu-build system instead of the glib-or-gtk-build-system.

I think to solve this issue proper, we need to come up with a way to use
%default-modules. Currently this variable isn't usable in this context,
but as gnu/packages/code.scm:791 says: ";; FIXME use %default-modules"




^ permalink raw reply	[flat|nested] 16+ messages in thread

* [bug#44249] [PATCH] gnu: emacs: Make strip-double-wrap more robust
  2021-01-15 19:49     ` Morgan Smith
@ 2021-01-16 21:54       ` Ludovic Courtès
  2021-01-16 22:03         ` Morgan Smith
  0 siblings, 1 reply; 16+ messages in thread
From: Ludovic Courtès @ 2021-01-16 21:54 UTC (permalink / raw)
  To: Morgan Smith; +Cc: 44249

Hi,

Morgan Smith <Morgan.J.Smith@outlook.com> skribis:

> I've actually been sorta half working on this for a while now.
>
> The problem is exactly that the modules field is inherited. See each
> build system includes its own module in the modules field. The various
> emacsen are built with different build systems. So emacs is going to
> need to import (guix build glib-or-gtk-build-system) and emacs-minimal
> is going to want (guix build gnu-build-system). By setting the modules
> to be the glib-or-gtk-build-system, we override the default modules in
> each inherited package. This means building emacs-minimal would result
> in this error:
>
> no code for module (guix build glib-or-gtk-build-system)

Ooh, my bad, I had completely overlooked this “detail”.

Then I guess the patch is fine though… in this case you could
exceptionally ;-) write (car (find-files …)) so you don’t even need to
both importing (ice-9 match).  That’d save quite a few lines of code.

WDYT?

Thanks!

Ludo’.




^ permalink raw reply	[flat|nested] 16+ messages in thread

* [bug#44249] [PATCH] gnu: emacs: Make strip-double-wrap more robust
  2021-01-16 21:54       ` Ludovic Courtès
@ 2021-01-16 22:03         ` Morgan Smith
  0 siblings, 0 replies; 16+ messages in thread
From: Morgan Smith @ 2021-01-16 22:03 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 44249

Hi Ludo,

I think that's an elegant and wonderful idea. Assuming the first patch
in this thread still applies, I vote we just apply that one.

There has been some discussion in this thread on if the regex should
actually look for numbers or not (notably Nicolas and you). I could go
either way. I'm pretty sure the regex that's already there that matches
2 or more period separated numbers will always hold true, but feel free
to loosen up the regex a little if you feel otherwise.

Thanks,

Morgan

On 1/16/21 4:54 PM, Ludovic Courtès wrote:
> Hi,
> 
> Morgan Smith <Morgan.J.Smith@outlook.com> skribis:
> 
>> I've actually been sorta half working on this for a while now.
>>
>> The problem is exactly that the modules field is inherited. See each
>> build system includes its own module in the modules field. The various
>> emacsen are built with different build systems. So emacs is going to
>> need to import (guix build glib-or-gtk-build-system) and emacs-minimal
>> is going to want (guix build gnu-build-system). By setting the modules
>> to be the glib-or-gtk-build-system, we override the default modules in
>> each inherited package. This means building emacs-minimal would result
>> in this error:
>>
>> no code for module (guix build glib-or-gtk-build-system)
> 
> Ooh, my bad, I had completely overlooked this “detail”.
> 
> Then I guess the patch is fine though… in this case you could
> exceptionally ;-) write (car (find-files …)) so you don’t even need to
> both importing (ice-9 match).  That’d save quite a few lines of code.
> 
> WDYT?
> 
> Thanks!
> 
> Ludo’.
> 




^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#44249: [PATCH] gnu: emacs: Make strip-double-wrap more robust
  2020-10-27  2:01 [bug#44249] [PATCH] gnu: emacs: Make strip-double-wrap more robust Morgan.J.Smith
  2020-10-27 21:13 ` Nicolas Goaziou
  2020-11-04 19:47 ` [bug#44249] [PATCH v3] " Morgan.J.Smith
@ 2021-01-31 20:30 ` Ludovic Courtès
  2 siblings, 0 replies; 16+ messages in thread
From: Ludovic Courtès @ 2021-01-31 20:30 UTC (permalink / raw)
  To: Morgan.J.Smith; +Cc: 44249-done

Hi Morgan,

Morgan.J.Smith@outlook.com skribis:

> From: Morgan Smith <Morgan.J.Smith@outlook.com>
>
> * 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 (ex: version=git.master)

Somehow I had forgotten about this patch, but I finally applied it!

>               (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
> +                (car
> +                 (find-files
> +                  "bin" (file-name-predicate "^emacs-([0-9]+\\.)+[0-9]+$")))

Here I just remove ‘file-name-predicate’ because it’s implicit.  I
checked that it works with the currently-packaged version as well as
‘--with-branch=emacs-next=master’.

Thank you, and apologies for the long delay!

Ludo’.




^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2021-01-31 20:31 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-27  2:01 [bug#44249] [PATCH] gnu: emacs: Make strip-double-wrap more robust Morgan.J.Smith
2020-10-27 21:13 ` Nicolas Goaziou
2020-11-02  4:35   ` [bug#44249] [PATCH v2] " Morgan.J.Smith
2020-11-03  9:45     ` bug#44249: " Nicolas Goaziou
2020-11-03 12:48       ` [bug#44249] " Nicolas Goaziou
2020-11-03 14:49         ` Morgan Smith
2020-11-03 21:38           ` Nicolas Goaziou
2020-11-03 22:09             ` zimoun
2020-11-04 19:47 ` [bug#44249] [PATCH v3] " Morgan.J.Smith
2020-11-05 22:33   ` Nicolas Goaziou
2020-11-07 20:48     ` Marius Bakke
2021-01-15 13:28   ` [bug#44249] [PATCH] " Ludovic Courtès
2021-01-15 19:49     ` Morgan Smith
2021-01-16 21:54       ` Ludovic Courtès
2021-01-16 22:03         ` Morgan Smith
2021-01-31 20:30 ` bug#44249: " Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).