[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
03/16: ui: Add a notification build handler.
From: |
guix-commits |
Subject: |
03/16: ui: Add a notification build handler. |
Date: |
Sun, 22 Mar 2020 07:43:10 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 07ce23e011d18460e7ff5553d4ff640f7073075b
Author: Ludovic Courtès <address@hidden>
AuthorDate: Wed Mar 18 22:19:05 2020 +0100
ui: Add a notification build handler.
* 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 6f1ca9c..46286c1 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 (continue 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?
+ (continue #t))))
+
(define (right-arrow port)
"Return either a string containing the 'RIGHT ARROW' character, or an ASCII
replacement if PORT is not Unicode-capable."
- branch master updated (1550db6 -> 66a198c), guix-commits, 2020/03/22
- 02/16: store: Add 'with-build-handler'., guix-commits, 2020/03/22
- 05/16: deploy: Use 'with-build-handler'., guix-commits, 2020/03/22
- 01/16: syscalls: 'with-file-lock' re-grabs lock when reentering its dynamic extent., guix-commits, 2020/03/22
- 03/16: ui: Add a notification build handler.,
guix-commits <=
- 04/16: guix build: Use 'with-build-handler'., guix-commits, 2020/03/22
- 08/16: guix system: Use 'with-build-handler'., guix-commits, 2020/03/22
- 10/16: ui: 'show-what-to-build' returns two values, for builds and downloads., guix-commits, 2020/03/22
- 12/16: copy: Factorize 'with-store' & co., guix-commits, 2020/03/22
- 15/16: packages: 'package-field-location' handles missing source properties., guix-commits, 2020/03/22
- 13/16: copy: Actually implement '--dry-run'., guix-commits, 2020/03/22
- 07/16: guix package, pull: Use 'with-build-handler'., guix-commits, 2020/03/22
- 06/16: pack: Use 'with-build-handler'., guix-commits, 2020/03/22
- 09/16: ui: 'show-what-to-build' returns true when there are grafts to build., guix-commits, 2020/03/22
- 11/16: ui: 'build-notifier' invokes continuation when there's nothing to do., guix-commits, 2020/03/22