guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

03/11: challenge: Display an overall summary.


From: Ludovic Courtès
Subject: 03/11: challenge: Display an overall summary.
Date: Thu, 26 Oct 2017 01:30:08 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit bf7dfb1f0722f48b137f85ade6b075ad342ecb38
Author: Ludovic Courtès <address@hidden>
Date:   Wed Oct 25 21:00:17 2017 -0700

    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.
---
 doc/guix.texi              |  7 +++++++
 guix/scripts/challenge.scm | 16 ++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/doc/guix.texi b/doc/guix.texi
index d7fabe9..94cba0e 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -7276,6 +7276,13 @@ updating list of substitutes from 
'https://guix.example.org'... 100.0%
   local hash: 0k4v3m9z1zp8xzzizb7d8kjj72f9172xv078sq4wl73vnq9ig3ax
   https://hydra.gnu.org/nar/@dots{}-pius-2.1.1: 
0k4v3m9z1zp8xzzizb7d8kjj72f9172xv078sq4wl73vnq9ig3ax
   https://guix.example.org/nar/@dots{}-pius-2.1.1: 
1cy25x1a4fzq5rk0pmvc8xhwyffnqz95h2bpvqsz2mpvlbccy0gs
+
address@hidden
+
+6,406 store items were analyzed:
+  - 4,749 (74.1%) were identical
+  - 525 (8.2%) differed
+  - 1,132 (17.7%) were inconclusive
 @end smallexample
 
 @noindent
diff --git a/guix/scripts/challenge.scm b/guix/scripts/challenge.scm
index 681394f..e82d535 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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]