From: "Ludovic Courtès" <ludo@gnu.org>
To: 40130@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>
Subject: [bug#40130] [PATCH 3/8] ui: Add a notification build handler.
Date: Thu, 19 Mar 2020 12:02:47 +0100 [thread overview]
Message-ID: <20200319110252.5081-3-ludo@gnu.org> (raw)
In-Reply-To: <20200319110252.5081-1-ludo@gnu.org>
* guix/ui.scm (build-notifier): New variable.
---
guix/ui.scm | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/guix/ui.scm b/guix/ui.scm
index 6f1ca9c0b2..47ada9dde2 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -93,6 +93,7 @@
string->number*
size->number
show-derivation-outputs
+ build-notifier
show-what-to-build
show-what-to-build*
show-manifest-transaction
@@ -1045,6 +1046,43 @@ check and report what is prerequisites are available for download."
(define show-what-to-build*
(store-lift show-what-to-build))
+(define* (build-notifier #:key (dry-run? #f) (use-substitutes? #t))
+ "Return a procedure suitable for 'with-build-handler' that, when
+'build-things' is called, invokes 'show-what-to-build' to display the build
+plan. When DRY-RUN? is true, the 'with-build-handler' form returns without
+any build happening."
+ (define not-comma
+ (char-set-complement (char-set #\,)))
+
+ (define (read-derivation-from-file* item)
+ (catch 'system-error
+ (lambda ()
+ (read-derivation-from-file item))
+ (const #f)))
+
+ (lambda (continuation store things mode)
+ (define inputs
+ ;; List of derivation inputs to build. Filter out non-existent '.drv'
+ ;; files because the daemon transparently tries to substitute them.
+ (filter-map (match-lambda
+ (((? derivation-path? drv) . output)
+ (let ((drv (read-derivation-from-file* drv))
+ (outputs (string-tokenize output not-comma)))
+ (and drv (derivation-input drv outputs))))
+ ((? derivation-path? drv)
+ (and=> (read-derivation-from-file* drv)
+ derivation-input))
+ (_
+ #f))
+ things))
+
+ (show-what-to-build store inputs
+ #:dry-run? dry-run?
+ #:use-substitutes? use-substitutes?
+ #:mode mode)
+ (unless dry-run?
+ (continuation #t))))
+
(define (right-arrow port)
"Return either a string containing the 'RIGHT ARROW' character, or an ASCII
replacement if PORT is not Unicode-capable."
--
2.25.1
next prev parent reply other threads:[~2020-03-19 11:04 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-19 10:56 [bug#40130] [PATCH 0/8] Add 'with-build-handler' and use it to improve UI feedback Ludovic Courtès
2020-03-19 11:02 ` [bug#40130] [PATCH 1/8] syscalls: 'with-file-lock' re-grabs lock when reentering its dynamic extent Ludovic Courtès
2020-03-19 11:02 ` [bug#40130] [PATCH 2/8] store: Add 'with-build-handler' Ludovic Courtès
2020-03-19 11:02 ` Ludovic Courtès [this message]
2020-03-19 11:02 ` [bug#40130] [PATCH 4/8] guix build: Use 'with-build-handler' Ludovic Courtès
2020-03-19 11:02 ` [bug#40130] [PATCH 5/8] deploy: " Ludovic Courtès
2020-03-19 11:02 ` [bug#40130] [PATCH 6/8] pack: " Ludovic Courtès
2020-03-19 11:02 ` [bug#40130] [PATCH 7/8] guix package, pull: " Ludovic Courtès
2020-03-19 11:02 ` [bug#40130] [PATCH 8/8] guix system: " Ludovic Courtès
2020-03-22 11:44 ` bug#40130: [PATCH 0/8] Add 'with-build-handler' and use it to improve UI feedback Ludovic Courtès
2020-03-22 12:44 ` [bug#40130] " Ricardo Wurmus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200319110252.5081-3-ludo@gnu.org \
--to=ludo@gnu.org \
--cc=40130@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.