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 @@ (define (list-updaters-and-exit)
|
||||||
|
|
||||||
(let* ((packages (fold-packages cons '()))
|
(let* ((packages (fold-packages cons '()))
|
||||||
(total (length packages)))
|
(total (length packages)))
|
||||||
(define covered
|
(define uncovered
|
||||||
(fold (lambda (updater covered)
|
(fold (lambda (updater uncovered)
|
||||||
(let ((matches (count (upstream-updater-predicate updater)
|
(let ((matches (filter (upstream-updater-predicate updater)
|
||||||
packages)))
|
packages)))
|
||||||
;; TRANSLATORS: The parenthetical expression here is rendered
|
;; TRANSLATORS: The parenthetical expression here is rendered
|
||||||
;; like "(42% coverage)" and denotes the fraction of packages
|
;; like "(42% coverage)" and denotes the fraction of packages
|
||||||
;; covered by the given updater.
|
;; covered by the given updater.
|
||||||
(format #t (G_ " - ~a: ~a (~2,1f% coverage)~%")
|
(format #t (G_ " - ~a: ~a (~2,1f% coverage)~%")
|
||||||
(upstream-updater-name updater)
|
(upstream-updater-name updater)
|
||||||
(G_ (upstream-updater-description updater))
|
(G_ (upstream-updater-description updater))
|
||||||
(* 100. (/ matches total)))
|
(* 100. (/ (length matches) total)))
|
||||||
(+ covered matches)))
|
(lset-difference eq? uncovered matches)))
|
||||||
0
|
packages
|
||||||
(force %updaters)))
|
(force %updaters)))
|
||||||
|
|
||||||
(newline)
|
(newline)
|
||||||
(format #t (G_ "~2,1f% of the packages are covered by these updaters.~%")
|
(format #t (G_ "~2,1f% of the packages are covered by these updaters.~%")
|
||||||
(* 100. (/ covered total))))
|
(* 100. (/ (- total (length uncovered)) total))))
|
||||||
(exit 0))
|
(exit 0))
|
||||||
|
|
||||||
(define (warn-no-updater package)
|
(define (warn-no-updater package)
|
||||||
|
|
Loading…
Reference in a new issue