summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-11-09 01:26:54 +0000
committerKarl Berry <karl@freefriends.org>2008-11-09 01:26:54 +0000
commit647511a520b626523dd73ed9fab7e32ecc627b45 (patch)
tree8f9c6f91c961014796296b399fa4767fe64c055c
parentf72dd4a227f24ea0f17ee451389c17d62557cb8c (diff)
* TeXLive/TLPDB.tpm: debugging text, comments.
* TeXLive/TLMedia.pm: debugging text, remove unused use Cwd. * TeXLive/ TLUtils.pm (download_file, give_ctan_mirror): insert our desired custom wget overrides here (--timeout=60 for both and --tries=8 for the former). * installer/wgetrc: remove this file, so people's personal settings (e.g., for proxies) will take effect. * install-tl (WGETRC): do not set this in the environment. (main): run give_ctan_mirror if the TeXLiveServerUrl or literal "ctan" is given, a la tlmgr; update doc. git-svn-id: svn://tug.org/texlive/trunk@11228 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-xMaster/install-tl26
-rw-r--r--Master/tlpkg/TeXLive/TLMedia.pm4
-rw-r--r--Master/tlpkg/TeXLive/TLPDB.pm18
-rw-r--r--Master/tlpkg/TeXLive/TLUtils.pm80
-rw-r--r--Master/tlpkg/installer/wgetrc117
5 files changed, 70 insertions, 175 deletions
diff --git a/Master/install-tl b/Master/install-tl
index 994ab0e3b48..497e8cd1e39 100755
--- a/Master/install-tl
+++ b/Master/install-tl
@@ -76,6 +76,7 @@ use TeXLive::TLUtils qw(platform platform_desc
get_system_tmpdir member process_logging_options rmtree
mkdirhier make_var_skeleton make_local_skeleton install_package copy
install_packages dirname setup_programs welcome welcome_paths);
+use TeXLive::TLMedia;
use TeXLive::TLPOBJ;
use TeXLive::TLPDB;
use TeXLive::TLConfig;
@@ -375,20 +376,20 @@ if ($opt_gui && !$opt_no_gui && ($opt_profile eq "")) {
# initialize the correct platform
platform();
if (!setup_programs ("$::installerdir/tlpkg/installer", "$::_platform_")) {
- tlwarn("Couldn't set up the necessary programs.\n"
- . "Cannot continue with installation.\n"
- . "Please report to texlive\@tug.org.\n");
+ tlwarn("Couldn't set up the necessary programs;\n"
+ . "perhaps your platform is not supported.\n");
exit 1;
}
-$ENV{'WGETRC'}="$::installerdir/tlpkg/installer/wgetrc";
-#
-# determine from where we do install
+# determine where we will find the distribution to install from.
#
$location = $opt_location;
$location || ($location = "$::installerdir");
-if ($location =~ m!^(http|ftp)://!i) {
+if ($location =~ m!^(ctan$|(http|ftp)://)!i) {
$location =~ s,/(tlpkg|archive)?/*$,,; # remove any trailing tlpkg or /
+ if ($location =~ m/^($TeXLiveServerURL|ctan$)/) {
+ $location = TeXLive::TLUtils::give_ctan_mirror();
+ }
$TeXLiveURL = $location;
$media = 'NET';
} else {
@@ -793,7 +794,7 @@ sub load_tlpdb {
info("Loading $master/$TeXLive::TLConfig::InfraLocation/$TeXLive::TLConfig::DatabaseName\n");
$tlpdb=TeXLive::TLPDB->new(root => "$master");
if (!defined($tlpdb)) {
- die("Cannot load TeX Live Database from $master");
+ die "$0: Could not load TeX Live Database from $master, goodbye.\n";
}
# set the defaults to what is specified in the tlpdb
$vars{'option_doc'} = $tlpdb->option_install_docfiles;
@@ -1517,7 +1518,7 @@ of using a local directory:
If the location is on the network, trailing C</> characters and/or
trailing C</tlpkg> and C</archive> components are ignored. For example,
-you could choose a particular CTAN mirror with something like:
+you could choose a particular CTAN mirror with something like this:
-location http://ctan.example.org/tex-archive/texlive/tlnet/2008
@@ -1526,9 +1527,10 @@ have to be specified. (The list of CTAN mirrors is maintained at
L<http://ctan.org/mirrors>.)
The default is to pick a mirror automatically, using
-L<http://mirror.ctan.org>; the chosen mirror is used for the entire
-download. (See L<http://ctan.org> for more about the CTAN mirror
-services.)
+L<http://mirror.ctan.org/systems/texlive/tlnet/YYYY>; the chosen mirror
+is used for the entire download. You can use the special location name
+C<ctan> as an abbreviation for this. See L<http://ctan.org> for more
+about CTAN and its mirrors.
After installation is complete, you can use that installation as the
location for another installation. If you chose to install less than
diff --git a/Master/tlpkg/TeXLive/TLMedia.pm b/Master/tlpkg/TeXLive/TLMedia.pm
index 82030e0881e..218987dbcb3 100644
--- a/Master/tlpkg/TeXLive/TLMedia.pm
+++ b/Master/tlpkg/TeXLive/TLMedia.pm
@@ -4,7 +4,6 @@
#
# This file is licensed under the GNU General Public License version 2
# or any later version.
-#
package TeXLive::TLMedia;
@@ -13,7 +12,6 @@ use TeXLive::TLPostActions;
use TeXLive::TLUtils qw(copy win32 dirname mkdirhier basename download_file
merge_into debug ddebug info tlwarn);
use TeXLive::TLPDB;
-use Cwd qw/abs_path/;
sub new
{
@@ -238,7 +236,7 @@ sub _install_package {
my $lzmadec = $::progs{'lzmadec'};
my $tar = $::progs{'tar'};
if (!defined($wget) || !defined($lzmadec) || !defined($tar)) {
- tlwarn("Programs have not been set up properly, strange!\n");
+ tlwarn("_install_package: programs not set up properly, strange.\n");
return(0);
}
diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm
index 1ff426e7833..d7ca2818eb0 100644
--- a/Master/tlpkg/TeXLive/TLPDB.pm
+++ b/Master/tlpkg/TeXLive/TLPDB.pm
@@ -184,10 +184,8 @@ sub remove_package {
=item C<< $tlpdb->from_file($filename) >>
-The C<from_file> function initializes the C<TLPDB> in case the
-root was not given at generation time. If C<$filename> begins
-with C<http://> or C<ftp://>, the program C<wget> is used to download
-the file. The prefix C<file:/> is treated the expected way.
+The C<from_file> function initializes the C<TLPDB> if the root was not
+given at generation time. See L<TLPDB::new> for more information.
It returns the actual number of packages (TLPOBJs) read from C<$filename>.
@@ -233,19 +231,19 @@ sub from_file {
# better to check both, the return value AND the existence of the file
if ($ret && (-r "$lzmafile")) {
# ok, let the fun begin
- debug("Un-lzmaing $lzmafile to $tlpdbfile\n");
+ debug("un-lzmaing $lzmafile to $tlpdbfile\n");
# lzmadec *hopefully* returns 0 on success and anything else on failure
# we don't have to negate since not zero means error in the shell
# and thus in perl true
- if (system("$::progs{'lzmadec'} < $lzmafile_quote > $tlpdbfile_quote")) {
- debug("Un-lzmaing $lzmafile did not succeed, try normally\n");
+ if (system("$::progs{'lzmadec'} <$lzmafile_quote >$tlpdbfile_quote")) {
+ debug("un-lzmaing $lzmafile failed, tryin gplain file\n");
# to be sure we unlink the lzma file and the tlpdbfile
unlink($lzmafile);
unlink($tlpdbfile);
} else {
unlink($lzmafile);
- open $retfh, "<$tlpdbfile" or die"Cannot open $tlpdbfile!";
- debug("Ok, found the uncompressed lzma file!\n");
+ open $retfh, "<$tlpdbfile" or die "open($tlpdbfile) failed: $!";
+ debug("found the uncompressed lzma file\n");
}
}
} else {
@@ -267,7 +265,7 @@ sub from_file {
my $ret = 0;
do {
my $tlp = TeXLive::TLPOBJ->new;
- debug("creating tlp from $path...\n");
+ ddebug("creating tlp from $path...\n");
$ret = $tlp->from_fh($retfh,1);
if ($ret) {
$self->add_tlpobj($tlp);
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm
index 0f6712e5775..9f1f6b5ed30 100644
--- a/Master/tlpkg/TeXLive/TLUtils.pm
+++ b/Master/tlpkg/TeXLive/TLUtils.pm
@@ -912,7 +912,7 @@ sub install_package {
my $lzmadec = $::progs{'lzmadec'};
my $tar = $::progs{'tar'};
if (!defined($wget) || !defined($lzmadec) || !defined($tar)) {
- die "Programs have not been set up properly, strange!";
+ die "install_package: programs not set up properly, strange";
}
if (ref $what) {
# we are getting a ref to a list of files, so install from DVD
@@ -1007,15 +1007,15 @@ sub install_package {
copy($what, "$target/temp");
}
}
- debug("Un-lzmaing $lzmafile to $tarfile\n");
+ debug("un-lzmaing $lzmafile to $tarfile\n");
system("$lzmadec < $lzmafile_quote > $tarfile_quote");
if (! -f $tarfile) {
- die "Unpacking $lzmafile did not succeed, please retry!";
+ die "Unpacking $lzmafile did not succeed, please retry";
}
- debug("Unpacking $tarfile\n");
+ debug("unpacking $tarfile\n");
system($tar,"-x","-C",$target,"-f",$tarfile);
unlink($tarfile);
- debug("Keeping $lzmafile for restarting ...\n");
+ debug("keeping $lzmafile for restarting ...\n");
# unlink($lzmafile);
} else {
die "Don't know how to install $what!\n";
@@ -1103,18 +1103,19 @@ Try to download the file given in C<$relpath> from C<$TeXLiveURL>
into C<$destination>, which can be either
a filename of simply C<|>. In the latter case a file handle is returned.
-The optional argument C<$progs> is a reference to a hash giving full pathes
-to the respective programs, at least C<wget>. In case that C<$progs> is not
-given the C<%::progs> is consulted, and if this also does not exist we
-try "wget".
+The optional argument C<$progs> is a reference to a hash giving full
+paths to the respective programs, at least C<wget>. If C<$progs> is not
+given the C<%::progs> hash is consulted, and if this also does not exist
+we try a literal C<wget>.
-Downloading honors two environment variables C<TL_DOWNLOAD_PROGRAM> and
-C<TL_DOWNLOAD_ARGS>. The former overrides C<wget> (or what is given in the
-C<$progs> argument, the latter overrides the default wget arguments
-given in C<$TeXLive::TLConfig::DefaultWgetArgs>.
+Downloading honors two environment variables: C<TL_DOWNLOAD_PROGRAM> and
+C<TL_DOWNLOAD_ARGS>. The former overrides the above specification
+devolving to C<wget>, and the latter overrides the default wget
+arguments, which are: C<--tries=8 --timeout=60 -q -O>.
-C<TL_DOWNLOAD_ARGS> must be set up in a way that the place the output should
-go to is the first argument after the C<TL_DOWNLOAD_ARGS>. Use with care.
+C<TL_DOWNLOAD_ARGS> must be defined so that the file the output goes to
+is the first argument after the C<TL_DOWNLOAD_ARGS>. Thus, typically it
+would end in C<-O>. Use with care.
=cut
@@ -1126,7 +1127,7 @@ sub download_file {
} elsif (defined($::progs{'wget'})) {
$wget = $::progs{'wget'};
} else {
- tlwarn ("Programs have not been set up, trying simply wget");
+ tlwarn ("download_file: Programs not set up, trying literal wget\n");
$wget = "wget";
}
my $url;
@@ -1163,27 +1164,25 @@ sub _download_file {
}
my $wget = $ENV{"TL_DOWNLOAD_PROGRAM"} || $wgetdefault;
- # we set now the args in installer/wgetrc
- my $wgetargs = $ENV{"TL_DOWNLOAD_ARGS"} || "-q -O";
+ my $wgetargs = $ENV{"TL_DOWNLOAD_ARGS"}
+ || "--tries=8 --timeout=60 -q -O";
-
- debug("Trying to download $url\n");
+ debug("downloading $url using $wget $wgetargs\n");
my $ret;
if ($dest eq "|") {
- open(RETFH, "$wget $wgetargs - $url|") or
- die("Cannot open $url via wget for reading");
+ open(RETFH, "$wget $wgetargs - $url|")
+ || die "open($url) via $wget $wgetargs failed: $!";
# opening to a pipe always succeeds, so we return immediately
return \*RETFH;
} else {
- my @wgetargs = split ' ', $wgetargs;
- $ret = system $wget, @wgetargs, $dest, $url;
- # we have to reverse the meaning of ret because systems returns
- # the inverse
+ my @wgetargs = split (" ", $wgetargs);
+ $ret = system ($wget, @wgetargs, $dest, $url);
+ # we have to reverse the meaning of ret because system has 0=success.
$ret = ($ret ? 0 : 1);
}
# return false/undef in case the download did not succeed.
return ($ret) unless $ret;
- debug("Download $url did succeed\n");
+ debug("download of $url succeeded\n");
if ($dest eq "|") {
return \*RETFH;
} else {
@@ -1716,28 +1715,43 @@ sub conv_to_w32_path {
return($p);
}
+=pod
+
+=item C<give_ctan_mirror()>
+
+Return the specific mirror chosen from the generic CTAN auto-redirecting
+default (specified in L<$TLConfig::TexLiveServerURL>) if possible, else
+the default url again.
+
+Neither C<TL_DOWNLOAD_PROGRAM> nor <TL_DOWNLOAD_ARGS> is honored (see
+L<download_file>), since certain options have to be set to do the job
+and the program has to be C<wget> since we parse the output.
+
+=cut
sub give_ctan_mirror
{
my $wget = $::progs{'wget'};
if (!defined ($wget)) {
- tlwarn ("programs not set up, trying wget\n");
+ tlwarn ("give_ctan_mirror: Programs not set up, trying wget\n");
$wget = "wget";
}
-
- my $cmd = "$wget $TeXLiveServerURL -O "
+
+ # we need the verbose output, so no -q.
+ # do not reduce retries here, but timeout still seems desirable.
+ my $cmd = "$wget $TeXLiveServerURL --timeout=60 -O "
. (win32() ? "nul" : "/dev/null") . " 2>&1";
my @out = `$cmd`;
- # now analyze the output
+ # analyze the output for the mirror actually selected.
my $mirror = $TeXLiveURL;
foreach (@out) {
if (m/^Location: (\S*)\s*.*$/) {
- (my $mhost = $1) =~ s,/*$,,; # remove trailing slashes since we add it:
+ (my $mhost = $1) =~ s,/*$,,; # remove trailing slashes since we add it
$mirror = "$mhost/$TeXLiveServerPath";
last;
}
}
- # if we cannot find a mirror, return the default (mirror.ctan.org) itself
+ # if we cannot find a mirror, return the default again.
return $mirror;
}
diff --git a/Master/tlpkg/installer/wgetrc b/Master/tlpkg/installer/wgetrc
deleted file mode 100644
index ae52efd3e66..00000000000
--- a/Master/tlpkg/installer/wgetrc
+++ /dev/null
@@ -1,117 +0,0 @@
-###
-### Sample Wget initialization file .wgetrc
-###
-
-## You can use this file to change the default behaviour of wget or to
-## avoid having to type many many command-line options. This file does
-## not contain a comprehensive list of commands -- look at the manual
-## to find out what you can put into this file.
-##
-## Wget initialization file can reside in /usr/local/etc/wgetrc
-## (global, for all users) or $HOME/.wgetrc (for a single user).
-##
-## To use the settings in this file, you will have to uncomment them,
-## as well as change them, in most cases, as the values on the
-## commented-out lines are the default values (e.g. "off").
-
-
-##
-## Global settings (useful for setting up in /usr/local/etc/wgetrc).
-## Think well before you change them, since they may reduce wget's
-## functionality, and make it behave contrary to the documentation:
-##
-
-# You can set retrieve quota for beginners by specifying a value
-# optionally followed by 'K' (kilobytes) or 'M' (megabytes). The
-# default quota is unlimited.
-#quota = inf
-
-# You can lower (or raise) the default number of retries when
-# downloading a file (default is 20).
-tries = 8
-
-# Lowering the maximum depth of the recursive retrieval is handy to
-# prevent newbies from going too "deep" when they unwittingly start
-# the recursive retrieval. The default is 5.
-#reclevel = 5
-
-# By default Wget uses "passive FTP" transfer where the client
-# initiates the data connection to the server rather than the other
-# way around. That is required on systems behind NAT where the client
-# computer cannot be easily reached from the Internet. However, some
-# firewalls software explicitly supports active FTP and in fact has
-# problems supporting passive transfer. If you are in such
-# environment, use "passive_ftp = off" to revert to active FTP.
-#passive_ftp = off
-
-# The "wait" command below makes Wget wait between every connection.
-# If, instead, you want Wget to wait only between retries of failed
-# downloads, set waitretry to maximum number of seconds to wait (Wget
-# will use "linear backoff", waiting 1 second after the first failure
-# on a file, 2 seconds after the second failure, etc. up to this max).
-waitretry = 10
-
-
-##
-## Local settings (for a user to set in his $HOME/.wgetrc). It is
-## *highly* undesirable to put these settings in the global file, since
-## they are potentially dangerous to "normal" users.
-##
-## Even when setting up your own ~/.wgetrc, you should know what you
-## are doing before doing so.
-##
-
-# Set this to on to use timestamping by default:
-#timestamping = off
-
-# It is a good idea to make Wget send your email address in a `From:'
-# header with your request (so that server administrators can contact
-# you in case of errors). Wget does *not* send `From:' by default.
-#header = From: Your Name <username@site.domain>
-
-# You can set up other headers, like Accept-Language. Accept-Language
-# is *not* sent by default.
-#header = Accept-Language: en
-
-# You can set the default proxies for Wget to use for http and ftp.
-# They will override the value in the environment.
-#http_proxy = http://proxy.yoyodyne.com:18023/
-#ftp_proxy = http://proxy.yoyodyne.com:18023/
-
-# If you do not want to use proxy at all, set this to off.
-#use_proxy = on
-
-# You can customize the retrieval outlook. Valid options are default,
-# binary, mega and micro.
-#dot_style = default
-
-# Setting this to off makes Wget not download /robots.txt. Be sure to
-# know *exactly* what /robots.txt is and how it is used before changing
-# the default!
-#robots = on
-
-# It can be useful to make Wget wait between connections. Set this to
-# the number of seconds you want Wget to wait.
-#wait = 0
-
-# You can force creating directory structure, even if a single is being
-# retrieved, by setting this to on.
-#dirstruct = off
-
-# You can turn on recursive retrieving by default (don't do this if
-# you are not sure you know what it means) by setting this to on.
-#recursive = off
-
-# To always back up file X as X.orig before converting its links (due
-# to -k / --convert-links / convert_links = on having been specified),
-# set this variable to on:
-#backup_converted = off
-
-# To have Wget follow FTP links from HTML files by default, set this
-# to on:
-#follow_ftp = off
-
-#
-# timeout, not sure if this is evaluated
-timeout = 60
-