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.
This commit is contained in:
Alex Kost 2015-10-27 21:13:05 +03:00
parent 9a067efdb2
commit 7191adc5cf
2 changed files with 14 additions and 10 deletions

View File

@ -4276,8 +4276,8 @@ inconvenient.
@item --type=@var{updater} @item --type=@var{updater}
@itemx -t @var{updater} @itemx -t @var{updater}
Select only packages handled by @var{updater}. Currently, @var{updater} Select only packages handled by @var{updater} (may be a comma-separated
may be one of: list of updaters). Currently, @var{updater} may be one of:
@table @code @table @code
@item gnu @item gnu
@ -4292,7 +4292,7 @@ For instance, the following commands only checks for updates of Emacs
packages hosted at @code{elpa.gnu.org} and updates of CRAN packages: packages hosted at @code{elpa.gnu.org} and updates of CRAN packages:
@example @example
$ guix refresh -t elpa -t cran $ guix refresh --type=elpa,cran
gnu/packages/statistics.scm:819:13: r-testthat would be upgraded from 0.10.0 to 0.11.0 gnu/packages/statistics.scm:819:13: r-testthat would be upgraded from 0.10.0 to 0.11.0
gnu/packages/emacs.scm:856:13: emacs-auctex would be upgraded from 11.88.6 to 11.88.9 gnu/packages/emacs.scm:856:13: emacs-auctex would be upgraded from 11.88.6 to 11.88.9
@end example @end example

View File

@ -69,7 +69,10 @@
arg))))) arg)))))
(option '(#\t "type") #t #f (option '(#\t "type") #t #f
(lambda (opt name arg result) (lambda (opt name arg result)
(alist-cons 'updater (string->symbol arg) result))) (let* ((not-comma (char-set-complement (char-set #\,)))
(names (map string->symbol
(string-tokenize arg not-comma))))
(alist-cons 'updaters names result))))
(option '(#\L "list-updaters") #f #f (option '(#\L "list-updaters") #f #f
(lambda args (lambda args
(list-updaters-and-exit))) (list-updaters-and-exit)))
@ -114,7 +117,8 @@ specified with `--select'.\n"))
-s, --select=SUBSET select all the packages in SUBSET, one of -s, --select=SUBSET select all the packages in SUBSET, one of
`core' or `non-core'")) `core' or `non-core'"))
(display (_ " (display (_ "
-t, --type=UPDATER restrict to updates from UPDATER--e.g., 'gnu'")) -t, --type=UPDATER,... restrict to updates from the specified updaters
(e.g., 'gnu')"))
(display (_ " (display (_ "
-L, --list-updaters list available updaters and exit")) -L, --list-updaters list available updaters and exit"))
(display (_ " (display (_ "
@ -209,15 +213,15 @@ downloaded and authenticated; not updating~%")
(define (options->updaters opts) (define (options->updaters opts)
;; Return the list of updaters to use. ;; Return the list of updaters to use.
(match (filter-map (match-lambda (match (filter-map (match-lambda
(('updater . name) (('updaters . names)
(lookup-updater name)) (map lookup-updater names))
(_ #f)) (_ #f))
opts) opts)
(() (()
;; Use the default updaters. ;; Use the default updaters.
%updaters) %updaters)
(lst (lists
lst))) (concatenate lists))))
(define (keep-newest package lst) (define (keep-newest package lst)
;; If a newer version of PACKAGE is already in LST, return LST; otherwise ;; If a newer version of PACKAGE is already in LST, return LST; otherwise