summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
}