diff mbox series

[bug#40130,5/8] deploy: Use 'with-build-handler'.

Message ID 20200319110252.5081-5-ludo@gnu.org
State Accepted
Headers show
Series Add 'with-build-handler' and use it to improve UI feedback | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job

Commit Message

Ludovic Courtès March 19, 2020, 11:02 a.m. UTC
Until now, 'guix deploy' would never display what is going to be built.

* guix/scripts/deploy.scm (guix-deploy): Wrap 'for-each' in
'with-build-handler'.
---
 guix/scripts/deploy.scm | 34 ++++++++++++++++++----------------
 1 file changed, 18 insertions(+), 16 deletions(-)
diff mbox series

Patch

diff --git a/guix/scripts/deploy.scm b/guix/scripts/deploy.scm
index ad05c333dc..a82dde00a4 100644
--- a/guix/scripts/deploy.scm
+++ b/guix/scripts/deploy.scm
@@ -108,19 +108,21 @@  Perform the deployment specified by FILE.\n"))
     (with-status-verbosity (assoc-ref opts 'verbosity)
       (with-store store
         (set-build-options-from-command-line store opts)
-        (for-each (lambda (machine)
-                    (info (G_ "deploying to ~a...~%")
-                          (machine-display-name machine))
-                    (parameterize ((%graft? (assq-ref opts 'graft?)))
-                      (guard (c ((message-condition? c)
-                                 (report-error (G_ "failed to deploy ~a: ~a~%")
-                                               (machine-display-name machine)
-                                               (condition-message c)))
-                                ((deploy-error? c)
-                                 (when (deploy-error-should-roll-back c)
-                                   (info (G_ "rolling back ~a...~%")
-                                         (machine-display-name machine))
-                                   (run-with-store store (roll-back-machine machine)))
-                                 (apply throw (deploy-error-captured-args c))))
-                        (run-with-store store (deploy-machine machine)))))
-                  machines)))))
+        (with-build-handler (build-notifier #:use-substitutes?
+                                            (assoc-ref opts 'substitutes?))
+          (for-each (lambda (machine)
+                      (info (G_ "deploying to ~a...~%")
+                            (machine-display-name machine))
+                      (parameterize ((%graft? (assq-ref opts 'graft?)))
+                        (guard (c ((message-condition? c)
+                                   (report-error (G_ "failed to deploy ~a: ~a~%")
+                                                 (machine-display-name machine)
+                                                 (condition-message c)))
+                                  ((deploy-error? c)
+                                   (when (deploy-error-should-roll-back c)
+                                     (info (G_ "rolling back ~a...~%")
+                                           (machine-display-name machine))
+                                     (run-with-store store (roll-back-machine machine)))
+                                   (apply throw (deploy-error-captured-args c))))
+                          (run-with-store store (deploy-machine machine)))))
+                    machines))))))