From 5035139bd7b3a3278c0c968d4811fc0e1bf1f5ac Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 7 Feb 2009 01:41:31 +0000 Subject: 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 --- Master/install-tl | 4 ++-- Master/tlpkg/TeXLive/TLUtils.pm | 34 ++++++++++++++++++++-------------- 2 files changed, 22 insertions(+), 16 deletions(-) (limited to 'Master') diff --git a/Master/install-tl b/Master/install-tl index d6479523627..46f01769977 100755 --- a/Master/install-tl +++ b/Master/install-tl @@ -313,8 +313,8 @@ if (($opt_gui ne "text") && !$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" - . "perhaps your platform is not supported.\n"); + tlwarn("$0: Couldn't set up the necessary programs;\n" + . " perhaps your platform ($::_platform_) is not supported.\n"); exit 1; } 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, C, C. The C<$bindir> argument specifies the path to the location of the C 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 -- cgit v1.2.3