diff options
author | Ludovic Courtès <ludo@gnu.org> | 2016-11-30 16:45:19 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2016-11-30 17:35:21 +0100 |
commit | 3676f892551d562e1a1360d79b208e687ece08c2 (patch) | |
tree | 0c4e47f078b93882298bd232018bd182b3149f0f /guix | |
parent | 2fd370e8167be9a0af9e5358757d58d1acaf02e0 (diff) |
refresh: '--list-updaters' shows updater coverage.
* guix/scripts/refresh.scm (list-updaters-and-exit): Compute the
coverage ratio of each updater and print it. Print the coverage ratio
for all the updaters.
* doc/guix.texi (Invoking guix refresh): Document it.
Diffstat (limited to 'guix')
-rw-r--r-- | guix/scripts/refresh.scm | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm index 12a344e1a0..e1ff544de0 100644 --- a/guix/scripts/refresh.scm +++ b/guix/scripts/refresh.scm @@ -220,11 +220,28 @@ unavailable optional dependencies such as Guile-JSON." (define (list-updaters-and-exit) "Display available updaters and exit." (format #t (_ "Available updaters:~%")) - (for-each (lambda (updater) - (format #t "- ~a: ~a~%" - (upstream-updater-name updater) - (_ (upstream-updater-description updater)))) - %updaters) + (newline) + + (let* ((packages (fold-packages cons '())) + (total (length packages))) + (define covered + (fold (lambda (updater covered) + (let ((matches (count (upstream-updater-predicate updater) + packages))) + ;; TRANSLATORS: The parenthetical expression here is rendered + ;; like "(42% coverage)" and denotes the fraction of packages + ;; covered by the given updater. + (format #t (_ " - ~a: ~a (~2,1f% coverage)~%") + (upstream-updater-name updater) + (_ (upstream-updater-description updater)) + (* 100. (/ matches total))) + (+ covered matches))) + 0 + %updaters)) + + (newline) + (format #t (_ "~2,1f% of the packages are covered by these updaters.~%") + (* 100. (/ covered total)))) (exit 0)) (define (warn-no-updater package) |