diff mbox series

[bug#44249,v2] gnu: emacs: Make strip-double-wrap more robust

Message ID DM5PR1001MB2105AC02013A8A7DD7A591C3C5100@DM5PR1001MB2105.namprd10.prod.outlook.com
State Accepted
Headers show
Series [bug#44249,v2] gnu: emacs: Make strip-double-wrap more robust | expand

Checks

Context Check Description
cbaines/submitting builds success
cbaines/issue success View issue
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job

Commit Message

Morgan Smith Nov. 2, 2020, 4:35 a.m. UTC
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(-)

Comments

Nicolas Goaziou Nov. 3, 2020, 9:45 a.m. UTC | #1
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 Nov. 3, 2020, 12:48 p.m. UTC | #2
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,
Morgan Smith Nov. 3, 2020, 2:49 p.m. UTC | #3
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,
>
Nicolas Goaziou Nov. 3, 2020, 9:38 p.m. UTC | #4
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,
Simon Tournier Nov. 3, 2020, 10:09 p.m. UTC | #5
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?!
diff mbox series

Patch

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