summaryrefslogtreecommitdiff
path: root/Master/tlpkg/bin
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-04-11 01:11:03 +0000
committerKarl Berry <karl@freefriends.org>2020-04-11 01:11:03 +0000
commitae7e9bb49faa6d6a5fbcbc6a5ac0106cba57d7b8 (patch)
treec0490215eb59c536b4f39fa6ec8bb77a529767af /Master/tlpkg/bin
parent174dd1193563dd8c561eaf2b28561ff1eba5b3ff (diff)
find all stale mirrors, not just ones with no_time
git-svn-id: svn://tug.org/texlive/trunk@54646 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/bin')
-rwxr-xr-xMaster/tlpkg/bin/tl-update-ctan-mirrors28
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.
}