me
/
guix
Archived
1
0
Fork 0

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'.
master
Ludovic Courtès 2020-03-25 14:55:08 +01:00
parent eb019af8d8
commit 2d5ee2c6e8
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 25 additions and 25 deletions

View File

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