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:
parent
59c9d4f108
commit
cba7ddcf60
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user