aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-02-22 21:08:06 +0100
committerLudovic Courtès <ludo@gnu.org>2013-02-27 20:55:42 +0100
commitda9bf2efc56266d8717496c303a6d4b16de94b63 (patch)
treea5b35caa057f28894290d844d14bdc1dc64ba81a
parenta1c14677564b90a67eec5865dd63345a35cafd42 (diff)
downloadpatches-da9bf2efc56266d8717496c303a6d4b16de94b63.tar
patches-da9bf2efc56266d8717496c303a6d4b16de94b63.tar.gz
pull: Distinguish "already up to date" from "updated".
* guix/ui.scm (show-what-to-build): Return (length req*). * guix/scripts/pull.scm (guix-pull): Print an "already up to date" message when there's nothing to build.
-rw-r--r--guix/scripts/pull.scm20
-rw-r--r--guix/ui.scm6
2 files changed, 16 insertions, 10 deletions
diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm
index 42ff525524..942bf501c5 100644
--- a/guix/scripts/pull.scm
+++ b/guix/scripts/pull.scm
@@ -216,12 +216,16 @@ Download and deploy the latest version of Guix.\n"))
((source-dir)
(derivation-output-path
(assoc-ref (derivation-outputs drv) "out"))))
- (show-what-to-build store (list source))
- (if (build-derivations store (list source))
- (let ((latest (string-append config-dir "/latest")))
- (add-indirect-root store latest)
- (switch-symlinks latest source-dir)
- (format #t
- (_ "updated ~a successfully deployed under `~a'~%")
- %guix-package-name latest)
+ (if (show-what-to-build store (list source))
+ (if (build-derivations store (list source))
+ (let ((latest (string-append config-dir "/latest")))
+ (add-indirect-root store latest)
+ (switch-symlinks latest source-dir)
+ (format #t
+ (_ "updated ~a successfully deployed under `~a'~%")
+ %guix-package-name latest)
+ #t)
+ (leave (_ "failed to update Guix, check the build log~%")))
+ (begin
+ (display (_ "Guix already up to date\n"))
#t))))))))
diff --git a/guix/ui.scm b/guix/ui.scm
index 7d1ea2bcbd..7e0c61b4f8 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -118,7 +118,8 @@ General help using GNU software: <http://www.gnu.org/gethelp/>"))
(define* (show-what-to-build store drv #:optional dry-run?)
"Show what will or would (depending on DRY-RUN?) be built in realizing the
-derivations listed in DRV."
+derivations listed in DRV. Return #t if there's something to build, #f
+otherwise."
(let* ((req (append-map (lambda (drv-path)
(let ((d (call-with-input-file drv-path
read-derivation)))
@@ -140,7 +141,8 @@ derivations listed in DRV."
(N_ "~:[the following derivation will be built:~%~{ ~a~%~}~;~]"
"~:[the following derivations will be built:~%~{ ~a~%~}~;~]"
(length req*))
- (null? req*) req*))))
+ (null? req*) req*))
+ (pair? req*)))
(define-syntax with-error-handling
(syntax-rules ()