summaryrefslogtreecommitdiff
path: root/Master/tlpkg/TeXLive
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2011-07-20 06:08:59 +0000
committerNorbert Preining <preining@logic.at>2011-07-20 06:08:59 +0000
commit713aef9b071ca2b5dd68d014e99897f0e5e2036c (patch)
tree3205c6c0049944b26f02701c78b39ef085a6b08d /Master/tlpkg/TeXLive
parent3409d31de018f305e9ca635cc41b0c7be508b5a0 (diff)
add a function create_mirror_list from mirror.pl
git-svn-id: svn://tug.org/texlive/trunk@23186 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive')
-rw-r--r--Master/tlpkg/TeXLive/TLUtils.pm36
1 files changed, 36 insertions, 0 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm
index 7d18d86c4ea..b0a5055faa8 100644
--- a/Master/tlpkg/TeXLive/TLUtils.pm
+++ b/Master/tlpkg/TeXLive/TLUtils.pm
@@ -166,6 +166,7 @@ BEGIN {
&merge_into
&give_ctan_mirror
&give_ctan_mirror_base
+ &create_mirror_list
&tlmd5
&xsystem
&run_cmd
@@ -3426,6 +3427,41 @@ sub give_ctan_mirror
return (give_ctan_mirror_base(@_) . "/$TeXLiveServerPath");
}
+=item C<create_mirror_list()>
+
+Returns the lists of viable mirrors according to mirrors.pl, in
+a list which also contains continents, and country headers.
+
+=cut
+
+sub create_mirror_list {
+ our $mirrors;
+ my @ret = ();
+ require("installer/mirrors.pl");
+ my @continents = sort keys %$mirrors;
+ for my $continent (@continents) {
+ # first push the name of the continent
+ push @ret, uc($continent);
+ my @countries = sort keys %{$mirrors->{$continent}};
+ for my $country (@countries) {
+ my @mirrors = sort keys %{$mirrors->{$continent}{$country}};
+ my $first = 1;
+ for my $mirror (@mirrors) {
+ my $mfull = $mirror;
+ $mfull =~ s!/$!!;
+ $mfull .= "/" . $TeXLive::TLConfig::TeXLiveServerPath;
+ #if ($first) {
+ push @ret, " $country $mfull";
+ # $first = 0;
+ #} else {
+ # push @ret, " $mfull";
+ #}
+ }
+ }
+ }
+ return @ret;
+}
+
sub tlmd5 {
my ($file) = @_;
if (-r $file) {