diff options
author | Karl Berry <karl@freefriends.org> | 2008-07-02 23:52:46 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2008-07-02 23:52:46 +0000 |
commit | 376383f4310b2ff3811d2e933f956ee7ca54df12 (patch) | |
tree | f1a989817f0c48ae78d80466fcabad8ef955264f /Master | |
parent | b56e66944a70a65ebf75d3757350058caab1d0e3 (diff) |
use TLConfig values for default locations instead of hardwiring
git-svn-id: svn://tug.org/texlive/trunk@9178 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rwxr-xr-x | Master/install-tl | 8 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLConfig.pm | 27 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLUtils.pm | 25 |
3 files changed, 33 insertions, 27 deletions
diff --git a/Master/install-tl b/Master/install-tl index 2f26fae262c..8e038d94eca 100755 --- a/Master/install-tl +++ b/Master/install-tl @@ -325,12 +325,8 @@ if ($opt_from_dvd and ($::_media_ ne "DVD")) { } $vars{'from_dvd'} = $opt_from_dvd; -setup_programs("$::installerdir/tlpkg/installer", "$::_platform_"); -if ("$opt_url" ne "") { - $TeXLiveURL = "$opt_url"; -} else { - $TeXLiveURL = TeXLive::TLUtils::give_ctan_mirror(); -} +setup_programs ("$::installerdir/tlpkg/installer", "$::_platform_"); +$TeXLiveURL = $opt_url || TeXLive::TLUtils::give_ctan_mirror(); info("Using URL $TeXLiveURL\n"); load_tlpdb(); diff --git a/Master/tlpkg/TeXLive/TLConfig.pm b/Master/tlpkg/TeXLive/TLConfig.pm index 028f6e8416e..41b31fcccb6 100644 --- a/Master/tlpkg/TeXLive/TLConfig.pm +++ b/Master/tlpkg/TeXLive/TLConfig.pm @@ -23,6 +23,8 @@ BEGIN { $BlockSize $NetArchive $DiskArchive + $TeXLiveServerURL + $TeXLiveServerPath $TeXLiveURL $TeXLiveAlternativeURL $WinSpecialUpdatePackagesRegexp @@ -55,11 +57,11 @@ our $DefaultContainerExtension = "tar.lzma"; our $NetArchive = "tlpkg"; our $DiskArchive = "archive"; -#our $TeXLiveURL = 'ftp://tug.org/texlive/tlnet/tldev'; -our $TeXLiveURL = 'http://mirror.ctan.org/systems/texlive/tlnet/tldev'; -our $TeXLiveAlternativeURL; -#our $TeXLiveAlternativeURL = 'http://www.ctan.org/systems/texlive/tlnet/2008'; +our $TeXLiveServerURL = "http://mirror.ctan.org"; +our $TeXLiveServerPath = "systems/texlive/tlnet/tldev"; +our $TeXLiveURL = "$TeXLiveServerURL/$TeXLiveServerPath"; +our $TeXLiveAlternativeURL; # idea that didn't pan out our $WinSpecialUpdatePackagesRegexp = '^(texlive\.infra|luatex|bin-tlperl\.win32$|bin-texlive|bin-kpathsea)'; @@ -85,8 +87,8 @@ configuring all of TeX Live. =head1 EXPORTED VARIABLES -All of the following variables can be pulled into the callers namespace -(i.e., are declared EXPORT_OK). +All of the following variables are pulled into the callers namespace, +i.e., are declared with C<EXPORT> (and C<EXPORT_OK>). =item C<@TeXLive::TLConfig::MetaCategories> @@ -113,8 +115,9 @@ The default category used when creating new packages. =item C<$TeXLive::TLConfig::InfraLocation> -The location of various infrastructural files (texlive.tlpdb, tlpobj files, -etc) relative to the root of the installation. +The subdirectory with various infrastructure files (C<texlive.tlpdb>, +tlpobj files, ...) relative to the root of the installation; currently +C<tlpkg>. =item C<$TeXLive::TLConfig::BlockSize> @@ -126,6 +129,14 @@ The assumed block size, currently 4k. These values specify where to find packages. +=item C<$TeXLive::TLConfig::TeXLiveServerURL> +=item C<$TeXLive::TLConfig::TeXLiveServerPath> + +C<TeXLiveURL> is concatencated from these values, with a string between. +The defaults are respectively, C<http://mirror.ctan.org> and +C<systems/texlive/tlnet/>I<rel>, where I<rel> specifies the TeX Live +release version, such as C<tldev> or C<2008>. + =item C<$TeXLive::TLConfig::WinSpecialUpdatePackagesRegexp> A regexp matching all those packages which cannot be normally updated diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index 59ab8bd92d8..db267c05e36 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -1453,29 +1453,28 @@ sub conv_to_win_path { } -sub give_ctan_mirror { - my $originalurl = "http://mirror.ctan.org"; +sub give_ctan_mirror +{ my $wget = $::progs{'wget'}; - if (!defined($wget)) { - tlwarn("programs not set up, trying wget\n"); + if (!defined ($wget)) { + tlwarn ("programs not set up, trying wget\n"); $wget = "wget"; } - if (win32()) { - $cmd = "$wget http://mirror.ctan.org -O nul 2>&1"; - } else { - $cmd = "$wget http://mirror.ctan.org -O /dev/null 2>&1"; - } + + my $cmd = "$wget $TeXLiveServerURL -O " + . (win32() ? "nul" : "/dev/null") . " 2>&1"; my @out = `$cmd`; # now analyze the output - my $mirror = "http://mirror.ctan.org/systems/texlive/tlnet/tldev/"; + my $mirror = $TeXLiveURL; foreach (@out) { if (m/^Location: (\S*)\s*.*$/) { - $mirror = "$1" . "/systems/texlive/tlnet/tldev"; + (my $mhost = $1) =~ s,/*$,,; # remove trailing slashes since we add it: + $mirror = "$mhost/$TeXLiveServerPath"; last; } } - # if we cannot find a mirror, return the mirror.ctan.org itself - return($mirror); + # if we cannot find a mirror, return the default (mirror.ctan.org) itself + return $mirror; } sub tlmd5 { |