[gimp-web] tools: display the total check count also when showing error count.



commit 6bead45b18a0ce0c424e3d0a1c5de984b535b204
Author: Jehan <jehan girinstud io>
Date:   Mon Dec 20 13:58:22 2021 +0100

    tools: display the total check count also when showing error count.
    
    It gives a better sense of the share of mirrors not synced yet. It's
    indeed not the same thing when you have 10 errors out of 29 download
    tests or out of 87 (when looking all downloads, i.e. source tarballs,
    Windows installer and macOS package like I did just now for checking the
    mirror sync for GIMP 2.10.30).

 tools/downloads/gimp-check-mirrors.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/tools/downloads/gimp-check-mirrors.py b/tools/downloads/gimp-check-mirrors.py
index 31794b8a..bb553a96 100755
--- a/tools/downloads/gimp-check-mirrors.py
+++ b/tools/downloads/gimp-check-mirrors.py
@@ -108,6 +108,7 @@ else:
         local_uris += [ dgo_uri_local ]
 
 error_count = 0
+check_count = 0
 
 for local_uri in local_uris:
     print("Checking: {}".format(local_uri))
@@ -123,6 +124,7 @@ for local_uri in local_uris:
     with fileinput.input(files=(args.mirrorsfile), mode='r') as f:
         for line in f:
             mirror_uri = line.strip() + local_uri
+            check_count += 1
 
             try:
                 response = requests.head(url=mirror_uri, timeout=20, allow_redirects=True)
@@ -158,7 +160,7 @@ for local_uri in local_uris:
 if error_count == 0:
     sys.exit(os.EX_OK)
 else:
-    sys.stderr.write("{} errors reported.\n".format(error_count))
+    sys.stderr.write("{} / {} errors reported.\n".format(error_count, check_count))
     # Return negative error count as information error code.
     sys.exit(- error_count)
 


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