summaryrefslogtreecommitdiff
path: root/Master/tlpkg
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-01-18 18:46:18 +0000
committerKarl Berry <karl@freefriends.org>2009-01-18 18:46:18 +0000
commite7a7c33e975231f44787edf2469ffc19f54a9733 (patch)
treed742f008e0eb4e74ffb0c26e01f1d2e3eb94468a /Master/tlpkg
parentd3324e1246e3f8490a7af4911526a78033cd72ba (diff)
(setup_programs): patch from jukka to keep going
if lzmadec is not present in our tlpkg dir, 14 Jan 2009 16:07:44. git-svn-id: svn://tug.org/texlive/trunk@11911 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg')
-rw-r--r--Master/tlpkg/TeXLive/TLUtils.pm42
1 files changed, 24 insertions, 18 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm
index 08657a84238..41b83cc8e9a 100644
--- a/Master/tlpkg/TeXLive/TLUtils.pm
+++ b/Master/tlpkg/TeXLive/TLUtils.pm
@@ -1226,17 +1226,20 @@ sub untar {
-=item C<setup_programs( $bindir, $platform )>
+=item C<setup_programs($bindir, $platform)>
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 the
+gives the TeX Live platform name, used as the extension on our
executables.
+If a program is not present in the TeX Live tree, we also check along
+PATH (without the platform extension.)
+
Returns -1 if the architecture is not supported (i.e., there is no
-C<lzmadec> binary for that arch present), 0 for programs don't work, and
-1 for success.
+C<lzmadec> binary for that arch present), 0 for programs that are
+present but don't work, and 1 for success.
=cut
@@ -1270,31 +1273,34 @@ sub setup_programs {
if -x "$bindir/lzma/lzma.$platform";
}
- # check for existence of lzmadec; this determines whether the present
- # pltform is supported. Because of conv_to_w32_path possibly adding
- # quotes, strip them away for the file test. Since all other uses of
- # conv_to_w32_path use the result in shell commands, this is the most
- # expedient thing to do.
+ # Check for existence of lzmadec in our directory; if so, the present
+ # platform is supported. But if it's not there, the test below for a
+ # working lzmadec could still succeed if the binary is found in $PATH.
+ #
+ # Because conv_to_w32_path possibly added quotes, strip them away for
+ # the file test. Since all other uses of conv_to_w32_path use the
+ # result in shell commands, this is the most expedient thing to do.
+ #
(my $lzmadec = $::progs{'lzmadec'}) =~ s/^"(.*)"/$1/;
- return(-1) if (! -r $lzmadec);
+ my $found_lzmadec = -x $lzmadec;
- # check that the programs are actually working
- my $nul = "/dev/null";
- $nul = "nul" if ($^O =~ /^MSWin(32|64)$/i);
- # do not test tar, we rely on the system having a usable one.
- # The main point is to check the binaries we provide.
+ # check if the programs are working, but do not test tar, we rely on
+ # the system having a usable one. The main point is to check the
+ # binaries we provide.
for my $prog ("lzmadec", "wget") {
my $opt = $prog eq "lzmadec" ? "--help" : "--version";
- my $ret = system("$::progs{$prog} $opt >$nul 2>$nul");
+ my $ret = system("$::progs{$prog} $opt >"
+ . (win32() ? "nul" : "/dev/null") . " 2>&1");
if ($ret != 0) {
warn "TeXLive::TLUtils::setup_programs failed"; # no newline
warn "$::progs{$prog} $opt failed (status $ret): $!\n";
warn "Output is:\n";
system ("$::progs{$prog} $opt");
- return 0;
+ return $found_lzmadec ? 0 : -1;
}
}
- return 1;
+
+ return 1; # success
}