From 5f7dd092ca577a534067f577b8849ed06cabf970 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 5 Nov 2018 22:52:19 +0100 Subject: pull: Make '--dry-run' behave as expected. * guix/scripts/pull.scm (show-help): Document '--dry-run'. (build-and-install): Add #:dry-run? parameter and honor it. (guix-pull): Remove (assoc-ref opts 'dry-run?) condition. Instead, pass it as #:dry-run? to 'build-and-install'. * doc/guix.texi (Invoking guix pull): Document '--dry-run'. Move '--verbose' to the bottom. --- guix/scripts/pull.scm | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'guix/scripts/pull.scm') diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm index 188237aa90..aff4f378be 100644 --- a/guix/scripts/pull.scm +++ b/guix/scripts/pull.scm @@ -86,6 +86,8 @@ Download and deploy the latest version of Guix.\n")) list generations matching PATTERN")) (display (G_ " -p, --profile=PROFILE use PROFILE instead of ~/.config/guix/current")) + (display (G_ " + -n, --dry-run show what would be pulled and built")) (display (G_ " --bootstrap use the bootstrap Guile to build the new Guix")) (newline) @@ -164,15 +166,18 @@ Download and deploy the latest version of Guix.\n")) (_ #t))) (define* (build-and-install instances profile - #:key verbose?) - "Build the tool from SOURCE, and install it in PROFILE." + #:key verbose? dry-run?) + "Build the tool from SOURCE, and install it in PROFILE. When DRY-RUN? is +true, display what would be built without actually building it." (define update-profile (store-lift build-and-use-profile)) (mlet %store-monad ((manifest (channel-instances->manifest instances))) (mbegin %store-monad - (update-profile profile manifest) - (return (display-profile-news profile))))) + (update-profile profile manifest + #:dry-run? dry-run?) + (munless dry-run? + (display-profile-news profile))))) (define (honor-lets-encrypt-certificates! store) "Tell Guile-Git to use the Let's Encrypt certificates." @@ -497,8 +502,6 @@ Use '~/.config/guix/channels.scm' instead.")) (ensure-default-profile) (cond ((assoc-ref opts 'query) (process-query opts profile)) - ((assoc-ref opts 'dry-run?) - #t) ;XXX: not very useful (else (with-store store (with-status-report print-build-event @@ -531,6 +534,8 @@ Use '~/.config/guix/channels.scm' instead.")) (canonical-package guile-2.2))))) (run-with-store store (build-and-install instances profile + #:dry-run? + (assoc-ref opts 'dry-run?) #:verbose? (assoc-ref opts 'verbose?)))))))))))))) -- cgit v1.2.3 From ea68b3f6527cf4a02c554cf3f6f446e30f4940f6 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 7 Nov 2018 21:53:44 +0100 Subject: pull: Add missing monadic 'return'. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes a regression introduced in 5f7dd092ca577a534067f577b8849ed06cabf970 where, upon completion, 'guix pull' would fail (instead of printing the new/upgraded packages) with ugly errors like: successfully built /gnu/store/…-profile.drv 1 package in profile Backtrace: […] In guix/store.scm: 1605:24 1 (run-with-store _ _ #:guile-for-build _ #:system _ # _) In unknown file: 0 (_ #) ERROR: Wrong type to apply: #t Reported by thorwil on #guix. * guix/scripts/pull.scm (build-and-install): Add missing 'return' when DRY-RUN? is wrong. --- guix/scripts/pull.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guix/scripts/pull.scm') diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm index aff4f378be..dc83729911 100644 --- a/guix/scripts/pull.scm +++ b/guix/scripts/pull.scm @@ -177,7 +177,7 @@ true, display what would be built without actually building it." (update-profile profile manifest #:dry-run? dry-run?) (munless dry-run? - (display-profile-news profile))))) + (return (display-profile-news profile)))))) (define (honor-lets-encrypt-certificates! store) "Tell Guile-Git to use the Let's Encrypt certificates." -- cgit v1.2.3