aboutsummaryrefslogtreecommitdiff
path: root/guix/scripts
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-10-25 21:00:17 -0700
committerLudovic Courtès <ludo@gnu.org>2017-10-25 22:25:19 -0700
commitbf7dfb1f0722f48b137f85ade6b075ad342ecb38 (patch)
treefd241cdb80036daa11ff60d17e72966465c3c680 /guix/scripts
parentd213cc8c7f085428e3c64243b0d163423e4bb5f6 (diff)
downloadgnu-guix-bf7dfb1f0722f48b137f85ade6b075ad342ecb38.tar
gnu-guix-bf7dfb1f0722f48b137f85ade6b075ad342ecb38.tar.gz
challenge: Display an overall summary.
* guix/scripts/challenge.scm (summarize-report-list): New procedure. (guix-challenge): Use it. * doc/guix.texi (Invoking guix challenge): Adjust command output in example.
Diffstat (limited to 'guix/scripts')
-rw-r--r--guix/scripts/challenge.scm16
1 files changed, 16 insertions, 0 deletions
diff --git a/guix/scripts/challenge.scm b/guix/scripts/challenge.scm
index 681394f9cf..e82d5351d8 100644
--- a/guix/scripts/challenge.scm
+++ b/guix/scripts/challenge.scm
@@ -210,6 +210,20 @@ inconclusive reports."
(report (G_ "~a contents match:~%") item)
(report-hashes item local narinfos)))))
+(define (summarize-report-list reports)
+ "Display the overall summary of REPORTS."
+ (let ((total (length reports))
+ (inconclusive (count comparison-report-inconclusive? reports))
+ (matches (count comparison-report-match? reports))
+ (discrepancies (count comparison-report-mismatch? reports)))
+ (report (G_ "~h store items were analyzed:~%") total)
+ (report (G_ " - ~h (~,1f%) were identical~%")
+ matches (* 100. (/ matches total)))
+ (report (G_ " - ~h (~,1f%) differed~%")
+ discrepancies (* 100. (/ discrepancies total)))
+ (report (G_ " - ~h (~,1f%) were inconclusive~%")
+ inconclusive (* 100. (/ inconclusive total)))))
+
;;;
;;; Command-line options.
@@ -292,6 +306,8 @@ Challenge the substitutes for PACKAGE... provided by one or more servers.\n"))
(reports (compare-contents items urls)))
(for-each (cut summarize-report <> #:verbose? verbose?)
reports)
+ (report "\n")
+ (summarize-report-list reports)
(exit (cond ((any comparison-report-mismatch? reports) 2)
((every comparison-report-match? reports) 0)