From patchwork Sat May 28 14:36:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Kost X-Patchwork-Id: 12588 Received: (qmail 82052 invoked by uid 89); 28 May 2016 14:37:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.99.1 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=BAYES_00, FREEMAIL_FROM, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy= X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00, FREEMAIL_FROM, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-HELO: lists.gnu.org Received: from lists.gnu.org (HELO lists.gnu.org) (208.118.235.17) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Sat, 28 May 2016 14:37:08 +0000 Received: from localhost ([::1]:53406 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6fMQ-0003Oc-8Y for patchwork@sourceware.org; Sat, 28 May 2016 10:37:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41997) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6fLj-0002yY-Hq for guix-devel@gnu.org; Sat, 28 May 2016 10:36:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b6fLh-0007I2-FD for guix-devel@gnu.org; Sat, 28 May 2016 10:36:22 -0400 Received: from mail-lf0-x243.google.com ([2a00:1450:4010:c07::243]:35904) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6fLh-0007HN-7t for guix-devel@gnu.org; Sat, 28 May 2016 10:36:21 -0400 Received: by mail-lf0-x243.google.com with SMTP id h68so3752900lfh.3 for ; Sat, 28 May 2016 07:36:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:in-reply-to:references; bh=GAlZoP2m3E0gAF0Q5c9cIT/dW1XCOa2X2dNqZtW+U8g=; b=nmuWd5fGZTqk10vtFgmCl/vqIsDUlU9aZzaNJpJAQHL97NBe5PtU/gLLnQvZHgh4/B fg1e3eNW+aZp0WeaYSrvEyIYMWIhFh209SFf/YrccDkDoe1OfPV5K8pW7dhNGkrtNt56 8KnBP6sNjvgg0ztflo9CMqrh0MqQN7tZB76OeriL2bheDW7a9uG3LLfTVg2/pW53RoKP jNFB0o6OUSptts2yPw6M3TItFT8V3qXKZ/qmthxl/D0KrVgb6twKIbSD+eDHFTbw31pu R6t3vpuxbOsALGj0sL5cJ//4scz6xUlkp85XaR+noEusXKWoK1N/GDAzhG1gkzpDyKT7 dtkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=GAlZoP2m3E0gAF0Q5c9cIT/dW1XCOa2X2dNqZtW+U8g=; b=FfDLngyJlCFzMNKatLPTPlCkgqV9lf3WcbdMrTHDxVGDOuoWwZ/U4+uQFe7PRIjyEu 7T6sOTAz5QaDAWG6IkiN/QaWF0qwqOL4BgTG51AGtEDvksLCnatWUD7X+ntN67ehrOL3 LEKjQrXU/Xbl+F/1LZjsJTzATwdFQ8nYHuD8RBdDA4NjHgHKnWj5Nu/DD8FVhK6r1UNE L3qWnNhbIB/5ru9wdmN82Shag1VDgLOZvvi0dBWoxCYUPe8xPZea5B2Qq/hKl6qb5uO5 BofXsI8aSCil8WsUmlH2R9k2A9v5EGuy2LQk0b/zNh4gDCTtygJbpY9pV2419rbHoGx9 Sy/A== X-Gm-Message-State: ALyK8tKUFKhxHV4VJzJzzsFDyQPt262Ux9H5TmUT9msE72QxWxe860nW+Tvlus7SucKf+A== X-Received: by 10.46.33.13 with SMTP id h13mr3318738ljh.39.1464446180431; Sat, 28 May 2016 07:36:20 -0700 (PDT) Received: from localhost.localdomain ([217.107.192.156]) by smtp.gmail.com with ESMTPSA id u188sm1086937lja.11.2016.05.28.07.36.19 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 28 May 2016 07:36:20 -0700 (PDT) From: Alex Kost To: guix-devel@gnu.org Subject: [PATCH 4/4] emacs: Add "Build Log" button to Package Info. Date: Sat, 28 May 2016 17:36:14 +0300 Message-Id: <1464446174-1868-4-git-send-email-alezost@gmail.com> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1464446174-1868-1-git-send-email-alezost@gmail.com> References: <1464446174-1868-1-git-send-email-alezost@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::243 X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list 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+patchwork=sourceware.org@gnu.org Sender: "Guix-devel" * emacs/guix-main.scm (package-build-log-file): New procedure. * emacs/guix-ui-package.el (guix-package-build-log-file) (guix-package-find-build-log) (guix-package-info-insert-build-log-button): New procedures. (guix-package-info-button-functions): Add 'guix-package-info-insert-build-log-button'. --- emacs/guix-main.scm | 10 ++++++++++ emacs/guix-ui-package.el | 25 ++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/emacs/guix-main.scm b/emacs/guix-main.scm index 8914933..cbf7cdc 100644 --- a/emacs/guix-main.scm +++ b/emacs/guix-main.scm @@ -1000,6 +1000,16 @@ GENERATIONS is a list of generation numbers." (format #t "The source store path: ~a~%" (package-source-derivation->store-path derivation)))))) +(define (package-build-log-file package-id) + "Return the build log file of a package PACKAGE-ID. +Return #f if the build log is not found." + (and-let* ((package (package-by-id package-id))) + (with-store store + (let* ((derivation (package-derivation store package)) + (file (derivation-file-name derivation))) + (or (log-file store file) + ((@@ (guix scripts build) log-url) store file)))))) + ;;; Executing guix commands diff --git a/emacs/guix-ui-package.el b/emacs/guix-ui-package.el index 4eb7083..4280246 100644 --- a/emacs/guix-ui-package.el +++ b/emacs/guix-ui-package.el @@ -111,6 +111,19 @@ is found and `guix-package-list-single' is nil." (list (if (= 0 package-id) package-id-str package-id) output)))) +(defun guix-package-build-log-file (id) + "Return build log file name of a package defined by ID." + (guix-eval-read + (guix-make-guile-expression 'package-build-log-file id))) + +(defun guix-package-find-build-log (id) + "Show build log of a package defined by ID." + (require 'guix-build-log) + (let ((file (guix-package-build-log-file id))) + (if file + (guix-build-log-find-file file) + (message "Couldn't find the package build log.")))) + ;;; Processing package actions @@ -333,7 +346,8 @@ prompt depending on `guix-operation-confirm' variable)." :group 'guix-package-info) (defcustom guix-package-info-button-functions - '(guix-package-info-insert-build-button) + '(guix-package-info-insert-build-button + guix-package-info-insert-build-log-button) "List of functions used to insert package buttons in Info buffer. Each function is called with 2 arguments: package ID and full name." :type '(repeat function) @@ -598,6 +612,15 @@ PACKAGE-ID is an ID of the package which store path to show." (format "Build the current package") 'id id)) +(defun guix-package-info-insert-build-log-button (id _name) + "Insert button to show build log of a package defined by ID." + (guix-info-insert-action-button + "Build Log" + (lambda (btn) + (guix-package-find-build-log (button-get btn 'id))) + "View build log of the current package" + 'id id)) + (defun guix-package-info-show-source (entry-id package-id) "Show file name of a package source in the current info buffer. Find the file if needed (see `guix-package-info-auto-find-source').