summaryrefslogtreecommitdiff
path: root/Master/tlpkg/TeXLive
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-02-07 01:41:31 +0000
committerKarl Berry <karl@freefriends.org>2009-02-07 01:41:31 +0000
commit5035139bd7b3a3278c0c968d4811fc0e1bf1f5ac (patch)
tree06c9f6c32b96aaa454a7fbb258385df82733e0f4 /Master/tlpkg/TeXLive
parentf960d764a22c7d401357dbcf0f9b0dba0e517f1b (diff)
fail immediately if one of our necessary programs (wget,lzmadec,lzma) is not present
git-svn-id: svn://tug.org/texlive/trunk@12110 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive')
-rw-r--r--Master/tlpkg/TeXLive/TLUtils.pm34
1 files changed, 20 insertions, 14 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm
index 38a630b0ecf..6eb6f8d2941 100644
--- a/Master/tlpkg/TeXLive/TLUtils.pm
+++ b/Master/tlpkg/TeXLive/TLUtils.pm
@@ -1271,15 +1271,17 @@ Populate the global C<$::progs> hash containing the paths to the
programs C<wget>, C<tar>, C<lzmadec>. The C<$bindir> argument specifies
the path to the location of the C<lzmadec> binaries, the C<$platform>
gives the TeX Live platform name, used as the extension on our
-executables.
+executables. If a program is not present in the TeX Live tree, we also
+check along PATH (without the platform extension.)
-If a program is not present in the TeX Live tree, we also check along
-PATH (without the platform extension.)
+Return 0 if failure, nonzero if success.
=cut
sub setup_programs {
my ($bindir, $platform) = @_;
+ my $ok = 1;
+
$::progs{'wget'} = "wget";
$::progs{'lzmadec'} = "lzmadec";
$::progs{'lzma'} = "lzma";
@@ -1292,13 +1294,14 @@ sub setup_programs {
$::progs{'lzma'} = conv_to_w32_path("$bindir/lzma/lzma.exe");
for my $prog ("lzmadec", "wget") {
my $opt = $prog eq "lzmadec" ? "--help" : "--version";
- my $ret = system("$::progs{$prog} $opt > nul 2>&1"); # on windows
+ my $ret = system("$::progs{$prog} $opt >nul 2>&1"); # on windows
if ($ret != 0) {
- warn "TeXLive::TLUtils::setup_programs failed"; # no newline
+ warn "TeXLive::TLUtils::setup_programs (w32) failed"; # no nl for perl
warn "$::progs{$prog} $opt failed (status $ret): $!\n";
warn "Output is:\n";
system ("$::progs{$prog} $opt");
- return 0;
+ warn "\n";
+ $ok = 0;
}
}
} else {
@@ -1310,13 +1313,14 @@ sub setup_programs {
$::installerdir = "$bindir/../..";
$platform = platform();
}
- our $tmp;
- setup_unix_one('wget', "$bindir/wget/wget.$platform", "--version");
- setup_unix_one('lzmadec', "$bindir/lzma/lzmadec.$platform", "--help");
- setup_unix_one('lzma', "$bindir/lzma/lzma.$platform", "notest");
+ my $s = 0;
+ $s += setup_unix_one('wget', "$bindir/wget/wget.$platform", "--version");
+ $s += setup_unix_one('lzmadec',"$bindir/lzma/lzmadec.$platform","--help");
+ $s += setup_unix_one('lzma', "$bindir/lzma/lzma.$platform", "notest");
+ $ok = ($s == 3); # failure return unless all are present.
}
- return 1; # success
+ return $ok;
}
@@ -1331,8 +1335,9 @@ sub setup_programs {
# - if nothing shipped, GOTO fallback
#
# fallback:
-# if prog is found in PATH and can be executed, use it,
-# otherwise return 0.
+# if prog is found in PATH and can be executed, use it.
+#
+# Return 0 if failure, 1 if success.
#
sub setup_unix_one {
my ($p, $def, $arg) = @_;
@@ -1409,7 +1414,7 @@ sub setup_unix_one {
if ($ret == 0) {
debug("Using system $p (tested).\n");
} else {
- tlwarn("Initialization failed (in setup_unix_one):\n");
+ tlwarn("$0: Initialization failed (in setup_unix_one):\n");
tlwarn(" could not find a usable program for $p.\n");
return 0;
}
@@ -1417,6 +1422,7 @@ sub setup_unix_one {
debug ("Using system $p (not tested).\n");
}
}
+ return 1;
}
=item C<download_file( $relpath, $destination [, $progs ] )>