summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2011-07-20 06:08:20 +0000
committerNorbert Preining <preining@logic.at>2011-07-20 06:08:20 +0000
commit3409d31de018f305e9ca635cc41b0c7be508b5a0 (patch)
treed4927d72ccfe8481b5f15b86be4b075165451b9e
parent70c4c4e6ea2f3bc5a3ecf3fd94e864677373cfda (diff)
add mirrors.pl perl hash file and generation script
git-svn-id: svn://tug.org/texlive/trunk@23185 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-xMaster/tlpkg/bin/tl-ctan-mirror-to-perl-hash104
-rw-r--r--Master/tlpkg/installer/mirrors.pl141
2 files changed, 245 insertions, 0 deletions
diff --git a/Master/tlpkg/bin/tl-ctan-mirror-to-perl-hash b/Master/tlpkg/bin/tl-ctan-mirror-to-perl-hash
new file mode 100755
index 00000000000..a7404222337
--- /dev/null
+++ b/Master/tlpkg/bin/tl-ctan-mirror-to-perl-hash
@@ -0,0 +1,104 @@
+#!/usr/bin/perl
+
+# needed file:
+# http://ctan.org/mirrors (CTAN.sites, README.mirrors)
+# rsync://comedy.dante.de/MirMon/mirmon.state
+
+use strict;
+$^W = 1;
+use Data::Dumper;
+
+if (!defined($ARGV[0])) {
+ die ("Need the location of README.mirror as argument\n");
+}
+if (!defined($ARGV[1])) {
+ die ("Need the location of mirmon.state file as argument\n");
+}
+
+open FOO, "<$ARGV[0]" || die("Cannot open $ARGV[0]: $!");
+open MSTATE, "<$ARGV[1]" || die("Cannot open $ARGV[1]: $!");
+
+my %good_urls;
+
+read_mstate();
+my %foo = read_readme_mirror();
+$Data::Dumper::Indent = 1;
+print Data::Dumper->Dump([\%foo], [qw(mirrors)]);
+
+sub read_mstate {
+ my %mstate;
+ while (<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;
+ } else {
+ $good_urls{$m} = 0;
+ }
+ }
+ close(MSTATE);
+}
+
+sub add_mirror {
+ my ($mirref, $continent, $country, $mirror, $p, $ppath) = @_;
+ my $url = "$p://$ppath";
+ if (defined($good_urls{$url})) {
+ if ($good_urls{$url}) {
+ #$mirref->{$continent}{$country}{$mirror}{'protocols_path'}{$p} = $ppath;
+ $mirref->{$continent}{$country}{$url} = 1;
+ } else {
+ printf STDERR "mirror seems to be dead, skipped: $url\n";
+ }
+ } else {
+ printf STDERR "mirror not in mirmon file, skipped: $url\n";
+ }
+}
+
+sub read_readme_mirror {
+ my %mirrors;
+ my $continent;
+ my $mirror;
+ my $country;
+ my %protocols;
+ while (<FOO>) {
+ chomp;
+ if (m/^ (Africa|Asia|Australasia|Europe|North America|South America)/) {
+ my $save_continent = $1;
+ if (defined($mirror)) {
+ for my $p (keys %protocols) {
+ add_mirror(\%mirrors, $continent, $country, $mirror, $p, $protocols{$p});
+ }
+ }
+ $continent = $save_continent;
+ $mirror = undef;
+ $country = undef;
+ %protocols = ();
+ next;
+ }
+ next if (!defined($continent));
+ if (m/^ ([-a-zA-Z0-9.]+) \((.*)\)\s*$/) {
+ my $save_mirror = $1;
+ my $save_country = $2;
+ # make country names more reasonable
+ $save_country =~ s/^The //;
+ if (defined($mirror)) {
+ for my $p (keys %protocols) {
+ add_mirror(\%mirrors, $continent, $country, $mirror, $p, $protocols{$p});
+ }
+ }
+ $mirror = $save_mirror;
+ $country = $save_country;
+ %protocols = ();
+ next;
+ }
+ next if (!defined($mirror));
+ if (m!^ URL: (ftp|http|rsync)://([-a-zA-Z0-9.]+)/([-\w/]*)!) {
+ $protocols{$1} = "$2/$3";
+ next;
+ }
+ #print "ignored >>$_<<\n";
+ }
+ return %mirrors;
+}
+
+
diff --git a/Master/tlpkg/installer/mirrors.pl b/Master/tlpkg/installer/mirrors.pl
new file mode 100644
index 00000000000..9c9f9cf3ae1
--- /dev/null
+++ b/Master/tlpkg/installer/mirrors.pl
@@ -0,0 +1,141 @@
+$mirrors = {
+ 'Europe' => {
+ 'UK' => {
+ 'http://ctan.sqsol.co.uk/' => 1,
+ 'http://anorien.csc.warwick.ac.uk/mirrors/CTAN/' => 1
+ },
+ 'Italy' => {
+ 'http://ftp.uniRoma2.it/TeX/' => 1,
+ 'http://ctan.mirror.garr.it/mirrors/CTAN/' => 1
+ },
+ 'Germany' => {
+ 'http://sunsite.informatik.rwth-aachen.de/ftp/pub/mirror/ctan/' => 1,
+ 'http://ftp.uni-erlangen.de/mirrors/CTAN/' => 1,
+ 'http://mirror.informatik.uni-mannheim.de/pub/mirrors/tex-archive/' => 1,
+ 'http://ctan.larsko.net/' => 1,
+ 'ftp://ftp.rrzn.uni-hannover.de/pub/mirror/tex-archive/' => 1
+ },
+ 'Serbia and Montenegro' => {
+ 'http://rpm.scl.rs/CTAN/' => 1
+ },
+ 'Lithuania' => {
+ 'http://ctan.vgtu.lt/' => 1
+ },
+ 'Norway' => {
+ 'http://ftp.fagskolen.gjovik.no/pub/tex-archive/' => 1,
+ 'http://ctan.uib.no/' => 1
+ },
+ 'Netherlands' => {
+ 'http://ftp.snt.utwente.nl/pub/software/tex/' => 1
+ },
+ 'France' => {
+ 'http://ctan.mines-albi.fr/' => 1,
+ 'http://distrib-coffee.ipsl.jussieu.fr/pub/mirrors/ctan/' => 1,
+ 'http://mirror.ibcp.fr/pub/CTAN/' => 1,
+ 'http://ftp.oleane.net/pub/CTAN/' => 1,
+ 'http://mirrors.ircam.fr/pub/CTAN/' => 1,
+ 'ftp://ftp.inria.fr/pub/TeX/CTAN/' => 1
+ },
+ 'Poland' => {
+ 'ftp://ftp.tpnet.pl/pub/CTAN/' => 1
+ },
+ 'Russia' => {
+ 'http://mirror.macomnet.net/pub/CTAN/' => 1,
+ 'http://ctan.uni-altai.ru/' => 1,
+ 'ftp://ftp.vsu.ru/pub/CTAN/' => 1
+ },
+ 'Slovenia' => {
+ 'http://ctan.ijs.si/tex-archive/' => 1
+ },
+ 'Portugal' => {
+ 'http://ftp.eq.uc.pt/software/TeX/' => 1
+ },
+ 'Denmark' => {
+ 'http://mirrors.dotsrc.org/ctan/' => 1
+ },
+ 'Spain' => {
+ 'http://ftp.udc.es/CTAN/' => 1
+ },
+ 'Greece' => {
+ 'http://ftp.cc.uoc.gr/mirrors/CTAN/' => 1
+ },
+ 'Czech Republic' => {
+ 'http://ftp.cvut.cz/tex-archive/' => 1
+ }
+ },
+ 'North America' => {
+ 'Canada' => {
+ 'http://mirror.its.dal.ca/ctan/' => 1,
+ 'http://mirror.csclub.uwaterloo.ca/CTAN/' => 1,
+ 'http://ctan.mirror.rafal.ca/' => 1
+ },
+ 'USA' => {
+ 'http://mirrors.ibiblio.org/pub/mirrors/CTAN/' => 1,
+ 'http://ctan.mackichan.com/' => 1,
+ 'http://mirror.math.ku.edu/tex-archive/' => 1,
+ 'http://mirror.unl.edu/ctan/' => 1,
+ 'http://mirrors.med.harvard.edu/ctan/' => 1,
+ 'http://mirror.hmc.edu/ctan/' => 1,
+ 'http://mirror.its.uidaho.edu/pub/tex-archive/' => 1
+ }
+ },
+ 'Australasia' => {
+ 'Australia' => {
+ 'http://ctan.unsw.edu.au/' => 1
+ }
+ },
+ 'South America' => {
+ 'Chile' => {
+ 'ftp://ftp.inf.utfsm.cl/pub/tex-archive/' => 1
+ },
+ 'Colombia' => {
+ 'http://www.laqee.unal.edu.co/tex-archive/' => 1
+ },
+ 'Brazil' => {
+ 'http://ceres.cisc.usp.br/CTAN/' => 1,
+ 'http://ctan.tche.br/' => 1,
+ 'http://linorg.usp.br/CTAN/' => 1,
+ 'http://mirror.softwarelivre.ufsc.br/pub/ctan/' => 1
+ }
+ },
+ 'Asia' => {
+ 'Taiwan' => {
+ 'http://ctan.cdpa.nsysu.edu.tw/' => 1,
+ 'http://shadow.ind.ntou.edu.tw/ctan/' => 1
+ },
+ 'Iran' => {
+ 'http://ctan.um.ac.ir/' => 1
+ },
+ 'Indonesia' => {
+ 'http://kebo.vlsm.org/CTAN/' => 1,
+ 'http://kambing.ui.ac.id/ctan/' => 1,
+ 'http://ctan.cermin.lipi.go.id/' => 1,
+ 'http://ftp.itb.ac.id/pub/CTAN/' => 1
+ },
+ 'Pakistan' => {
+ 'http://mirror-cybernet.lums.edu.pk/pub/ctan/' => 1
+ },
+ 'Malaysia' => {
+ 'ftp://mirror.upm.edu.my/ctan/' => 1
+ },
+ 'Korea' => {
+ 'http://ftp.kaist.ac.kr/pub/tex-archive/' => 1
+ },
+ 'China' => {
+ 'http://mirror.bjtu.edu.cn/CTAN/' => 1,
+ 'http://mirror.osqdu.org/CTAN/' => 1,
+ 'http://mirrors.xmu.edu.cn/CTAN/' => 1,
+ 'http://mirror.neu.edu.cn/CTAN/' => 1,
+ 'http://ftp.ctex.org/mirrors/CTAN/' => 1,
+ 'http://mirrors.ustc.edu.cn/CTAN/' => 1
+ },
+ 'Japan' => {
+ 'http://ftp.jaist.ac.jp/pub/CTAN/' => 1
+ }
+ },
+ 'Africa' => {
+ 'South Africa' => {
+ 'http://ftp.leg.uct.ac.za/pub/packages/ctan/' => 1
+ }
+ }
+};