refresh: Account for overlapping updater coverage.

* guix/scripts/refresh.scm (list-updaters-and-exit): Do not assume updater
predicates are disjoint.  Track covered packages directly.
This commit is contained in:
Eric Bavier 2018-11-27 19:56:01 -06:00
parent 59c9d4f108
commit cba7ddcf60
No known key found for this signature in database
GPG Key ID: FD73CAC719D32566
1 changed files with 8 additions and 8 deletions

View File

@ -179,24 +179,24 @@ specified with `--select'.\n"))
(let* ((packages (fold-packages cons '()))
(total (length packages)))
(define covered
(fold (lambda (updater covered)
(let ((matches (count (upstream-updater-predicate updater)
packages)))
(define uncovered
(fold (lambda (updater uncovered)
(let ((matches (filter (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 (G_ " - ~a: ~a (~2,1f% coverage)~%")
(upstream-updater-name updater)
(G_ (upstream-updater-description updater))
(* 100. (/ matches total)))
(+ covered matches)))
0
(* 100. (/ (length matches) total)))
(lset-difference eq? uncovered matches)))
packages
(force %updaters)))
(newline)
(format #t (G_ "~2,1f% of the packages are covered by these updaters.~%")
(* 100. (/ covered total))))
(* 100. (/ (- total (length uncovered)) total))))
(exit 0))
(define (warn-no-updater package)