From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Kost Subject: [PATCH] emacs: Add 'guix-devel-build-package-source'. Date: Fri, 09 Oct 2015 17:00:23 +0300 Message-ID: <87bnc8rvk8.fsf_-_@gmail.com> References: <1443791046-1015-1-git-send-email-alezost@gmail.com> <1443791046-1015-3-git-send-email-alezost@gmail.com> <87d1wvadw2.fsf@gnu.org> <87bnceah2e.fsf@gmail.com> <87r3la6077.fsf@gnu.org> <87eghalc7s.fsf@gmail.com> <87wpv1tils.fsf@gnu.org> <87a8rwf2vl.fsf@gmail.com> <87mvvu6f5y.fsf@gnu.org> <87si5mbnfr.fsf@gmail.com> <87k2qy1gah.fsf@gnu.org> <87d1wpfvmv.fsf@gmail.com> <87twq1twg2.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45701) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkYDi-0005q0-Pt for guix-devel@gnu.org; Fri, 09 Oct 2015 10:00:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZkYDd-0007o8-P4 for guix-devel@gnu.org; Fri, 09 Oct 2015 10:00:26 -0400 In-Reply-To: <87twq1twg2.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Thu, 08 Oct 2015 13:46:05 +0200") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: guix-devel@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s (2015-10-08 14:46 +0300) wrote: [...] > The command to call =E2=80=98package-source-derivation=E2=80=99 for the p= ackage at point > is still welcome, though. :-) Thanks, here it is. =E2=80=98build-package-source=E2=80=99 procedure (as I see it) is very simi= lar to =E2=80=98build-package=E2=80=99, so maybe it is worth to make a macro or so= mething, WDYT? --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0001-emacs-Add-guix-devel-build-package-source.patch Content-Transfer-Encoding: quoted-printable >From d2f72a9375fe592ebf5fe5ee84ad6db614ea2c03 Mon Sep 17 00:00:00 2001 From: Alex Kost Date: Fri, 9 Oct 2015 16:45:24 +0300 Subject: [PATCH] emacs: Add 'guix-devel-build-package-source'. MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit Suggested by Ludovic Court=C3=A8s . * guix/scripts.scm (build-package-source): New procedure. * emacs/guix-devel.el (guix-devel-build-package-source): New command. (guix-devel-keys-map): Add key binding for it. * doc/emacs.texi (Emacs Development): Document it. --- doc/emacs.texi | 6 ++++++ emacs/guix-devel.el | 16 ++++++++++++++++ guix/scripts.scm | 20 +++++++++++++++++++- 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/doc/emacs.texi b/doc/emacs.texi index 325e14e..ab69515 100644 --- a/doc/emacs.texi +++ b/doc/emacs.texi @@ -667,6 +667,12 @@ this command---for example, with @kbd{C-M-x} (@pxref{T= o eval or not to eval,,, geiser, Geiser User Manual}) (@code{guix-devel-build-package-definition}). =20 +@item C-c . s +Build a source derivation of the package defined by the current variable +definition. This command has the same meaning as @code{guix build -S} +shell command (@pxref{Invoking guix build}) +(@code{guix-devel-build-package-source}). + @item C-c . l Lint (check) a package defined by the current variable definition (@pxref{Invoking guix lint}) (@code{guix-devel-lint-package}). diff --git a/emacs/guix-devel.el b/emacs/guix-devel.el index 547044f..b833028 100644 --- a/emacs/guix-devel.el +++ b/emacs/guix-devel.el @@ -122,6 +122,21 @@ run BODY." guix-use-substitutes) "#:dry-run?" (guix-guile-boolean guix-dry-run))))))) =20 +(defun guix-devel-build-package-source () + "Build the source of the current package definition." + (interactive) + (guix-devel-with-definition def + (when (or (not guix-operation-confirm) + (guix-operation-prompt + (format "Build '%s' package source?" def))) + (guix-geiser-eval-in-repl + (concat ",run-in-store " + (guix-guile-make-call-expression + "build-package-source" def + "#:use-substitutes?" (guix-guile-boolean + guix-use-substitutes) + "#:dry-run?" (guix-guile-boolean guix-dry-run))))))) + (defun guix-devel-lint-package () "Check the current package. See Info node `(guix) Invoking guix lint' for details." @@ -177,6 +192,7 @@ to find 'modify-phases' keywords." (defvar guix-devel-keys-map (let ((map (make-sparse-keymap))) (define-key map (kbd "b") 'guix-devel-build-package-definition) + (define-key map (kbd "s") 'guix-devel-build-package-source) (define-key map (kbd "l") 'guix-devel-lint-package) (define-key map (kbd "k") 'guix-devel-copy-module-as-kill) (define-key map (kbd "u") 'guix-devel-use-module) diff --git a/guix/scripts.scm b/guix/scripts.scm index e34d389..d84375f 100644 --- a/guix/scripts.scm +++ b/guix/scripts.scm @@ -31,7 +31,8 @@ #:export (args-fold* parse-command-line maybe-build - build-package)) + build-package + build-package-source)) =20 ;;; Commentary: ;;; @@ -115,4 +116,21 @@ Show what and how will/would be built." #:dry-run? dry-run?) (return (show-derivation-outputs derivation)))))) =20 +(define* (build-package-source package + #:key dry-run? (use-substitutes? #t) + #:allow-other-keys + #:rest build-options) + "Build PACKAGE source using BUILD-OPTIONS." + (mbegin %store-monad + (apply set-build-options* + #:use-substitutes? use-substitutes? + (strip-keyword-arguments '(#:dry-run?) build-options)) + (mlet %store-monad ((derivation (origin->derivation + (package-source package)))) + (mbegin %store-monad + (maybe-build (list derivation) + #:use-substitutes? use-substitutes? + #:dry-run? dry-run?) + (return (show-derivation-outputs derivation)))))) + ;;; scripts.scm ends here --=20 2.5.0 --=-=-=--