summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-05-06 22:31:22 +0200
committerLudovic Courtès <ludo@gnu.org>2013-05-06 22:31:28 +0200
commit313109e050044c000476d9e752334d0a8fd7d7d5 (patch)
tree6364fe9a26d64431aed53288f62fe0d2aad3827a
parentc5ea1201fbc7dbabe75d61ad3f9b898b7f7e86f5 (diff)
downloadguix-313109e050044c000476d9e752334d0a8fd7d7d5.tar.gz
refresh: Change default to not update source files.
* guix/scripts/refresh.scm (%options): Change `--dry-run' to `--update'.
  (show-help): Adjust accordingly.
  (guix-refresh): Likewise.
-rw-r--r--guix/scripts/refresh.scm36
1 files changed, 18 insertions, 18 deletions
diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm
index 6584282f93..69e5114e00 100644
--- a/guix/scripts/refresh.scm
+++ b/guix/scripts/refresh.scm
@@ -44,9 +44,9 @@
 
 (define %options
   ;; Specification of the command-line options.
-  (list (option '(#\n "dry-run") #f #f
+  (list (option '(#\u "update") #f #f
                 (lambda (opt name arg result)
-                  (alist-cons 'dry-run? #t result)))
+                  (alist-cons 'update? #t result)))
         (option '(#\s "select") #t #f
                 (lambda (opt name arg result)
                   (match arg
@@ -73,7 +73,7 @@ When PACKAGE... is given, update only the specified packages.  Otherwise
 update all the packages of the distribution, or the subset thereof
 specified with `--select'.\n"))
   (display (_ "
-  -n, --dry-run          do not build the derivations"))
+  -u, --update           update source files in place"))
   (display (_ "
   -s, --select=SUBSET    select all the packages in SUBSET, one of
                          `core' or `non-core'"))
@@ -121,7 +121,7 @@ update would trigger a complete rebuild."
         (member (package-name package) names))))
 
   (let* ((opts     (parse-options))
-         (dry-run? (assoc-ref opts 'dry-run?))
+         (update?  (assoc-ref opts 'update?))
          (packages (match (concatenate
                            (filter-map (match-lambda
                                         (('argument . value)
@@ -146,19 +146,7 @@ update would trigger a complete rebuild."
                      (some                        ; user-specified packages
                       some))))
     (with-error-handling
-      (if dry-run?
-          (for-each (lambda (package)
-                      (match (false-if-exception (package-update-path package))
-                        ((new-version . directory)
-                         (let ((loc (or (package-field-location package 'version)
-                                        (package-location package))))
-                           (format (current-error-port)
-                                   (_ "~a: ~a would be upgraded from ~a to ~a~%")
-                                   (location->string loc)
-                                   (package-name package) (package-version package)
-                                   new-version)))
-                        (_ #f)))
-                    packages)
+      (if update?
           (let ((store (open-connection)))
             (for-each (lambda (package)
                         (let-values (((version tarball)
@@ -179,4 +167,16 @@ update would trigger a complete rebuild."
                             (let ((hash (call-with-input-file tarball
                                           (compose sha256 get-bytevector-all))))
                               (update-package-source package version hash)))))
-                      packages))))))
+                      packages))
+          (for-each (lambda (package)
+                      (match (false-if-exception (package-update-path package))
+                        ((new-version . directory)
+                         (let ((loc (or (package-field-location package 'version)
+                                        (package-location package))))
+                           (format (current-error-port)
+                                   (_ "~a: ~a would be upgraded from ~a to ~a~%")
+                                   (location->string loc)
+                                   (package-name package) (package-version package)
+                                   new-version)))
+                        (_ #f)))
+                    packages)))))