diff options
Diffstat (limited to 'Master/tlpkg/bin')
-rwxr-xr-x | Master/tlpkg/bin/tl-update-ctan-mirrors | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/Master/tlpkg/bin/tl-update-ctan-mirrors b/Master/tlpkg/bin/tl-update-ctan-mirrors index a3bf03e4f65..d7b7cfcea34 100755 --- a/Master/tlpkg/bin/tl-update-ctan-mirrors +++ b/Master/tlpkg/bin/tl-update-ctan-mirrors @@ -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 @@ sub read_mstate { 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 @@ sub add_mirror { 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. } |