guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/04: archive: Use 'with-build-handler'.


From: guix-commits
Subject: 01/04: archive: Use 'with-build-handler'.
Date: Wed, 25 Mar 2020 11:03:20 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 2d5ee2c6e886ef3b717954b80c2c54c47c1805d2
Author: Ludovic Courtès <address@hidden>
AuthorDate: Wed Mar 25 14:55:08 2020 +0100

    archive: Use 'with-build-handler'.
    
    * guix/scripts/archive.scm (export-from-store): Remove call to
    'show-what-to-build' and dry-run? condition.
    (guix-archive): Wrap 'cond' in 'with-build-handler'.
---
 guix/scripts/archive.scm | 50 ++++++++++++++++++++++++------------------------
 1 file changed, 25 insertions(+), 25 deletions(-)

diff --git a/guix/scripts/archive.scm b/guix/scripts/archive.scm
index 4f39920..80f3b70 100644
--- a/guix/scripts/archive.scm
+++ b/guix/scripts/archive.scm
@@ -259,12 +259,7 @@ build and a list of store files to transfer."
 resulting archive to the standard output port."
   (let-values (((drv files)
                 (options->derivations+files store opts)))
-    (show-what-to-build store drv
-                        #:use-substitutes? (assoc-ref opts 'substitutes?)
-                        #:dry-run? (assoc-ref opts 'dry-run?))
-
-    (if (or (assoc-ref opts 'dry-run?)
-            (build-derivations store drv))
+    (if (build-derivations store drv)
         (export-paths store files (current-output-port)
                       #:recursive? (assoc-ref opts 'export-recursive?))
         (leave (G_ "unable to export the given packages~%")))))
@@ -382,22 +377,27 @@ output port."
                (with-status-verbosity (assoc-ref opts 'verbosity)
                  (with-store store
                    (set-build-options-from-command-line store opts)
-                   (cond ((assoc-ref opts 'export)
-                          (export-from-store store opts))
-                         ((assoc-ref opts 'import)
-                          (import-paths store (current-input-port)))
-                         ((assoc-ref opts 'missing)
-                          (let* ((files   (lines (current-input-port)))
-                                 (missing (remove (cut valid-path? store <>)
-                                                  files)))
-                            (format #t "~{~a~%~}" missing)))
-                         ((assoc-ref opts 'list)
-                          (list-contents (current-input-port)))
-                         ((assoc-ref opts 'extract)
-                          =>
-                          (lambda (target)
-                            (restore-file (current-input-port) target)))
-                         (else
-                          (leave
-                           (G_ "either '--export' or '--import' \
-must be specified~%"))))))))))))
+                   (with-build-handler
+                       (build-notifier #:use-substitutes?
+                                       (assoc-ref opts 'substitutes?)
+                                       #:dry-run?
+                                       (assoc-ref opts 'dry-run?))
+                     (cond ((assoc-ref opts 'export)
+                            (export-from-store store opts))
+                           ((assoc-ref opts 'import)
+                            (import-paths store (current-input-port)))
+                           ((assoc-ref opts 'missing)
+                            (let* ((files   (lines (current-input-port)))
+                                   (missing (remove (cut valid-path? store <>)
+                                                    files)))
+                              (format #t "~{~a~%~}" missing)))
+                           ((assoc-ref opts 'list)
+                            (list-contents (current-input-port)))
+                           ((assoc-ref opts 'extract)
+                            =>
+                            (lambda (target)
+                              (restore-file (current-input-port) target)))
+                           (else
+                            (leave
+                             (G_ "either '--export' or '--import' \
+must be specified~%")))))))))))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]