gnu: emacs: Make strip-double-wrap more robust.

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

Signed-off-by: Nicolas Goaziou <mail@nicolasgoaziou.fr>
This commit is contained in:
Morgan Smith 2020-11-01 23:35:04 -05:00 committed by Nicolas Goaziou
parent 7a9e68cc87
commit b107a19ffb
No known key found for this signature in database
GPG key ID: DA00B4F048E92F2D

View file

@ -123,6 +123,9 @@ (define-public emacs
(build-system glib-or-gtk-build-system) (build-system glib-or-gtk-build-system)
(arguments (arguments
`(#:tests? #f ; no check target `(#:tests? #f ; no check target
#:modules ((guix build glib-or-gtk-build-system)
(guix build utils)
(ice-9 match))
#:configure-flags (list "--with-modules" #:configure-flags (list "--with-modules"
"--with-cairo" "--with-cairo"
"--disable-build-details") "--disable-build-details")
@ -196,17 +199,12 @@ (define* (emacs-byte-compile-directory dir)
(lambda* (#:key outputs #:allow-other-keys) (lambda* (#:key outputs #:allow-other-keys)
;; Directly copy emacs-X.Y to emacs, so that it is not wrapped ;; 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 ;; twice. This also fixes a minor issue, where WMs would not be
;; able to track emacs back to emacs.desktop. The version is ;; able to track emacs back to emacs.desktop.
;; accessed using using THIS-PACKAGE so it "just works" for
;; inherited Emacs packages of different versions.
(with-directory-excursion (assoc-ref outputs "out") (with-directory-excursion (assoc-ref outputs "out")
(copy-file (string-append (copy-file
"bin/emacs-" (match (find-files "bin" "^emacs-")
,(let ((this-version (package-version this-package))) ((executable . _) executable))
(or (false-if-exception "bin/emacs")
(version-major+minor+point this-version))
(version-major+minor this-version))))
"bin/emacs")
#t))) #t)))
(add-before 'reset-gzip-timestamps 'make-compressed-files-writable (add-before 'reset-gzip-timestamps 'make-compressed-files-writable
;; The 'reset-gzip-timestamps phase will throw a permission error ;; The 'reset-gzip-timestamps phase will throw a permission error