[gimp-web/wip/Jehan/issue-236-new-sponsor-page: 21/25] tools: update mirror verification scripts.




commit ff64a32b53e3d0c190a42ac4c0a121ef9bbfe63f
Author: Jehan <jehan girinstud io>
Date:   Wed Sep 15 18:15:06 2021 +0200

    tools: update mirror verification scripts.
    
    - update-mirrors.py now also looks up the "video" list of
      download.gimp.org.map. These are also mirrors and some of them are not
      in the "mirrors" list (though I'm not sure why). Yet they should be
      noted in our list for verification but also for acknowledgement in the
      sponsor page.
    - cmp-mirrors.py now better takes into account a mirror with several
      URL. We have the case with FAU university which is apparently noted
      twice, once in the "mirrors" list with ftp.fau.de domain and once in
      "video" list with ftp.rrze.uni-erlangen.de. Both domain redirect to
      the same server/contents as far as I can see.

 tools/downloads/cmp-mirrors.py    | 5 ++++-
 tools/downloads/update-mirrors.py | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/tools/downloads/cmp-mirrors.py b/tools/downloads/cmp-mirrors.py
index 4d5f19a6..14098342 100755
--- a/tools/downloads/cmp-mirrors.py
+++ b/tools/downloads/cmp-mirrors.py
@@ -31,7 +31,10 @@ def cmp_mirror_files(mirrorsfile, mirrorsjson):
         continue
       for name in mirrors:
         if line in mirrors[name]['mirrors']:
-          del mirrors[name]
+          if len(mirrors[name]['mirrors']) > 1:
+            mirrors[name]['mirrors'].remove(line)
+          else:
+            del mirrors[name]
           break
       else:
         missing_in_json += [line]
diff --git a/tools/downloads/update-mirrors.py b/tools/downloads/update-mirrors.py
index ffdac056..a903d081 100755
--- a/tools/downloads/update-mirrors.py
+++ b/tools/downloads/update-mirrors.py
@@ -21,7 +21,7 @@ if args.ssh_user is None:
 ssh = paramiko.SSHClient()
 ssh.set_missing_host_key_policy(paramiko.client.AutoAddPolicy())
 ssh.load_system_host_keys()
-cmd = "cat /etc/httpd/download.gimp.org.map |grep '^mirrors' | sed 's$^mirrors\\s*\([^\s]\)$https://\\1$' | 
sed 's$|$\\nhttps://$g'"
+cmd = "cat /etc/httpd/download.gimp.org.map |grep '^mirrors\|^video' | sed 
's$^\(mirrors\|video\)\\s*\([^\s]\)$https://\\2$' | sed 's$|$\\nhttps://$g' | sort -u"
 ssh.connect('download.gimp.org', username=args.ssh_user)
 # It will use your keys automatically.
 ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command(cmd)


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