diff options
author | Karl Berry <karl@freefriends.org> | 2024-04-06 22:29:01 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2024-04-06 22:29:01 +0000 |
commit | 468635f802a5e9a82224433df0298f3d1ea3c78f (patch) | |
tree | 8ae757f5d1a1b64f3fdd5a8bbfb8747b80706f5c /Master/tlpkg | |
parent | 24045f4681072af7c0d65ff2550a830ac8afe946 (diff) |
count good mirrors, quit if fewer than 50.
git-svn-id: svn://tug.org/texlive/trunk@70877 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg')
-rwxr-xr-x | Master/tlpkg/bin/tl-update-ctan-mirrors | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/Master/tlpkg/bin/tl-update-ctan-mirrors b/Master/tlpkg/bin/tl-update-ctan-mirrors index 2e3cf50c1b4..b2810898222 100755 --- a/Master/tlpkg/bin/tl-update-ctan-mirrors +++ b/Master/tlpkg/bin/tl-update-ctan-mirrors @@ -86,6 +86,7 @@ sub read_readme_mirror { open (CTAN_SITES,"<$ctan_sites") || die "$0: open($ctan_sites) failed: $!\n"; + my $nmirrors = 0; my ($continent,$country,$mirror); while (<CTAN_SITES>) { chomp; @@ -102,10 +103,11 @@ sub read_readme_mirror { } elsif (m!^ +URL: (ftp|https?|rsync)://([-a-zA-Z0-9.]+)/([-\w/]*)!) { next if $1 eq "rsync"; # we can't use rsync, so skip + next if $1 eq "ftp"; # ftp not well supported anymore, skip my $protocol = $1; my $ppath = "$2/$3"; - add_mirror(\%mirrors, $continent, $country, $mirror, $protocol, $ppath, - $good_urls_ref); + $nmirrors += &maybe_add_mirror(\%mirrors, $continent, $country, $mirror, + $protocol, $ppath, $good_urls_ref); } else { last if /^Please send updates/; # quite at final blurb @@ -114,28 +116,36 @@ sub read_readme_mirror { } } - die "no ctan mirrors found in $ctan_sites" if keys %mirrors == 0; + die "too few ($nmirrors) ctan mirrors found in $ctan_sites" + if $nmirrors < 50; # if tons have failed, probably better to preserve list + warn "$nmirrors mirrors found in $ctan_sites.\n" if $verbose; + return %mirrors; } -# Subroutine for read_readme_mirror. +# Subroutine for read_readme_mirror to check $P://$PPATH. +# Return 1 if ok, 0 else. # -sub add_mirror { +sub maybe_add_mirror { my ($mirref,$continent,$country,$mirror,$p,$ppath,$good_urls_ref) = @_; my $url = "$p://$ppath"; - #warn "considering $url ($continent $country)"; + warn " considering $url ($continent $country)\n" if $verbose > 1; + my $ok = 0; if (exists $good_urls_ref->{$url}) { if ($good_urls_ref->{$url}) { $mirref->{$continent}{$country}{$url} = 1; - warn " ok: $url\n" if $verbose > 1; + warn " ok: $url\n" if $verbose > 1; + $ok = 1; } 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 > 1; + warn " not in mirmon file, skipped: $url\n" if $verbose > 1; # Also the mirmon file has some old urls that aren't in CTAN.sites, # so don't worry about that direction either, on occasion. } + + return $ok; } |