From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37333) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eaw1B-0004Yw-W0 for guix-patches@gnu.org; Sun, 14 Jan 2018 23:05:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eaw18-0005pl-NP for guix-patches@gnu.org; Sun, 14 Jan 2018 23:05:06 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:48668) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eaw18-0005pD-Gy for guix-patches@gnu.org; Sun, 14 Jan 2018 23:05:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eaw18-0006EM-7N for guix-patches@gnu.org; Sun, 14 Jan 2018 23:05:02 -0500 Subject: [bug#30119] [PATCH] Add emacs-realgud and varia Resent-Message-ID: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37143) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eavzt-0004FW-7h for guix-patches@gnu.org; Sun, 14 Jan 2018 23:03:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eavzq-0004qN-06 for guix-patches@gnu.org; Sun, 14 Jan 2018 23:03:45 -0500 Received: from mail-io0-x232.google.com ([2607:f8b0:4001:c06::232]:42647) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eavzp-0004pr-Jl for guix-patches@gnu.org; Sun, 14 Jan 2018 23:03:41 -0500 Received: by mail-io0-x232.google.com with SMTP id 25so11731393ioj.9 for ; Sun, 14 Jan 2018 20:03:41 -0800 (PST) Received: from apteryx ([45.72.232.234]) by smtp.gmail.com with ESMTPSA id f73sm4223142itb.40.2018.01.14.20.03.39 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 14 Jan 2018 20:03:39 -0800 (PST) From: Maxim Cournoyer Date: Sun, 14 Jan 2018 23:03:37 -0500 Message-ID: <87d12bbwfa.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 30119@debbugs.gnu.org --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain 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 --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0001-emacs-build-system-Add-set-emacs-load-path-phase.patch Content-Transfer-Encoding: quoted-printable From=200863ae90ebe7540e2c95bd191d343b7c59192a4f Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer 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 vis= ible, 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. =2D-- 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-sys= tem.scm index bd0d2e026..395c55545 100644 =2D-- a/guix/build/emacs-build-system.scm +++ b/guix/build/emacs-build-system.scm @@ -2,6 +2,7 @@ ;;; Copyright =C2=A9 2015 Federico Beffa ;;; Copyright =C2=A9 2016 David Thompson ;;; Copyright =C2=A9 2016 Alex Kost +;;; Copyright =C2=A9 2018 Maxim Cournoyer ;;; ;;; 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 t= he ;; archive signature. =2D(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")) =20 ;; 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))) =20 +(define* (set-emacs-load-path #:key inputs #:allow-other-keys) + "Set the EMACSLOADPATH environment variable so that dependencies are fou= nd." + (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)) =2D (el-dir (string-append out %install-suffix "/" elpa-name-ver)) =2D (deps-dirs (emacs-inputs-directories inputs))) + (el-dir (string-append out %install-suffix "/" elpa-name-ver))) (setenv "SHELL" "sh") (parameterize ((%emacs emacs)) =2D (emacs-byte-compile-directory el-dir =2D (emacs-inputs-el-directories deps-di= rs))))) + (emacs-byte-compile-directory el-dir)))) =20 (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)))) =20 +(define (emacs-input->el-directory emacs-input) + "Return the correct Elisp directory location of EMACS-INPUT or #f if non= e." + (let ((legacy-elisp-dir (string-append emacs-input %legacy-install-suffi= x)) + (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 directo= ry DIRS." =2D (append-map (lambda (d) =2D (list (string-append d "/share/emacs/site-lisp") =2D (string-append d %install-suffix "/" =2D (store-directory->elpa-name-version= d)))) =2D dirs)) + (filter string? (map emacs-input->el-directory dirs))) =20 (define (package-name-version->elpa-name-version name-ver) "Convert the Guix package NAME-VER to the corresponding ELPA name-version =2Dformat. 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." =20 (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) =2D (delete 'install) =2D (replace 'build build) =2D (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 =2D-- a/guix/build/emacs-utils.scm +++ b/guix/build/emacs-utils.scm @@ -58,14 +58,9 @@ (update-directory-autoloads ,directory)))) (emacs-batch-eval expr))) =20 =2D(define* (emacs-byte-compile-directory dir #:optional (dependency-dirs '= ())) =2D "Byte compile all files in DIR and its sub-directories. Before compil= ing =2Dthe files, add DIR and all directories in DEPENDENCY-DIRS to 'load-path'= ." =2D (let ((expr `(progn =2D (add-to-list 'load-path ,dir) =2D (when ',dependency-dirs =2D (setq load-path (append ',dependency-dirs load-path))) =2D (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))) =20 (define-syntax emacs-substitute-sexps =2D-=20 2.15.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0002-emacs-build-system-Reinstate-the-check-phase.patch Content-Transfer-Encoding: quoted-printable From=208db1634fc3d065c9397244a51f9e047154219b2d Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer 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 b= y default. [parallel-tests?]: Add argument. =2D-- 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 =2D-- a/guix/build-system/emacs.scm +++ b/guix/build-system/emacs.scm @@ -82,7 +82,8 @@ =20 (define* (emacs-build store name inputs #:key source =2D (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-sys= tem.scm index 395c55545..791af3437 100644 =2D-- 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 u= sed in ELPA packages." (add-after 'set-paths 'set-emacs-load-path set-emacs-load-path) (replace 'unpack unpack) (delete 'configure) =2D (delete 'check) ;; Move the build phase after install: the .el files are byte compiled ;; directly in the store. (delete 'build) =2D-=20 2.15.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0003-emacs-build-system-Work-around-issue-30611.patch Content-Transfer-Encoding: quoted-printable From=20417889ab042b0dbab9bfd0801b442533fa2541bd Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer 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. =2D-- 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-sys= tem.scm index 791af3437..317919e24 100644 =2D-- 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 () =2D (substitute* (find-files "." "\\.el$") + (substitute* el-files (("\"/bin/([^.]\\S*)\"" _ cmd-name) (let ((cmd (which cmd-name))) (unless cmd =2D-=20 2.15.1 --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0004-gnu-Add-emacs-realgud.patch Content-Transfer-Encoding: quoted-printable From=20eded0609b97cfae3c1f646e44c430620e3868674 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer 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. =2D-- 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 =2D-- a/gnu/packages/emacs.scm +++ b/gnu/packages/emacs.scm @@ -31,7 +31,7 @@ ;;; Copyright =C2=A9 2017 Peter Mikkelsen ;;; Copyright =C2=A9 2017 Tobias Geerinckx-Rice ;;; Copyright =C2=A9 2017 Mike Gerwitz =2D;;; Copyright =C2=A9 2017 Maxim Cournoyer +;;; Copyright =C2=A9 2017, 2018 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -3163,6 +3163,130 @@ perspective only its buffers are available by defau= lt.") ;; the Expat license. (license license:gpl3+))) =20 +(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 requir= ed +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 fid= dle +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 positio= ns +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 wit= h: + ;; 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 t= he +sources. Unlike GUD, it also supports running multiple debug sessions in +parallel.") + (license license:gpl3+))) + (define-public emacs-request (package (name "emacs-request") =2D-=20 2.15.1 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEFVwTvgZwWPWnh370K8v/MDHLu9sFAlpcKBoACgkQK8v/MDHL u9ta9Q/9GYWF+0ylcIktbv0pDw+751C7vHTrjzonXOIldMKJfWH8c9ZbsgPsT/EH XBCNAAxrrN2X0VgwAEfaRFyXszDfNu1t9hJKRqtv5Rml/zRqXezfV3iU3qC1+JOa vCYDQOPYntlf11PETnzhKiIUOe9iO/EbPKhFZAO01ALeMf5cOMZuWgNKZLNX9MTh rehFj1lDa3LrtB4IW5O+9V8UKnJEgk9rNQQx9VsFgpG44aHTnd4TKp4z7ceOw7+N COKpKh0kblJ2AlxkNbwF5oT9noRoXic6WPCHfFyV70YofO0GvWYSz92obzcRmO2g JO8bUQSTWwgtfjWe12uletZf/WWgoHmFtWoDuxgSqxJd3WnslXsyAmAm72wqdls7 nwvHw9h2TVAuoU9gUTOD/spbIH4QkEYdtG285j786BhdD9xczJyZiUMkuDOwsTfJ NwRG6fnErl51icjG+HR+IHL8uCu1tq+Egj5JxY7FjQkHep+Jtay7MhEPRzfCaSRv WaIwwqOBemlh02J30NLZJ0FzRTTe5jAOOphBrwSoFZrVcnaO5Tdcsfe/EpVWHefw 22a4z6zPR5CGi9xuwgP/hjJkc9rTVy+Pg+x7b4eYICU8eUgTri2Y4r6iBNJPcrhg EhNcRQbu/v2KvwRPSDSespKVx6tJm83tuZFBRYw5mI3prGzLevg= =cfh9 -----END PGP SIGNATURE----- --==-=-=--