texlive[54646] Master/tlpkg/bin/tl-update-ctan-mirrors: find all

commits+karl at tug.org commits+karl at tug.org
Sat Apr 11 03:11:03 CEST 2020


Revision: 54646
          http://tug.org/svn/texlive?view=revision&revision=54646
Author:   karl
Date:     2020-04-11 03:11:03 +0200 (Sat, 11 Apr 2020)
Log Message:
-----------
find all stale mirrors, not just ones with no_time

Modified Paths:
--------------
    trunk/Master/tlpkg/bin/tl-update-ctan-mirrors

Modified: trunk/Master/tlpkg/bin/tl-update-ctan-mirrors
===================================================================
--- trunk/Master/tlpkg/bin/tl-update-ctan-mirrors	2020-04-11 01:09:38 UTC (rev 54645)
+++ trunk/Master/tlpkg/bin/tl-update-ctan-mirrors	2020-04-11 01:11:03 UTC (rev 54646)
@@ -6,8 +6,9 @@
 #
 # Write parsable list of active CTAN mirrors; run from tl-update-auto cron.
 # Needed input:
-# http://ctan.org/mirrors (aka CTAN.sites and README.mirrors)
-# rsync://comedy.dante.de/MirMon/mirmon.state
+#   http://ctan.org/mirrors (aka CTAN.sites and README.mirrors)
+#   rsync://comedy.dante.de/MirMon/mirmon.state
+#     (on web: https://ctan.org/mirrors/mirmon)
 
 use strict;
 $^W = 1;
@@ -52,12 +53,19 @@
     my ($m, $age, $status_last_probe, $time_last_succesful_probe,
       $probe_history, $state_history, $last_probe)
       = split (' ');
-    if ($status_last_probe eq "ok") {
-      $good_urls{$m} = 1;
-      #warn "probe ok $m\n";
+    $good_urls{$m} = 0;
+    if ($status_last_probe eq "no_time") {
+      warn "last probe $status_last_probe, skipping: $m\n" if $verbose;
     } else {
-      #warn "probe not ok $m\n";
-      $good_urls{$m} = 0;
+      # mirrors can be stale and yet not have no_time for their status.
+      my $age_hours = (time() - $age) / (60 * 60);
+      if ($age_hours > 24) {
+        printf STDERR "mirror age %.1f hours, skipping: $m\n", $age_hours
+          if $verbose;
+      } else {
+        #warn "probe ok $m\n";
+        $good_urls{$m} = 1;
+      }
     }
   }
   close(MSTATE);
@@ -117,13 +125,13 @@
   if (exists $good_urls_ref->{$url}) {
     if ($good_urls_ref->{$url}) {
       $mirref->{$continent}{$country}{$url} = 1;
-      warn "ok: $url\n" if $verbose;
+      warn "  ok: $url\n" if $verbose;
     } else {
-      warn "probe not ok, skipped: $url\n" if $verbose;
+      warn "  probe not ok, skipped: $url\n" if $verbose;
     }
   } else {
     # CTAN.sites has many more urls than mirmon, so don't worry about it.
-    warn "not in mirmon file, skipped: $url\n" if $verbose;
+    warn "  not in mirmon file, skipped: $url\n" if $verbose;
     # Also the mirmon file has some old urls that aren't in CTAN.sites,
     # so don't worry about that direction either, on occasion.
   }



More information about the tex-live-commits mailing list.