about summary refs log tree commit diff
path: root/maintainers
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2010-05-10 21:26:53 +0000
committerLudovic Courtès <ludo@gnu.org>2010-05-10 21:26:53 +0000
commit5583d516d284f0c51149b9d3a263b05be3d3542d (patch)
tree02555136ce656a1235af421297493355119dcaff /maintainers
parent5dd1036a04140af37507b19f126e8ed8f64a64a7 (diff)
gnupdate: Add `--dry-run' option.
* maintainers/scripts/gnu/gnupdate.scm (%options): Add `dry-run'.
  (main): Handle `--dry-run'.

svn path=/nixpkgs/trunk/; revision=21716
Diffstat (limited to 'maintainers')
-rw-r--r--maintainers/scripts/gnu/gnupdate.scm17
1 files changed, 13 insertions, 4 deletions
diff --git a/maintainers/scripts/gnu/gnupdate.scm b/maintainers/scripts/gnu/gnupdate.scm
index 4df48f931feae..c00184665884b 100644
--- a/maintainers/scripts/gnu/gnupdate.scm
+++ b/maintainers/scripts/gnu/gnupdate.scm
@@ -658,9 +658,13 @@
                   (format #t "~%")
                   (format #t "  -x, --xml=FILE      Read XML output of `nix-instantiate'~%")
                   (format #t "                      from FILE.~%")
+                  (format #t "  -d, --dry-run       Don't actually update Nix expressions~%")
                   (format #t "  -h, --help          Give this help list.~%~%")
                   (format #t "Report bugs to <ludo@gnu.org>~%")
                   (exit 0)))
+        (option '(#\d "dry-run") #f #f
+                (lambda (opt name arg result)
+                  (alist-cons 'dry-run #t result)))
 
         (option '(#\x "xml") #t #f
                 (lambda (opt name arg result)
@@ -695,8 +699,13 @@
                     old-version old-hash
                     new-version new-hash
                     location)
-                   (update-nix-expression (location-file location)
-                                          old-version old-hash
-                                          new-version new-hash))
+                   (if (assoc-ref opts 'dry-run)
+                       (format #t "`~a' would be updated from ~a to ~a (~a -> ~a)~%"
+                               name old-version new-version
+                               old-hash new-hash)
+                       (update-nix-expression (location-file location)
+                                              old-version old-hash
+                                              new-version new-hash)))
                   (_ #f)))
-              updates)))
+              updates)
+    #t))