summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2015-10-27 21:13:05 +0300
committerAlex Kost <alezost@gmail.com>2015-10-28 21:51:59 +0300
commit7191adc5cf864d75debcc618937b7a6292491445 (patch)
treeaf8f1da0cc3f7d98422639ab9455b04bafdcb08b
parent9a067efdb2076293e505c29a51a9819ff025b056 (diff)
refresh: Support comma-separated updater types.
* guix/scripts/refresh.scm (%options): Handle comma-separated types for '--type' option. (guix-refresh): Adjust accordingly. (show-help): Likewise. * doc/guix.texi (Invoking guix refresh): Document it.
-rw-r--r--doc/guix.texi6
-rw-r--r--guix/scripts/refresh.scm18
2 files changed, 14 insertions, 10 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 9878b93ddba..4fbe0576141 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -4276,8 +4276,8 @@ inconvenient.
4276 4276
4277@item --type=@var{updater} 4277@item --type=@var{updater}
4278@itemx -t @var{updater} 4278@itemx -t @var{updater}
4279Select only packages handled by @var{updater}. Currently, @var{updater} 4279Select only packages handled by @var{updater} (may be a comma-separated
4280may be one of: 4280list of updaters). Currently, @var{updater} may be one of:
4281 4281
4282@table @code 4282@table @code
4283@item gnu 4283@item gnu
@@ -4292,7 +4292,7 @@ For instance, the following commands only checks for updates of Emacs
4292packages hosted at @code{elpa.gnu.org} and updates of CRAN packages: 4292packages hosted at @code{elpa.gnu.org} and updates of CRAN packages:
4293 4293
4294@example 4294@example
4295$ guix refresh -t elpa -t cran 4295$ guix refresh --type=elpa,cran
4296gnu/packages/statistics.scm:819:13: r-testthat would be upgraded from 0.10.0 to 0.11.0 4296gnu/packages/statistics.scm:819:13: r-testthat would be upgraded from 0.10.0 to 0.11.0
4297gnu/packages/emacs.scm:856:13: emacs-auctex would be upgraded from 11.88.6 to 11.88.9 4297gnu/packages/emacs.scm:856:13: emacs-auctex would be upgraded from 11.88.6 to 11.88.9
4298@end example 4298@end example
diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm
index a66b3f9ea85..04f6b76edcf 100644
--- a/guix/scripts/refresh.scm
+++ b/guix/scripts/refresh.scm
@@ -69,10 +69,13 @@
69 arg))))) 69 arg)))))
70 (option '(#\t "type") #t #f 70 (option '(#\t "type") #t #f
71 (lambda (opt name arg result) 71 (lambda (opt name arg result)
72 (alist-cons 'updater (string->symbol arg) result))) 72 (let* ((not-comma (char-set-complement (char-set #\,)))
73 (names (map string->symbol
74 (string-tokenize arg not-comma))))
75 (alist-cons 'updaters names result))))
73 (option '(#\L "list-updaters") #f #f 76 (option '(#\L "list-updaters") #f #f
74 (lambda args 77 (lambda args
75 (list-updaters-and-exit))) 78 (list-updaters-and-exit)))
76 (option '(#\l "list-dependent") #f #f 79 (option '(#\l "list-dependent") #f #f
77 (lambda (opt name arg result) 80 (lambda (opt name arg result)
78 (alist-cons 'list-dependent? #t result))) 81 (alist-cons 'list-dependent? #t result)))
@@ -114,7 +117,8 @@ specified with `--select'.\n"))
114 -s, --select=SUBSET select all the packages in SUBSET, one of 117 -s, --select=SUBSET select all the packages in SUBSET, one of
115 `core' or `non-core'")) 118 `core' or `non-core'"))
116 (display (_ " 119 (display (_ "
117 -t, --type=UPDATER restrict to updates from UPDATER--e.g., 'gnu'")) 120 -t, --type=UPDATER,... restrict to updates from the specified updaters
121 (e.g., 'gnu')"))
118 (display (_ " 122 (display (_ "
119 -L, --list-updaters list available updaters and exit")) 123 -L, --list-updaters list available updaters and exit"))
120 (display (_ " 124 (display (_ "
@@ -209,15 +213,15 @@ downloaded and authenticated; not updating~%")
209 (define (options->updaters opts) 213 (define (options->updaters opts)
210 ;; Return the list of updaters to use. 214 ;; Return the list of updaters to use.
211 (match (filter-map (match-lambda 215 (match (filter-map (match-lambda
212 (('updater . name) 216 (('updaters . names)
213 (lookup-updater name)) 217 (map lookup-updater names))
214 (_ #f)) 218 (_ #f))
215 opts) 219 opts)
216 (() 220 (()
217 ;; Use the default updaters. 221 ;; Use the default updaters.
218 %updaters) 222 %updaters)
219 (lst 223 (lists
220 lst))) 224 (concatenate lists))))
221 225
222 (define (keep-newest package lst) 226 (define (keep-newest package lst)
223 ;; If a newer version of PACKAGE is already in LST, return LST; otherwise 227 ;; If a newer version of PACKAGE is already in LST, return LST; otherwise