* [bug#30119] [PATCH] Add emacs-realgud and varia @ 2018-01-15 4:03 Maxim Cournoyer 2018-01-25 5:45 ` [bug#30119] [PATCHv2] " Maxim Cournoyer 0 siblings, 1 reply; 6+ messages in thread From: Maxim Cournoyer @ 2018-01-15 4:03 UTC (permalink / raw) To: 30119 [-- Attachment #1.1: Type: text/plain, Size: 163 bytes --] Hello Guix! This patch series introduces some changes and bugfixes to the Emacs build system and goes on to add RealGUD and its dependencies. Thank you, Maxim [-- Attachment #1.2: 0001-emacs-build-system-Add-set-emacs-load-path-phase.patch --] [-- Type: text/x-patch, Size: 7339 bytes --] From 0863ae90ebe7540e2c95bd191d343b7c59192a4f Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer <maxim.cournoyer@gmail.com> Date: Sat, 13 Jan 2018 17:54:18 -0500 Subject: [PATCH 1/4] emacs-build-system: Add set-emacs-load-path phase. This generalizes the mechanism by which the Emacs dependencies are made visible, so that any build phase can make use of them. * guix/build/emacs-build-system.scm (%legacy-install-suffix): New variable. (%install-suffix): Redefine in terms of %legacy-install-suffix. (set-emacs-load-path): Add new phase used for dependency resolution. (build): Remove ad-hoc dependency discovery mechanism. (emacs-input->el-directory): Add new procedure. (emacs-inputs-el-directories): Use it. (package-name-version->elpa-name-version): Fix typo. (%standard-phases): Include the new `set-emacs-load-path' phase. Refactor to make the ordering of the phases clearer. * guix/build/emacs-utils.scm (emacs-byte-compile-directory): Remove the optional `dependency-dirs' argument, which is now obsoleted by the `set-emacs-load-path' phase. --- guix/build/emacs-build-system.scm | 50 ++++++++++++++++++++++++++++----------- guix/build/emacs-utils.scm | 11 +++------ 2 files changed, 39 insertions(+), 22 deletions(-) diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm index bd0d2e026..395c55545 100644 --- a/guix/build/emacs-build-system.scm +++ b/guix/build/emacs-build-system.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch> ;;; Copyright © 2016 David Thompson <davet@gnu.org> ;;; Copyright © 2016 Alex Kost <alezost@gmail.com> +;;; Copyright © 2018 Maxim Cournoyer <maxim.cournoyer@gmail.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -42,7 +43,8 @@ ;; Directory suffix where we install ELPA packages. We avoid ".../elpa" as ;; Emacs expects to find the ELPA repository 'archive-contents' file and the ;; archive signature. -(define %install-suffix "/share/emacs/site-lisp/guix.d") +(define %legacy-install-suffix "/share/emacs/site-lisp") +(define %install-suffix (string-append %legacy-install-suffix "/guix.d")) ;; These are the default inclusion/exclusion regexps for the install phase. (define %default-include '("^[^/]*\\.el$" "^[^/]*\\.info$" "^doc/.*\\.info$")) @@ -72,17 +74,25 @@ archive, a directory, or an Emacs Lisp file." #t) (gnu:unpack #:source source))) +(define* (set-emacs-load-path #:key inputs #:allow-other-keys) + "Set the EMACSLOADPATH environment variable so that dependencies are found." + (let* ((input-elisp-dirs (emacs-inputs-el-directories + (emacs-inputs-directories inputs))) + (emacs-load-path-value (string-join + input-elisp-dirs ":" 'suffix))) + (setenv "EMACSLOADPATH" emacs-load-path-value) + (format #t "environment variable `EMACSLOADPATH' set to ~a\n" + emacs-load-path-value))) + (define* (build #:key outputs inputs #:allow-other-keys) "Compile .el files." (let* ((emacs (string-append (assoc-ref inputs "emacs") "/bin/emacs")) (out (assoc-ref outputs "out")) (elpa-name-ver (store-directory->elpa-name-version out)) - (el-dir (string-append out %install-suffix "/" elpa-name-ver)) - (deps-dirs (emacs-inputs-directories inputs))) + (el-dir (string-append out %install-suffix "/" elpa-name-ver))) (setenv "SHELL" "sh") (parameterize ((%emacs emacs)) - (emacs-byte-compile-directory el-dir - (emacs-inputs-el-directories deps-dirs))))) + (emacs-byte-compile-directory el-dir)))) (define* (patch-el-files #:key outputs #:allow-other-keys) "Substitute the absolute \"/bin/\" directory with the right location in the @@ -199,18 +209,27 @@ store in '.el' files." (match inputs (((names . directories) ...) directories)))) +(define (emacs-input->el-directory emacs-input) + "Return the correct Elisp directory location of EMACS-INPUT or #f if none." + (let ((legacy-elisp-dir (string-append emacs-input %legacy-install-suffix)) + (guix-elisp-dir (string-append + emacs-input %install-suffix "/" + (store-directory->elpa-name-version emacs-input)))) + (cond + ((file-exists? guix-elisp-dir) guix-elisp-dir) + ((file-exists? legacy-elisp-dir) legacy-elisp-dir) + (else (format #t "warning: could not locate elisp directory under `~a'\n" + emacs-input) + #f)))) + (define (emacs-inputs-el-directories dirs) "Build the list of Emacs Lisp directories from the Emacs package directory DIRS." - (append-map (lambda (d) - (list (string-append d "/share/emacs/site-lisp") - (string-append d %install-suffix "/" - (store-directory->elpa-name-version d)))) - dirs)) + (filter string? (map emacs-input->el-directory dirs))) (define (package-name-version->elpa-name-version name-ver) "Convert the Guix package NAME-VER to the corresponding ELPA name-version -format. Essnetially drop the prefix used in Guix." +format. Essentially drop the prefix used in Guix." (if (emacs-package? name-ver) ; checks for "emacs-" prefix (string-drop name-ver (string-length "emacs-")) name-ver)) @@ -224,12 +243,15 @@ second hyphen. This corresponds to 'name-version' as used in ELPA packages." (define %standard-phases (modify-phases gnu:%standard-phases + (add-after 'set-paths 'set-emacs-load-path set-emacs-load-path) (replace 'unpack unpack) (delete 'configure) (delete 'check) - (delete 'install) - (replace 'build build) - (add-before 'build 'install install) + ;; Move the build phase after install: the .el files are byte compiled + ;; directly in the store. + (delete 'build) + (replace 'install install) + (add-after 'install 'build build) (add-after 'install 'make-autoloads make-autoloads) (add-after 'make-autoloads 'patch-el-files patch-el-files) (add-after 'make-autoloads 'move-doc move-doc))) diff --git a/guix/build/emacs-utils.scm b/guix/build/emacs-utils.scm index fd06aad7a..8389ca582 100644 --- a/guix/build/emacs-utils.scm +++ b/guix/build/emacs-utils.scm @@ -58,14 +58,9 @@ (update-directory-autoloads ,directory)))) (emacs-batch-eval expr))) -(define* (emacs-byte-compile-directory dir #:optional (dependency-dirs '())) - "Byte compile all files in DIR and its sub-directories. Before compiling -the files, add DIR and all directories in DEPENDENCY-DIRS to 'load-path'." - (let ((expr `(progn - (add-to-list 'load-path ,dir) - (when ',dependency-dirs - (setq load-path (append ',dependency-dirs load-path))) - (byte-recompile-directory (file-name-as-directory ,dir) 0)))) +(define* (emacs-byte-compile-directory dir) + "Byte compile all files in DIR and its sub-directories." + (let ((expr `(byte-recompile-directory (file-name-as-directory ,dir) 0))) (emacs-batch-eval expr))) (define-syntax emacs-substitute-sexps -- 2.15.1 [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1.3: 0002-emacs-build-system-Reinstate-the-check-phase.patch --] [-- Type: text/x-patch, Size: 1759 bytes --] From 8db1634fc3d065c9397244a51f9e047154219b2d Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer <maxim.cournoyer@gmail.com> Date: Sat, 13 Jan 2018 17:54:57 -0500 Subject: [PATCH 2/4] emacs-build-system: Reinstate the check phase. * guix/build/emacs-build-system.scm (%standard-phases): Reinstate the check phase from the gnu-build-system. * guix/build-system/emacs.scm (emacs-build)[tests?]: But do not enable it by default. [parallel-tests?]: Add argument. --- guix/build-system/emacs.scm | 3 ++- guix/build/emacs-build-system.scm | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/guix/build-system/emacs.scm b/guix/build-system/emacs.scm index 02296829c..d9f1a8d28 100644 --- a/guix/build-system/emacs.scm +++ b/guix/build-system/emacs.scm @@ -82,7 +82,8 @@ (define* (emacs-build store name inputs #:key source - (tests? #t) + (tests? #f) + (parallel-tests? #t) (test-target "test") (configure-flags ''()) (phases '(@ (guix build emacs-build-system) diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm index 395c55545..791af3437 100644 --- a/guix/build/emacs-build-system.scm +++ b/guix/build/emacs-build-system.scm @@ -246,7 +246,6 @@ second hyphen. This corresponds to 'name-version' as used in ELPA packages." (add-after 'set-paths 'set-emacs-load-path set-emacs-load-path) (replace 'unpack unpack) (delete 'configure) - (delete 'check) ;; Move the build phase after install: the .el files are byte compiled ;; directly in the store. (delete 'build) -- 2.15.1 [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1.4: 0003-emacs-build-system-Work-around-issue-30611.patch --] [-- Type: text/x-patch, Size: 2091 bytes --] From 417889ab042b0dbab9bfd0801b442533fa2541bd Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer <maxim.cournoyer@gmail.com> Date: Sun, 14 Jan 2018 22:38:20 -0500 Subject: [PATCH 3/4] emacs-build-system: Work around issue 30611. This is a temporary workaround issue 30611, where substitute* crashes on files containing NUL characters. * guix/build/emacs-build-system.scm (patch-el-files): Filter out elisp files that contain NUL characters. --- guix/build/emacs-build-system.scm | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm index 791af3437..317919e24 100644 --- a/guix/build/emacs-build-system.scm +++ b/guix/build/emacs-build-system.scm @@ -97,11 +97,26 @@ archive, a directory, or an Emacs Lisp file." (define* (patch-el-files #:key outputs #:allow-other-keys) "Substitute the absolute \"/bin/\" directory with the right location in the store in '.el' files." + + ;; TODO: Remove after issue 30611 is fixed in master (see: + ;; https://debbugs.gnu.org/30116). + (define (file-contains-nul-char? file) + (call-with-input-file file + (lambda (in) + (let loop ((line (read-line in 'concat))) + (cond + ((eof-object? line) #f) + ((string-contains line (make-string 1 #\nul)) #t) + (else (loop (read-line in 'concat)))))) + #:binary #t)) + (let* ((out (assoc-ref outputs "out")) (elpa-name-ver (store-directory->elpa-name-version out)) (el-dir (string-append out %install-suffix "/" elpa-name-ver)) + (el-files (remove file-contains-nul-char? + (find-files "." "\\.el$"))) (substitute-cmd (lambda () - (substitute* (find-files "." "\\.el$") + (substitute* el-files (("\"/bin/([^.]\\S*)\"" _ cmd-name) (let ((cmd (which cmd-name))) (unless cmd -- 2.15.1 [-- Attachment #1.5: 0004-gnu-Add-emacs-realgud.patch --] [-- Type: text/x-patch, Size: 6171 bytes --] From eded0609b97cfae3c1f646e44c430620e3868674 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer <maxim.cournoyer@gmail.com> Date: Mon, 11 Dec 2017 00:07:57 -0500 Subject: [PATCH 4/4] gnu: Add emacs-realgud. * gnu/packages/emacs.scm (emacs-test-simple, emacs-load-relative, emacs-loc-changes, emacs-realgud): New public variables. --- gnu/packages/emacs.scm | 126 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 125 insertions(+), 1 deletion(-) diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm index 9f80f241b..11e8d6edf 100644 --- a/gnu/packages/emacs.scm +++ b/gnu/packages/emacs.scm @@ -31,7 +31,7 @@ ;;; Copyright © 2017 Peter Mikkelsen <petermikkelsen10@gmail.com> ;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr> ;;; Copyright © 2017 Mike Gerwitz <mtg@gnu.org> -;;; Copyright © 2017 Maxim Cournoyer <maxim.cournoyer@gmail.com> +;;; Copyright © 2017, 2018 Maxim Cournoyer <maxim.cournoyer@gmail.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -3163,6 +3163,130 @@ perspective only its buffers are available by default.") ;; the Expat license. (license license:gpl3+))) +(define-public emacs-test-simple + (package + (name "emacs-test-simple") + (version "1.3.0") + (source + (origin + (method url-fetch) + (uri (string-append "https://elpa.gnu.org/packages/test-simple-" + version ".el")) + (sha256 + (base32 + "1yd61jc9ds95a5n09052kwc5gasy57g4lxr0jsff040brlyi9czz")))) + (build-system emacs-build-system) + (home-page "https://github.com/rocky/emacs-test-simple") + (synopsis "Simple unit test framework for Emacs Lisp") + (description + "Test Simple is a simple unit test framework for Emacs Lisp. It +alleviates the need for context macros, enclosing specifications or required +test tags. It supports both interactive and non-interactive use.") + (license license:gpl3+))) + +(define-public emacs-load-relative + (package + (name "emacs-load-relative") + (version "1.3") + (source + (origin + (method url-fetch) + (uri (string-append "https://elpa.gnu.org/packages/load-relative-" + version ".el")) + (sha256 + (base32 + "1hfxb2436jdsi9wfmsv47lkkpa5galjf5q81bqabbsv79rv59dps")))) + (build-system emacs-build-system) + (home-page "http://github.com/rocky/emacs-load-relative") + (synopsis "Emacs Lisp relative file loading related functions") + (description + "Provides functions which facilitate writing multi-file Emacs packages +and running from the source tree without having to \"install\" code or fiddle +with @{load-path}. + +The main function, @code{load-relative}, loads an Emacs Lisp file relative to +another (presumably currently running) Emacs Lisp file.") + (license license:gpl3+))) + +(define-public emacs-loc-changes + (package + (name "emacs-loc-changes") + (version "1.2") + (source + (origin + (method url-fetch) + (uri (string-append "https://elpa.gnu.org/packages/loc-changes-" + version ".el")) + (sha256 + (base32 + "1x8fn8vqasayf1rb8a6nma9n6nbvkx60krmiahyb05vl5rrsw6r3")))) + (build-system emacs-build-system) + (home-page "https://github.com/rocky/emacs-loc-changes") + (synopsis "Keeps track of positions even after buffer changes") + (description + "This Emacs package provides a mean to track important buffer positions +after buffer changes.") + (license license:gpl3+))) + +(define-public emacs-realgud + (package + (name "emacs-realgud") + (version "1.4.4") + (source + (origin + (method url-fetch) + (uri (string-append "https://elpa.gnu.org/packages/realgud-" + version ".tar")) + (sha256 + (base32 + "1nc8km339ip90h1j55ahfga03v7x7rh4iycmw6yrxyzir68vwn7c")))) + (build-system emacs-build-system) + (arguments + `(#:tests? #t + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'fix-autogen-script + (lambda _ + (substitute* "autogen.sh" + (("./configure") "sh configure")) + #t)) + (add-after 'fix-autogen-script 'autogen + (lambda _ + (setenv "CONFIG_SHELL" "sh") + (zero? (system* "sh" "autogen.sh")))) + (add-after 'fix-autogen-script 'set-home + (lambda _ + (setenv "HOME" (getenv "TMPDIR")) + #t)) + (add-before 'patch-el-files 'remove-realgud-pkg.el + (lambda _ + ;; XXX: This file is auto-generated at some point and causes + ;; substitute* to crash during the `patch-el-files' phase with: + ;; ERROR: In procedure stat: No such file or directory: + ;; "./realgud-pkg.el" + (delete-file "./realgud-pkg.el") + ;; FIXME: `patch-el-files' crashes on this file with error: + ;; unable to locate "bashdb". + (delete-file "./test/test-regexp-bashdb.el")))) + #:include (cons* ".*\\.el$" %default-include))) + (native-inputs + `(("autoconf" ,autoconf) + ("automake" ,automake) + ("emacs-test-simple" ,emacs-test-simple))) + (propagated-inputs + `(("emacs-load-relative" ,emacs-load-relative) + ("emacs-loc-changes" ,emacs-loc-changes))) + (home-page "https://github.com/realgud/realgud/") + (synopsis + "Modular front-end for interacting with external debuggers") + (description + "RealGUD is a modular, extensible GNU Emacs front-end for interacting +with external debuggers. It integrates various debuggers such as gdb, pdb, +ipdb, jdb, lldb, bashdb, zshdb, etc. and allows to visually step code in the +sources. Unlike GUD, it also supports running multiple debug sessions in +parallel.") + (license license:gpl3+))) + (define-public emacs-request (package (name "emacs-request") -- 2.15.1 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 832 bytes --] ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [bug#30119] [PATCHv2] Add emacs-realgud and varia 2018-01-15 4:03 [bug#30119] [PATCH] Add emacs-realgud and varia Maxim Cournoyer @ 2018-01-25 5:45 ` Maxim Cournoyer 2018-01-30 21:05 ` Ludovic Courtès 0 siblings, 1 reply; 6+ messages in thread From: Maxim Cournoyer @ 2018-01-25 5:45 UTC (permalink / raw) To: 30119 [-- Attachment #1: Type: text/plain, Size: 393 bytes --] Maxim Cournoyer <maxim.cournoyer@gmail.com> writes: > This patch series introduces some changes and bugfixes to the Emacs > build system and goes on to add RealGUD and its dependencies. I've just reworked those patches to include an improvement suggested by Ludovic in another patch. I've also cleaned the #t and #f returned from the build phases and used invoke instead of system*. Maxim [-- Attachment #2: 0001-emacs-build-system-Add-set-emacs-load-path-phase.patch --] [-- Type: text/x-patch, Size: 7339 bytes --] From 379cf143bb078c7785d104a41a762d6136f1508e Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer <maxim.cournoyer@gmail.com> Date: Sat, 13 Jan 2018 17:54:18 -0500 Subject: [PATCH 1/4] emacs-build-system: Add set-emacs-load-path phase. This generalizes the mechanism by which the Emacs dependencies are made visible, so that any build phase can make use of them. * guix/build/emacs-build-system.scm (%legacy-install-suffix): New variable. (%install-suffix): Redefine in terms of %legacy-install-suffix. (set-emacs-load-path): Add new phase used for dependency resolution. (build): Remove ad-hoc dependency discovery mechanism. (emacs-input->el-directory): Add new procedure. (emacs-inputs-el-directories): Use it. (package-name-version->elpa-name-version): Fix typo. (%standard-phases): Include the new `set-emacs-load-path' phase. Refactor to make the ordering of the phases clearer. * guix/build/emacs-utils.scm (emacs-byte-compile-directory): Remove the optional `dependency-dirs' argument, which is now obsoleted by the `set-emacs-load-path' phase. --- guix/build/emacs-build-system.scm | 50 ++++++++++++++++++++++++++++----------- guix/build/emacs-utils.scm | 11 +++------ 2 files changed, 39 insertions(+), 22 deletions(-) diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm index bd0d2e026..395c55545 100644 --- a/guix/build/emacs-build-system.scm +++ b/guix/build/emacs-build-system.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch> ;;; Copyright © 2016 David Thompson <davet@gnu.org> ;;; Copyright © 2016 Alex Kost <alezost@gmail.com> +;;; Copyright © 2018 Maxim Cournoyer <maxim.cournoyer@gmail.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -42,7 +43,8 @@ ;; Directory suffix where we install ELPA packages. We avoid ".../elpa" as ;; Emacs expects to find the ELPA repository 'archive-contents' file and the ;; archive signature. -(define %install-suffix "/share/emacs/site-lisp/guix.d") +(define %legacy-install-suffix "/share/emacs/site-lisp") +(define %install-suffix (string-append %legacy-install-suffix "/guix.d")) ;; These are the default inclusion/exclusion regexps for the install phase. (define %default-include '("^[^/]*\\.el$" "^[^/]*\\.info$" "^doc/.*\\.info$")) @@ -72,17 +74,25 @@ archive, a directory, or an Emacs Lisp file." #t) (gnu:unpack #:source source))) +(define* (set-emacs-load-path #:key inputs #:allow-other-keys) + "Set the EMACSLOADPATH environment variable so that dependencies are found." + (let* ((input-elisp-dirs (emacs-inputs-el-directories + (emacs-inputs-directories inputs))) + (emacs-load-path-value (string-join + input-elisp-dirs ":" 'suffix))) + (setenv "EMACSLOADPATH" emacs-load-path-value) + (format #t "environment variable `EMACSLOADPATH' set to ~a\n" + emacs-load-path-value))) + (define* (build #:key outputs inputs #:allow-other-keys) "Compile .el files." (let* ((emacs (string-append (assoc-ref inputs "emacs") "/bin/emacs")) (out (assoc-ref outputs "out")) (elpa-name-ver (store-directory->elpa-name-version out)) - (el-dir (string-append out %install-suffix "/" elpa-name-ver)) - (deps-dirs (emacs-inputs-directories inputs))) + (el-dir (string-append out %install-suffix "/" elpa-name-ver))) (setenv "SHELL" "sh") (parameterize ((%emacs emacs)) - (emacs-byte-compile-directory el-dir - (emacs-inputs-el-directories deps-dirs))))) + (emacs-byte-compile-directory el-dir)))) (define* (patch-el-files #:key outputs #:allow-other-keys) "Substitute the absolute \"/bin/\" directory with the right location in the @@ -199,18 +209,27 @@ store in '.el' files." (match inputs (((names . directories) ...) directories)))) +(define (emacs-input->el-directory emacs-input) + "Return the correct Elisp directory location of EMACS-INPUT or #f if none." + (let ((legacy-elisp-dir (string-append emacs-input %legacy-install-suffix)) + (guix-elisp-dir (string-append + emacs-input %install-suffix "/" + (store-directory->elpa-name-version emacs-input)))) + (cond + ((file-exists? guix-elisp-dir) guix-elisp-dir) + ((file-exists? legacy-elisp-dir) legacy-elisp-dir) + (else (format #t "warning: could not locate elisp directory under `~a'\n" + emacs-input) + #f)))) + (define (emacs-inputs-el-directories dirs) "Build the list of Emacs Lisp directories from the Emacs package directory DIRS." - (append-map (lambda (d) - (list (string-append d "/share/emacs/site-lisp") - (string-append d %install-suffix "/" - (store-directory->elpa-name-version d)))) - dirs)) + (filter string? (map emacs-input->el-directory dirs))) (define (package-name-version->elpa-name-version name-ver) "Convert the Guix package NAME-VER to the corresponding ELPA name-version -format. Essnetially drop the prefix used in Guix." +format. Essentially drop the prefix used in Guix." (if (emacs-package? name-ver) ; checks for "emacs-" prefix (string-drop name-ver (string-length "emacs-")) name-ver)) @@ -224,12 +243,15 @@ second hyphen. This corresponds to 'name-version' as used in ELPA packages." (define %standard-phases (modify-phases gnu:%standard-phases + (add-after 'set-paths 'set-emacs-load-path set-emacs-load-path) (replace 'unpack unpack) (delete 'configure) (delete 'check) - (delete 'install) - (replace 'build build) - (add-before 'build 'install install) + ;; Move the build phase after install: the .el files are byte compiled + ;; directly in the store. + (delete 'build) + (replace 'install install) + (add-after 'install 'build build) (add-after 'install 'make-autoloads make-autoloads) (add-after 'make-autoloads 'patch-el-files patch-el-files) (add-after 'make-autoloads 'move-doc move-doc))) diff --git a/guix/build/emacs-utils.scm b/guix/build/emacs-utils.scm index fd06aad7a..8389ca582 100644 --- a/guix/build/emacs-utils.scm +++ b/guix/build/emacs-utils.scm @@ -58,14 +58,9 @@ (update-directory-autoloads ,directory)))) (emacs-batch-eval expr))) -(define* (emacs-byte-compile-directory dir #:optional (dependency-dirs '())) - "Byte compile all files in DIR and its sub-directories. Before compiling -the files, add DIR and all directories in DEPENDENCY-DIRS to 'load-path'." - (let ((expr `(progn - (add-to-list 'load-path ,dir) - (when ',dependency-dirs - (setq load-path (append ',dependency-dirs load-path))) - (byte-recompile-directory (file-name-as-directory ,dir) 0)))) +(define* (emacs-byte-compile-directory dir) + "Byte compile all files in DIR and its sub-directories." + (let ((expr `(byte-recompile-directory (file-name-as-directory ,dir) 0))) (emacs-batch-eval expr))) (define-syntax emacs-substitute-sexps -- 2.16.0 [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #3: 0002-emacs-build-system-Reinstate-the-check-phase.patch --] [-- Type: text/x-patch, Size: 1716 bytes --] From f76b5faee8b0752d1aae95b9df7a1e9e6d88bd08 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer <maxim.cournoyer@gmail.com> Date: Sat, 13 Jan 2018 17:54:57 -0500 Subject: [PATCH 2/4] emacs-build-system: Reinstate the check phase. * guix/build/emacs-build-system.scm (%standard-phases): Reinstate the check phase from the gnu-build-system. * guix/build-system/emacs.scm (emacs-build)[tests?]: But do not enable it by default. [parallel-tests?]: Add argument. --- guix/build-system/emacs.scm | 3 ++- guix/build/emacs-build-system.scm | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/guix/build-system/emacs.scm b/guix/build-system/emacs.scm index 02296829c..d9f1a8d28 100644 --- a/guix/build-system/emacs.scm +++ b/guix/build-system/emacs.scm @@ -82,7 +82,8 @@ (define* (emacs-build store name inputs #:key source - (tests? #t) + (tests? #f) + (parallel-tests? #t) (test-target "test") (configure-flags ''()) (phases '(@ (guix build emacs-build-system) diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm index 395c55545..791af3437 100644 --- a/guix/build/emacs-build-system.scm +++ b/guix/build/emacs-build-system.scm @@ -246,7 +246,6 @@ second hyphen. This corresponds to 'name-version' as used in ELPA packages." (add-after 'set-paths 'set-emacs-load-path set-emacs-load-path) (replace 'unpack unpack) (delete 'configure) - (delete 'check) ;; Move the build phase after install: the .el files are byte compiled ;; directly in the store. (delete 'build) -- 2.16.0 [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #4: 0003-emacs-build-system-Work-around-issue-30611.patch --] [-- Type: text/x-patch, Size: 2023 bytes --] From 50a671765b3d610e38f6e052a59b3eef316f4226 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer <maxim.cournoyer@gmail.com> Date: Sun, 14 Jan 2018 22:38:20 -0500 Subject: [PATCH 3/4] emacs-build-system: Work around issue 30611. This is a temporary workaround issue 30611, where substitute* crashes on files containing NUL characters. * guix/build/emacs-build-system.scm (patch-el-files): Filter out elisp files that contain NUL characters. --- guix/build/emacs-build-system.scm | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm index 791af3437..83dd3e3c3 100644 --- a/guix/build/emacs-build-system.scm +++ b/guix/build/emacs-build-system.scm @@ -97,11 +97,26 @@ archive, a directory, or an Emacs Lisp file." (define* (patch-el-files #:key outputs #:allow-other-keys) "Substitute the absolute \"/bin/\" directory with the right location in the store in '.el' files." + + ;; TODO: Remove after issue 30611 is fixed in master (see: + ;; https://debbugs.gnu.org/30116). + (define (file-contains-nul-char? file) + (call-with-input-file file + (lambda (in) + (let loop ((line (read-line in 'concat))) + (cond + ((eof-object? line) #f) + ((string-index line #\nul) #t) + (else (loop (read-line in 'concat)))))) + #:binary #t)) + (let* ((out (assoc-ref outputs "out")) (elpa-name-ver (store-directory->elpa-name-version out)) (el-dir (string-append out %install-suffix "/" elpa-name-ver)) + (el-files (remove file-contains-nul-char? + (find-files "." "\\.el$"))) (substitute-cmd (lambda () - (substitute* (find-files "." "\\.el$") + (substitute* el-files (("\"/bin/([^.]\\S*)\"" _ cmd-name) (let ((cmd (which cmd-name))) (unless cmd -- 2.16.0 [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #5: 0004-gnu-Add-emacs-realgud.patch --] [-- Type: text/x-patch, Size: 5572 bytes --] From 1e4a28920b17f7a3bf3e34a999b29e0245233942 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer <maxim.cournoyer@gmail.com> Date: Mon, 11 Dec 2017 00:07:57 -0500 Subject: [PATCH 4/4] gnu: Add emacs-realgud. * gnu/packages/emacs.scm (emacs-test-simple, emacs-load-relative, emacs-loc-changes, emacs-realgud): New public variables. --- gnu/packages/emacs.scm | 122 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm index ed95104e0..e49e48b77 100644 --- a/gnu/packages/emacs.scm +++ b/gnu/packages/emacs.scm @@ -3165,6 +3165,128 @@ perspective only its buffers are available by default.") ;; the Expat license. (license license:gpl3+))) +(define-public emacs-test-simple + (package + (name "emacs-test-simple") + (version "1.3.0") + (source + (origin + (method url-fetch) + (uri (string-append "https://elpa.gnu.org/packages/test-simple-" + version ".el")) + (sha256 + (base32 + "1yd61jc9ds95a5n09052kwc5gasy57g4lxr0jsff040brlyi9czz")))) + (build-system emacs-build-system) + (home-page "https://github.com/rocky/emacs-test-simple") + (synopsis "Simple unit test framework for Emacs Lisp") + (description + "Test Simple is a simple unit test framework for Emacs Lisp. It +alleviates the need for context macros, enclosing specifications or required +test tags. It supports both interactive and non-interactive use.") + (license license:gpl3+))) + +(define-public emacs-load-relative + (package + (name "emacs-load-relative") + (version "1.3") + (source + (origin + (method url-fetch) + (uri (string-append "https://elpa.gnu.org/packages/load-relative-" + version ".el")) + (sha256 + (base32 + "1hfxb2436jdsi9wfmsv47lkkpa5galjf5q81bqabbsv79rv59dps")))) + (build-system emacs-build-system) + (home-page "http://github.com/rocky/emacs-load-relative") + (synopsis "Emacs Lisp relative file loading related functions") + (description + "Provides functions which facilitate writing multi-file Emacs packages +and running from the source tree without having to \"install\" code or fiddle +with @{load-path}. + +The main function, @code{load-relative}, loads an Emacs Lisp file relative to +another (presumably currently running) Emacs Lisp file.") + (license license:gpl3+))) + +(define-public emacs-loc-changes + (package + (name "emacs-loc-changes") + (version "1.2") + (source + (origin + (method url-fetch) + (uri (string-append "https://elpa.gnu.org/packages/loc-changes-" + version ".el")) + (sha256 + (base32 + "1x8fn8vqasayf1rb8a6nma9n6nbvkx60krmiahyb05vl5rrsw6r3")))) + (build-system emacs-build-system) + (home-page "https://github.com/rocky/emacs-loc-changes") + (synopsis "Keeps track of positions even after buffer changes") + (description + "This Emacs package provides a mean to track important buffer positions +after buffer changes.") + (license license:gpl3+))) + +(define-public emacs-realgud + (package + (name "emacs-realgud") + (version "1.4.4") + (source + (origin + (method url-fetch) + (uri (string-append "https://elpa.gnu.org/packages/realgud-" + version ".tar")) + (sha256 + (base32 + "1nc8km339ip90h1j55ahfga03v7x7rh4iycmw6yrxyzir68vwn7c")))) + (build-system emacs-build-system) + (arguments + `(#:tests? #t + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'fix-autogen-script + (lambda _ + (substitute* "autogen.sh" + (("./configure") "sh configure")))) + (add-after 'fix-autogen-script 'autogen + (lambda _ + (setenv "CONFIG_SHELL" "sh") + (invoke "sh" "autogen.sh"))) + (add-after 'fix-autogen-script 'set-home + (lambda _ + (setenv "HOME" (getenv "TMPDIR")))) + (add-before 'patch-el-files 'remove-realgud-pkg.el + (lambda _ + ;; XXX: This file is auto-generated at some point and causes + ;; substitute* to crash during the `patch-el-files' phase with: + ;; ERROR: In procedure stat: No such file or directory: + ;; "./realgud-pkg.el" + (delete-file "./realgud-pkg.el") + ;; FIXME: `patch-el-files' crashes on this file with error: + ;; unable to locate "bashdb". + (delete-file "./test/test-regexp-bashdb.el")))) + #:include (cons* ".*\\.el$" %default-include))) + (native-inputs + `(("autoconf" ,autoconf) + ("automake" ,automake) + ("emacs-test-simple" ,emacs-test-simple))) + (propagated-inputs + `(("emacs-load-relative" ,emacs-load-relative) + ("emacs-loc-changes" ,emacs-loc-changes))) + (home-page "https://github.com/realgud/realgud/") + (synopsis + "Modular front-end for interacting with external debuggers") + (description + "RealGUD is a modular, extensible GNU Emacs front-end for interacting +with external debuggers. It integrates various debuggers such as gdb, pdb, +ipdb, jdb, lldb, bashdb, zshdb, etc. and allows to visually step code in the +sources. Unlike GUD, it also supports running multiple debug sessions in +parallel.") + (license license:gpl3+))) + (define-public emacs-request (package (name "emacs-request") -- 2.16.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [bug#30119] [PATCHv2] Add emacs-realgud and varia 2018-01-25 5:45 ` [bug#30119] [PATCHv2] " Maxim Cournoyer @ 2018-01-30 21:05 ` Ludovic Courtès 2018-02-05 3:41 ` Maxim Cournoyer 0 siblings, 1 reply; 6+ messages in thread From: Ludovic Courtès @ 2018-01-30 21:05 UTC (permalink / raw) To: Maxim Cournoyer; +Cc: 30119 Hi Maxim, Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis: > From 379cf143bb078c7785d104a41a762d6136f1508e Mon Sep 17 00:00:00 2001 > From: Maxim Cournoyer <maxim.cournoyer@gmail.com> > Date: Sat, 13 Jan 2018 17:54:18 -0500 > Subject: [PATCH 1/4] emacs-build-system: Add set-emacs-load-path phase. > > This generalizes the mechanism by which the Emacs dependencies are made visible, > so that any build phase can make use of them. > > * guix/build/emacs-build-system.scm (%legacy-install-suffix): New variable. > (%install-suffix): Redefine in terms of %legacy-install-suffix. > (set-emacs-load-path): Add new phase used for dependency resolution. > (build): Remove ad-hoc dependency discovery mechanism. > (emacs-input->el-directory): Add new procedure. > (emacs-inputs-el-directories): Use it. > (package-name-version->elpa-name-version): Fix typo. > (%standard-phases): Include the new `set-emacs-load-path' phase. Refactor to > make the ordering of the phases clearer. > * guix/build/emacs-utils.scm (emacs-byte-compile-directory): Remove the > optional `dependency-dirs' argument, which is now obsoleted by the > `set-emacs-load-path' phase. Nice! At first sight it looks good to me. If you’ve checked on a sample that Emacs packages still build fine, and if nobody replies in the meantime, I’ll apply it in a day or two. This will trigger on the order of 200 rebuilds per architecture, but these are small packages, so I think it’s fine. Nitpick: > (define (emacs-inputs-el-directories dirs) > "Build the list of Emacs Lisp directories from the Emacs package directory > DIRS." > - (append-map (lambda (d) > - (list (string-append d "/share/emacs/site-lisp") > - (string-append d %install-suffix "/" > - (store-directory->elpa-name-version d)))) > - dirs)) > + (filter string? (map emacs-input->el-directory dirs))) This can be written as: (filter-map emacs-input->el-directory dirs) > From f76b5faee8b0752d1aae95b9df7a1e9e6d88bd08 Mon Sep 17 00:00:00 2001 > From: Maxim Cournoyer <maxim.cournoyer@gmail.com> > Date: Sat, 13 Jan 2018 17:54:57 -0500 > Subject: [PATCH 2/4] emacs-build-system: Reinstate the check phase. > > * guix/build/emacs-build-system.scm (%standard-phases): Reinstate the check > phase from the gnu-build-system. > * guix/build-system/emacs.scm (emacs-build)[tests?]: But do not enable it by default. > [parallel-tests?]: Add argument. OK. > From 50a671765b3d610e38f6e052a59b3eef316f4226 Mon Sep 17 00:00:00 2001 > From: Maxim Cournoyer <maxim.cournoyer@gmail.com> > Date: Sun, 14 Jan 2018 22:38:20 -0500 > Subject: [PATCH 3/4] emacs-build-system: Work around issue 30611. > > This is a temporary workaround issue 30611, where substitute* crashes on > files containing NUL characters. > > * guix/build/emacs-build-system.scm (patch-el-files): Filter out elisp files > that contain NUL characters. [...] > + ;; TODO: Remove after issue 30611 is fixed in master (see: > + ;; https://debbugs.gnu.org/30116). Which number is correct? :-) I’m not convinced we need special treatment for this case directly in emacs-build-system. This has happened only once on 200+ packages, so I would rather leave the special case in the package definition itself. WDYT? > From 1e4a28920b17f7a3bf3e34a999b29e0245233942 Mon Sep 17 00:00:00 2001 > From: Maxim Cournoyer <maxim.cournoyer@gmail.com> > Date: Mon, 11 Dec 2017 00:07:57 -0500 > Subject: [PATCH 4/4] gnu: Add emacs-realgud. > > * gnu/packages/emacs.scm (emacs-test-simple, emacs-load-relative, > emacs-loc-changes, emacs-realgud): New public variables. LGTM. However, there’s a tradition to add one package per commit, so it would be great if you could split it and send updated patches. Thank you! Ludo’. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [bug#30119] [PATCHv2] Add emacs-realgud and varia 2018-01-30 21:05 ` Ludovic Courtès @ 2018-02-05 3:41 ` Maxim Cournoyer 2018-02-05 15:57 ` bug#30119: " Ludovic Courtès 0 siblings, 1 reply; 6+ messages in thread From: Maxim Cournoyer @ 2018-02-05 3:41 UTC (permalink / raw) To: Ludovic Courtès; +Cc: 30119 [-- Attachment #1.1: Type: text/plain, Size: 3679 bytes --] Hello Ludovic! ludo@gnu.org (Ludovic Courtès) writes: > Hi Maxim, > > Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis: > >> From 379cf143bb078c7785d104a41a762d6136f1508e Mon Sep 17 00:00:00 2001 >> From: Maxim Cournoyer <maxim.cournoyer@gmail.com> >> Date: Sat, 13 Jan 2018 17:54:18 -0500 >> Subject: [PATCH 1/4] emacs-build-system: Add set-emacs-load-path phase. >> >> This generalizes the mechanism by which the Emacs dependencies are made visible, >> so that any build phase can make use of them. >> >> * guix/build/emacs-build-system.scm (%legacy-install-suffix): New variable. >> (%install-suffix): Redefine in terms of %legacy-install-suffix. >> (set-emacs-load-path): Add new phase used for dependency resolution. >> (build): Remove ad-hoc dependency discovery mechanism. >> (emacs-input->el-directory): Add new procedure. >> (emacs-inputs-el-directories): Use it. >> (package-name-version->elpa-name-version): Fix typo. >> (%standard-phases): Include the new `set-emacs-load-path' phase. Refactor to >> make the ordering of the phases clearer. >> * guix/build/emacs-utils.scm (emacs-byte-compile-directory): Remove the >> optional `dependency-dirs' argument, which is now obsoleted by the >> `set-emacs-load-path' phase. > > Nice! At first sight it looks good to me. If you’ve checked on a > sample that Emacs packages still build fine, and if nobody replies in > the meantime, I’ll apply it in a day or two. > > This will trigger on the order of 200 rebuilds per architecture, but > these are small packages, so I think it’s fine. Yes, I did test this on a sample of random Emacs packages and they built fine with these changes. > Nitpick: > >> (define (emacs-inputs-el-directories dirs) >> "Build the list of Emacs Lisp directories from the Emacs package directory >> DIRS." >> - (append-map (lambda (d) >> - (list (string-append d "/share/emacs/site-lisp") >> - (string-append d %install-suffix "/" >> - (store-directory->elpa-name-version d)))) >> - dirs)) >> + (filter string? (map emacs-input->el-directory dirs))) > > This can be written as: > > (filter-map emacs-input->el-directory dirs) Done! It's good to know how to handle these pesky nils at last! > [...] > >> + ;; TODO: Remove after issue 30611 is fixed in master (see: >> + ;; https://debbugs.gnu.org/30116). > > Which number is correct? :-) 30116, good catch! > I’m not convinced we need special treatment for this case directly in > emacs-build-system. This has happened only once on 200+ packages, so I > would rather leave the special case in the package definition itself. > > WDYT? Hmm, I think I'd rather leave it there; the alternative implies replacing the `patch-el-files' phase in the package definition, and this would involve copy-pasting the modified phase code which is a bit messy. I'd also rather spare someone from having to investigate this problem again until 30116 is merged into master. Does it make sense? >> From 1e4a28920b17f7a3bf3e34a999b29e0245233942 Mon Sep 17 00:00:00 2001 >> From: Maxim Cournoyer <maxim.cournoyer@gmail.com> >> Date: Mon, 11 Dec 2017 00:07:57 -0500 >> Subject: [PATCH 4/4] gnu: Add emacs-realgud. >> >> * gnu/packages/emacs.scm (emacs-test-simple, emacs-load-relative, >> emacs-loc-changes, emacs-realgud): New public variables. > > LGTM. However, there’s a tradition to add one package per commit, so > it would be great if you could split it and send updated patches. Done. All patches attached! Thanks for reviewing :) Maxim [-- Attachment #1.2: 0001-emacs-build-system-Add-set-emacs-load-path-phase.patch --] [-- Type: text/x-patch, Size: 7329 bytes --] From af7aec04d6f1cc59dc370e7c4d4bdcc426026aad Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer <maxim.cournoyer@gmail.com> Date: Sat, 13 Jan 2018 17:54:18 -0500 Subject: [PATCH 1/7] emacs-build-system: Add set-emacs-load-path phase. This generalizes the mechanism by which the Emacs dependencies are made visible, so that any build phase can make use of them. * guix/build/emacs-build-system.scm (%legacy-install-suffix): New variable. (%install-suffix): Redefine in terms of %legacy-install-suffix. (set-emacs-load-path): Add new phase used for dependency resolution. (build): Remove ad-hoc dependency discovery mechanism. (emacs-input->el-directory): Add new procedure. (emacs-inputs-el-directories): Use it. (package-name-version->elpa-name-version): Fix typo. (%standard-phases): Include the new `set-emacs-load-path' phase. Refactor to make the ordering of the phases clearer. * guix/build/emacs-utils.scm (emacs-byte-compile-directory): Remove the optional `dependency-dirs' argument, which is now obsoleted by the `set-emacs-load-path' phase. --- guix/build/emacs-build-system.scm | 50 ++++++++++++++++++++++++++++----------- guix/build/emacs-utils.scm | 11 +++------ 2 files changed, 39 insertions(+), 22 deletions(-) diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm index bd0d2e026..bdef4d25d 100644 --- a/guix/build/emacs-build-system.scm +++ b/guix/build/emacs-build-system.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch> ;;; Copyright © 2016 David Thompson <davet@gnu.org> ;;; Copyright © 2016 Alex Kost <alezost@gmail.com> +;;; Copyright © 2018 Maxim Cournoyer <maxim.cournoyer@gmail.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -42,7 +43,8 @@ ;; Directory suffix where we install ELPA packages. We avoid ".../elpa" as ;; Emacs expects to find the ELPA repository 'archive-contents' file and the ;; archive signature. -(define %install-suffix "/share/emacs/site-lisp/guix.d") +(define %legacy-install-suffix "/share/emacs/site-lisp") +(define %install-suffix (string-append %legacy-install-suffix "/guix.d")) ;; These are the default inclusion/exclusion regexps for the install phase. (define %default-include '("^[^/]*\\.el$" "^[^/]*\\.info$" "^doc/.*\\.info$")) @@ -72,17 +74,25 @@ archive, a directory, or an Emacs Lisp file." #t) (gnu:unpack #:source source))) +(define* (set-emacs-load-path #:key inputs #:allow-other-keys) + "Set the EMACSLOADPATH environment variable so that dependencies are found." + (let* ((input-elisp-dirs (emacs-inputs-el-directories + (emacs-inputs-directories inputs))) + (emacs-load-path-value (string-join + input-elisp-dirs ":" 'suffix))) + (setenv "EMACSLOADPATH" emacs-load-path-value) + (format #t "environment variable `EMACSLOADPATH' set to ~a\n" + emacs-load-path-value))) + (define* (build #:key outputs inputs #:allow-other-keys) "Compile .el files." (let* ((emacs (string-append (assoc-ref inputs "emacs") "/bin/emacs")) (out (assoc-ref outputs "out")) (elpa-name-ver (store-directory->elpa-name-version out)) - (el-dir (string-append out %install-suffix "/" elpa-name-ver)) - (deps-dirs (emacs-inputs-directories inputs))) + (el-dir (string-append out %install-suffix "/" elpa-name-ver))) (setenv "SHELL" "sh") (parameterize ((%emacs emacs)) - (emacs-byte-compile-directory el-dir - (emacs-inputs-el-directories deps-dirs))))) + (emacs-byte-compile-directory el-dir)))) (define* (patch-el-files #:key outputs #:allow-other-keys) "Substitute the absolute \"/bin/\" directory with the right location in the @@ -199,18 +209,27 @@ store in '.el' files." (match inputs (((names . directories) ...) directories)))) +(define (emacs-input->el-directory emacs-input) + "Return the correct Elisp directory location of EMACS-INPUT or #f if none." + (let ((legacy-elisp-dir (string-append emacs-input %legacy-install-suffix)) + (guix-elisp-dir (string-append + emacs-input %install-suffix "/" + (store-directory->elpa-name-version emacs-input)))) + (cond + ((file-exists? guix-elisp-dir) guix-elisp-dir) + ((file-exists? legacy-elisp-dir) legacy-elisp-dir) + (else (format #t "warning: could not locate elisp directory under `~a'\n" + emacs-input) + #f)))) + (define (emacs-inputs-el-directories dirs) "Build the list of Emacs Lisp directories from the Emacs package directory DIRS." - (append-map (lambda (d) - (list (string-append d "/share/emacs/site-lisp") - (string-append d %install-suffix "/" - (store-directory->elpa-name-version d)))) - dirs)) + (filter-map emacs-input->el-directory dirs)) (define (package-name-version->elpa-name-version name-ver) "Convert the Guix package NAME-VER to the corresponding ELPA name-version -format. Essnetially drop the prefix used in Guix." +format. Essentially drop the prefix used in Guix." (if (emacs-package? name-ver) ; checks for "emacs-" prefix (string-drop name-ver (string-length "emacs-")) name-ver)) @@ -224,12 +243,15 @@ second hyphen. This corresponds to 'name-version' as used in ELPA packages." (define %standard-phases (modify-phases gnu:%standard-phases + (add-after 'set-paths 'set-emacs-load-path set-emacs-load-path) (replace 'unpack unpack) (delete 'configure) (delete 'check) - (delete 'install) - (replace 'build build) - (add-before 'build 'install install) + ;; Move the build phase after install: the .el files are byte compiled + ;; directly in the store. + (delete 'build) + (replace 'install install) + (add-after 'install 'build build) (add-after 'install 'make-autoloads make-autoloads) (add-after 'make-autoloads 'patch-el-files patch-el-files) (add-after 'make-autoloads 'move-doc move-doc))) diff --git a/guix/build/emacs-utils.scm b/guix/build/emacs-utils.scm index fd06aad7a..8389ca582 100644 --- a/guix/build/emacs-utils.scm +++ b/guix/build/emacs-utils.scm @@ -58,14 +58,9 @@ (update-directory-autoloads ,directory)))) (emacs-batch-eval expr))) -(define* (emacs-byte-compile-directory dir #:optional (dependency-dirs '())) - "Byte compile all files in DIR and its sub-directories. Before compiling -the files, add DIR and all directories in DEPENDENCY-DIRS to 'load-path'." - (let ((expr `(progn - (add-to-list 'load-path ,dir) - (when ',dependency-dirs - (setq load-path (append ',dependency-dirs load-path))) - (byte-recompile-directory (file-name-as-directory ,dir) 0)))) +(define* (emacs-byte-compile-directory dir) + "Byte compile all files in DIR and its sub-directories." + (let ((expr `(byte-recompile-directory (file-name-as-directory ,dir) 0))) (emacs-batch-eval expr))) (define-syntax emacs-substitute-sexps -- 2.16.0 [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1.3: 0002-emacs-build-system-Reinstate-the-check-phase.patch --] [-- Type: text/x-patch, Size: 1759 bytes --] From c6b336b95697466fac38a824da8e84eb3d0d18ee Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer <maxim.cournoyer@gmail.com> Date: Sat, 13 Jan 2018 17:54:57 -0500 Subject: [PATCH 2/7] emacs-build-system: Reinstate the check phase. * guix/build/emacs-build-system.scm (%standard-phases): Reinstate the check phase from the gnu-build-system. * guix/build-system/emacs.scm (emacs-build)[tests?]: But do not enable it by default. [parallel-tests?]: Add argument. --- guix/build-system/emacs.scm | 3 ++- guix/build/emacs-build-system.scm | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/guix/build-system/emacs.scm b/guix/build-system/emacs.scm index 02296829c..d9f1a8d28 100644 --- a/guix/build-system/emacs.scm +++ b/guix/build-system/emacs.scm @@ -82,7 +82,8 @@ (define* (emacs-build store name inputs #:key source - (tests? #t) + (tests? #f) + (parallel-tests? #t) (test-target "test") (configure-flags ''()) (phases '(@ (guix build emacs-build-system) diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm index bdef4d25d..a68ca60c7 100644 --- a/guix/build/emacs-build-system.scm +++ b/guix/build/emacs-build-system.scm @@ -246,7 +246,6 @@ second hyphen. This corresponds to 'name-version' as used in ELPA packages." (add-after 'set-paths 'set-emacs-load-path set-emacs-load-path) (replace 'unpack unpack) (delete 'configure) - (delete 'check) ;; Move the build phase after install: the .el files are byte compiled ;; directly in the store. (delete 'build) -- 2.16.0 [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1.4: 0003-emacs-build-system-Work-around-issue-30116.patch --] [-- Type: text/x-patch, Size: 2072 bytes --] From 4e9e0f1358b65c180218412f667a2dbb4e1b2b19 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer <maxim.cournoyer@gmail.com> Date: Sun, 14 Jan 2018 22:38:20 -0500 Subject: [PATCH 3/7] emacs-build-system: Work around issue 30116. This is a temporary workaround issue 30116, where substitute* crashes on files containing NUL characters. * guix/build/emacs-build-system.scm (patch-el-files): Filter out elisp files that contain NUL characters. --- guix/build/emacs-build-system.scm | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm index a68ca60c7..f9156e089 100644 --- a/guix/build/emacs-build-system.scm +++ b/guix/build/emacs-build-system.scm @@ -97,11 +97,26 @@ archive, a directory, or an Emacs Lisp file." (define* (patch-el-files #:key outputs #:allow-other-keys) "Substitute the absolute \"/bin/\" directory with the right location in the store in '.el' files." + + ;; TODO: Remove after issue 30116 is fixed in master (see: + ;; https://debbugs.gnu.org/30116). + (define (file-contains-nul-char? file) + (call-with-input-file file + (lambda (in) + (let loop ((line (read-line in 'concat))) + (cond + ((eof-object? line) #f) + ((string-index line #\nul) #t) + (else (loop (read-line in 'concat)))))) + #:binary #t)) + (let* ((out (assoc-ref outputs "out")) (elpa-name-ver (store-directory->elpa-name-version out)) (el-dir (string-append out %install-suffix "/" elpa-name-ver)) + (el-files (remove file-contains-nul-char? + (find-files "." "\\.el$"))) (substitute-cmd (lambda () - (substitute* (find-files "." "\\.el$") + (substitute* el-files (("\"/bin/([^.]\\S*)\"" _ cmd-name) (let ((cmd (which cmd-name))) (unless cmd -- 2.16.0 [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1.5: 0004-gnu-Add-emacs-test-simple.patch --] [-- Type: text/x-patch, Size: 1589 bytes --] From 3d6f6247e3c0e41b2298845e086b4f64d1e02a0b Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer <maxim.cournoyer@gmail.com> Date: Sun, 4 Feb 2018 22:00:01 -0500 Subject: [PATCH 4/7] gnu: Add emacs-test-simple. * gnu/packages/emacs.scm (emacs-test-simple): New public variable. --- gnu/packages/emacs.scm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm index 9be92edc1..25be4388b 100644 --- a/gnu/packages/emacs.scm +++ b/gnu/packages/emacs.scm @@ -3165,6 +3165,27 @@ perspective only its buffers are available by default.") ;; the Expat license. (license license:gpl3+))) +(define-public emacs-test-simple + (package + (name "emacs-test-simple") + (version "1.3.0") + (source + (origin + (method url-fetch) + (uri (string-append "https://elpa.gnu.org/packages/test-simple-" + version ".el")) + (sha256 + (base32 + "1yd61jc9ds95a5n09052kwc5gasy57g4lxr0jsff040brlyi9czz")))) + (build-system emacs-build-system) + (home-page "https://github.com/rocky/emacs-test-simple") + (synopsis "Simple unit test framework for Emacs Lisp") + (description + "Test Simple is a simple unit test framework for Emacs Lisp. It +alleviates the need for context macros, enclosing specifications or required +test tags. It supports both interactive and non-interactive use.") + (license license:gpl3+))) + (define-public emacs-request (package (name "emacs-request") -- 2.16.0 [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1.6: 0005-gnu-Add-emacs-load-relative.patch --] [-- Type: text/x-patch, Size: 1773 bytes --] From 7dbf908f02b3179ad1b2e5a03b5cf1cfd7875660 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer <maxim.cournoyer@gmail.com> Date: Sun, 4 Feb 2018 22:02:44 -0500 Subject: [PATCH 5/7] gnu: Add emacs-load-relative. * gnu/packages/emacs.scm (emacs-load-relative): New public variable. --- gnu/packages/emacs.scm | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm index 25be4388b..1e67790ec 100644 --- a/gnu/packages/emacs.scm +++ b/gnu/packages/emacs.scm @@ -3186,6 +3186,30 @@ alleviates the need for context macros, enclosing specifications or required test tags. It supports both interactive and non-interactive use.") (license license:gpl3+))) +(define-public emacs-load-relative + (package + (name "emacs-load-relative") + (version "1.3") + (source + (origin + (method url-fetch) + (uri (string-append "https://elpa.gnu.org/packages/load-relative-" + version ".el")) + (sha256 + (base32 + "1hfxb2436jdsi9wfmsv47lkkpa5galjf5q81bqabbsv79rv59dps")))) + (build-system emacs-build-system) + (home-page "http://github.com/rocky/emacs-load-relative") + (synopsis "Emacs Lisp relative file loading related functions") + (description + "Provides functions which facilitate writing multi-file Emacs packages +and running from the source tree without having to \"install\" code or fiddle +with @{load-path}. + +The main function, @code{load-relative}, loads an Emacs Lisp file relative to +another (presumably currently running) Emacs Lisp file.") + (license license:gpl3+))) + (define-public emacs-request (package (name "emacs-request") -- 2.16.0 [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1.7: 0006-gnu-Add-emacs-loc-changes.patch --] [-- Type: text/x-patch, Size: 1532 bytes --] From 70b6577277f62e4236dbbb5b4e363a77154908bb Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer <maxim.cournoyer@gmail.com> Date: Sun, 4 Feb 2018 22:04:04 -0500 Subject: [PATCH 6/7] gnu: Add emacs-loc-changes. * gnu/packages/emacs.scm (emacs-loc-changes): New public variable. --- gnu/packages/emacs.scm | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm index 1e67790ec..4f0a9fca6 100644 --- a/gnu/packages/emacs.scm +++ b/gnu/packages/emacs.scm @@ -3210,6 +3210,26 @@ The main function, @code{load-relative}, loads an Emacs Lisp file relative to another (presumably currently running) Emacs Lisp file.") (license license:gpl3+))) +(define-public emacs-loc-changes + (package + (name "emacs-loc-changes") + (version "1.2") + (source + (origin + (method url-fetch) + (uri (string-append "https://elpa.gnu.org/packages/loc-changes-" + version ".el")) + (sha256 + (base32 + "1x8fn8vqasayf1rb8a6nma9n6nbvkx60krmiahyb05vl5rrsw6r3")))) + (build-system emacs-build-system) + (home-page "https://github.com/rocky/emacs-loc-changes") + (synopsis "Keeps track of positions even after buffer changes") + (description + "This Emacs package provides a mean to track important buffer positions +after buffer changes.") + (license license:gpl3+))) + (define-public emacs-request (package (name "emacs-request") -- 2.16.0 [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1.8: 0007-gnu-Add-emacs-realgud.patch --] [-- Type: text/x-patch, Size: 3173 bytes --] From 6ef41da1694a6664262aa4cfc7ee43e6a3ee98d5 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer <maxim.cournoyer@gmail.com> Date: Sun, 4 Feb 2018 22:04:50 -0500 Subject: [PATCH 7/7] gnu: Add emacs-realgud. * gnu/packages/emacs.scm (emacs-realgud): New public variable. --- gnu/packages/emacs.scm | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm index 4f0a9fca6..03bf24707 100644 --- a/gnu/packages/emacs.scm +++ b/gnu/packages/emacs.scm @@ -3230,6 +3230,63 @@ another (presumably currently running) Emacs Lisp file.") after buffer changes.") (license license:gpl3+))) +(define-public emacs-realgud + (package + (name "emacs-realgud") + (version "1.4.4") + (source + (origin + (method url-fetch) + (uri (string-append "https://elpa.gnu.org/packages/realgud-" + version ".tar")) + (sha256 + (base32 + "1nc8km339ip90h1j55ahfga03v7x7rh4iycmw6yrxyzir68vwn7c")))) + (build-system emacs-build-system) + (arguments + `(#:tests? #t + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'fix-autogen-script + (lambda _ + (substitute* "autogen.sh" + (("./configure") "sh configure")))) + (add-after 'fix-autogen-script 'autogen + (lambda _ + (setenv "CONFIG_SHELL" "sh") + (invoke "sh" "autogen.sh"))) + (add-after 'fix-autogen-script 'set-home + (lambda _ + (setenv "HOME" (getenv "TMPDIR")))) + (add-before 'patch-el-files 'remove-realgud-pkg.el + (lambda _ + ;; XXX: This file is auto-generated at some point and causes + ;; substitute* to crash during the `patch-el-files' phase with: + ;; ERROR: In procedure stat: No such file or directory: + ;; "./realgud-pkg.el" + (delete-file "./realgud-pkg.el") + ;; FIXME: `patch-el-files' crashes on this file with error: + ;; unable to locate "bashdb". + (delete-file "./test/test-regexp-bashdb.el")))) + #:include (cons* ".*\\.el$" %default-include))) + (native-inputs + `(("autoconf" ,autoconf) + ("automake" ,automake) + ("emacs-test-simple" ,emacs-test-simple))) + (propagated-inputs + `(("emacs-load-relative" ,emacs-load-relative) + ("emacs-loc-changes" ,emacs-loc-changes))) + (home-page "https://github.com/realgud/realgud/") + (synopsis + "Modular front-end for interacting with external debuggers") + (description + "RealGUD is a modular, extensible GNU Emacs front-end for interacting +with external debuggers. It integrates various debuggers such as gdb, pdb, +ipdb, jdb, lldb, bashdb, zshdb, etc. and allows to visually step code in the +sources. Unlike GUD, it also supports running multiple debug sessions in +parallel.") + (license license:gpl3+))) + (define-public emacs-request (package (name "emacs-request") -- 2.16.0 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 832 bytes --] ^ permalink raw reply related [flat|nested] 6+ messages in thread
* bug#30119: [PATCHv2] Add emacs-realgud and varia 2018-02-05 3:41 ` Maxim Cournoyer @ 2018-02-05 15:57 ` Ludovic Courtès 2018-02-07 13:42 ` [bug#30119] " Maxim Cournoyer 0 siblings, 1 reply; 6+ messages in thread From: Ludovic Courtès @ 2018-02-05 15:57 UTC (permalink / raw) To: Maxim Cournoyer; +Cc: 30119-done [-- Attachment #1: Type: text/plain, Size: 853 bytes --] Hi Maxim, Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis: > From 4e9e0f1358b65c180218412f667a2dbb4e1b2b19 Mon Sep 17 00:00:00 2001 > From: Maxim Cournoyer <maxim.cournoyer@gmail.com> > Date: Sun, 14 Jan 2018 22:38:20 -0500 > Subject: [PATCH 3/7] emacs-build-system: Work around issue 30116. > > This is a temporary workaround issue 30116, where substitute* crashes on > files containing NUL characters. > > * guix/build/emacs-build-system.scm (patch-el-files): Filter out elisp files > that contain NUL characters. I applied the whole series but there was an issue in this one, so I took the liberty to change it as follows: 1. clarify comments; 2. make sure ‘el-files’ is a list of absolute file names; previously it would fail beacuse ‘el-files’ was used with a different cwd. Thanks! Ludo’. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: Type: text/x-patch, Size: 1639 bytes --] diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm index 8156757be..b77984742 100644 --- a/guix/build/emacs-build-system.scm +++ b/guix/build/emacs-build-system.scm @@ -116,22 +116,21 @@ store in '.el' files." ;; strings containing NULs. Filter out such files. TODO: Remove ;; this workaround when <https://bugs.gnu.org/30116> is fixed. (el-files (remove file-contains-nul-char? - (find-files "." "\\.el$"))) - - (substitute-cmd (lambda () + (find-files (getcwd) "\\.el$")))) + (define (substitute-program-names) (substitute* el-files (("\"/bin/([^.]\\S*)\"" _ cmd-name) (let ((cmd (which cmd-name))) (unless cmd - (error - "patch-el-files: unable to locate " cmd-name)) - (string-append "\"" cmd "\""))))))) + (error "patch-el-files: unable to locate " cmd-name)) + (string-append "\"" cmd "\""))))) + (with-directory-excursion el-dir - ;; Some old '.el' files (e.g., tex-buf.el in AUCTeX) are still encoded - ;; with the "ISO-8859-1" locale. - (unless (false-if-exception (substitute-cmd)) + ;; Some old '.el' files (e.g., tex-buf.el in AUCTeX) are still + ;; ISO-8859-1-encoded. + (unless (false-if-exception (substitute-program-names)) (with-fluids ((%default-port-encoding "ISO-8859-1")) - (substitute-cmd)))) + (substitute-program-names)))) #t)) (define* (install #:key outputs ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [bug#30119] [PATCHv2] Add emacs-realgud and varia 2018-02-05 15:57 ` bug#30119: " Ludovic Courtès @ 2018-02-07 13:42 ` Maxim Cournoyer 0 siblings, 0 replies; 6+ messages in thread From: Maxim Cournoyer @ 2018-02-07 13:42 UTC (permalink / raw) To: Ludovic Courtès; +Cc: 30119-done Hi Ludovic, ludo@gnu.org (Ludovic Courtès) writes: > Hi Maxim, > > Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis: > >> From 4e9e0f1358b65c180218412f667a2dbb4e1b2b19 Mon Sep 17 00:00:00 2001 >> From: Maxim Cournoyer <maxim.cournoyer@gmail.com> >> Date: Sun, 14 Jan 2018 22:38:20 -0500 >> Subject: [PATCH 3/7] emacs-build-system: Work around issue 30116. >> >> This is a temporary workaround issue 30116, where substitute* crashes on >> files containing NUL characters. >> >> * guix/build/emacs-build-system.scm (patch-el-files): Filter out elisp files >> that contain NUL characters. > > I applied the whole series but there was an issue in this one, so I took > the liberty to change it as follows: > > 1. clarify comments; > > 2. make sure ‘el-files’ is a list of absolute file names; previously > it would fail beacuse ‘el-files’ was used with a different cwd. Thank you! I wonder why I had not encountered the issue; we used to use that very (find-files . "\\.el$") expression before that change, so in all cases it was already broken if it truly was :). Thank you! Maxim ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-02-07 13:43 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-01-15 4:03 [bug#30119] [PATCH] Add emacs-realgud and varia Maxim Cournoyer 2018-01-25 5:45 ` [bug#30119] [PATCHv2] " Maxim Cournoyer 2018-01-30 21:05 ` Ludovic Courtès 2018-02-05 3:41 ` Maxim Cournoyer 2018-02-05 15:57 ` bug#30119: " Ludovic Courtès 2018-02-07 13:42 ` [bug#30119] " Maxim Cournoyer
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/guix.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.