weather: Exit with non-zero when coverage is below 100%.
* guix/scripts/weather.scm (report-server-coverage): Return the coverage ratio. (guix-weather): Exit if and only if each server's coverage is 1.
This commit is contained in:
parent
10b99ddf45
commit
be764b47ad
2 changed files with 24 additions and 12 deletions
|
@ -10809,8 +10809,11 @@ guix weather @var{options}@dots{} [@var{packages}@dots{}]
|
||||||
When @var{packages} is omitted, @command{guix weather} checks the availability
|
When @var{packages} is omitted, @command{guix weather} checks the availability
|
||||||
of substitutes for @emph{all} the packages, or for those specified with
|
of substitutes for @emph{all} the packages, or for those specified with
|
||||||
@option{--manifest}; otherwise it only considers the specified packages. It
|
@option{--manifest}; otherwise it only considers the specified packages. It
|
||||||
is also possible to query specific system types with @option{--system}. The
|
is also possible to query specific system types with @option{--system}.
|
||||||
available options are listed below.
|
@command{guix weather} exits with a non-zero code when the fraction of
|
||||||
|
available substitutes is below 100%.
|
||||||
|
|
||||||
|
The available options are listed below.
|
||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
@item --substitute-urls=@var{urls}
|
@item --substitute-urls=@var{urls}
|
||||||
|
|
|
@ -178,7 +178,8 @@ about the derivations queued, as is the case with Hydra."
|
||||||
(define* (report-server-coverage server items
|
(define* (report-server-coverage server items
|
||||||
#:key display-missing?)
|
#:key display-missing?)
|
||||||
"Report the subset of ITEMS available as substitutes on SERVER.
|
"Report the subset of ITEMS available as substitutes on SERVER.
|
||||||
When DISPLAY-MISSING? is true, display the list of missing substitutes."
|
When DISPLAY-MISSING? is true, display the list of missing substitutes.
|
||||||
|
Return the coverage ratio, an exact number between 0 and 1."
|
||||||
(define MiB (* (expt 2 20) 1.))
|
(define MiB (* (expt 2 20) 1.))
|
||||||
|
|
||||||
(format #t (G_ "looking for ~h store items on ~a...~%")
|
(format #t (G_ "looking for ~h store items on ~a...~%")
|
||||||
|
@ -267,7 +268,11 @@ are queued~%")
|
||||||
(when (and display-missing? (not (null? missing)))
|
(when (and display-missing? (not (null? missing)))
|
||||||
(newline)
|
(newline)
|
||||||
(format #t (G_ "Substitutes are missing for the following items:~%"))
|
(format #t (G_ "Substitutes are missing for the following items:~%"))
|
||||||
(format #t "~{ ~a~%~}" missing)))))
|
(format #t "~{ ~a~%~}" missing))
|
||||||
|
|
||||||
|
;; Return the coverage ratio.
|
||||||
|
(let ((total (length items)))
|
||||||
|
(/ (- total (length missing)) total)))))
|
||||||
|
|
||||||
|
|
||||||
;;;
|
;;;
|
||||||
|
@ -538,16 +543,20 @@ SERVER. Display information for packages with at least THRESHOLD dependents."
|
||||||
(lambda (system)
|
(lambda (system)
|
||||||
(package-outputs packages system))
|
(package-outputs packages system))
|
||||||
systems))))))
|
systems))))))
|
||||||
(for-each (lambda (server)
|
(exit
|
||||||
|
(every (lambda (server)
|
||||||
|
(define coverage
|
||||||
(report-server-coverage server items
|
(report-server-coverage server items
|
||||||
#:display-missing?
|
#:display-missing?
|
||||||
(assoc-ref opts 'display-missing?))
|
(assoc-ref opts 'display-missing?)))
|
||||||
(match (assoc-ref opts 'coverage)
|
(match (assoc-ref opts 'coverage)
|
||||||
(#f #f)
|
(#f #f)
|
||||||
(threshold
|
(threshold
|
||||||
(report-package-coverage server packages systems
|
(report-package-coverage server packages systems
|
||||||
#:threshold threshold))))
|
#:threshold threshold)))
|
||||||
urls)))))
|
|
||||||
|
(= 1 coverage))
|
||||||
|
urls))))))
|
||||||
|
|
||||||
;;; Local Variables:
|
;;; Local Variables:
|
||||||
;;; eval: (put 'let/time 'scheme-indent-function 1)
|
;;; eval: (put 'let/time 'scheme-indent-function 1)
|
||||||
|
|
Reference in a new issue