diff options
Diffstat (limited to 'Master/tlpkg/TeXLive/TLUtils.pm')
-rw-r--r-- | Master/tlpkg/TeXLive/TLUtils.pm | 54 |
1 files changed, 34 insertions, 20 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index e5f4def0774..c557afd9d16 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -62,7 +62,7 @@ C<TeXLive::TLUtils> -- utilities used in the TeX Live infrastructure TeXLive::TLUtils::member($item, @list); TeXLive::TLUtils::merge_into(\%to, \%from); TeXLive::TLUtils::texdir_check($texdir); - TeXLive::TLUtils::conv_to_win_path($path); + TeXLive::TLUtils::conv_to_w32_path($path); TeXLive::TLUtils::give_ctan_mirror($path); TeXLive::TLUtils::tlmd5($path); @@ -104,7 +104,7 @@ BEGIN { &texdir_check &member "ewords - &conv_to_win_path + &conv_to_w32_path &setup_programs &download_file &merge_into @@ -1012,14 +1012,15 @@ sub install_package { =item C<setup_programs( $bindir, $platform )> -Populate the global $::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 executables. +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 +executables. Returns -1 if the architecture is not supported (i.e., there is no -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 don't work, and +1 for success. =cut @@ -1039,16 +1040,23 @@ sub setup_programs { $::progs{'tar'} = "tar"; if ($^O =~ /^MSWin(32|64)$/i) { - $::progs{'wget'} = conv_to_win_path("$bindir/wget/wget.exe"); - $::progs{'tar'} = conv_to_win_path("$bindir/tar.exe"); - $::progs{'lzmadec'} = conv_to_win_path("$bindir/lzma/lzmadec.win32.exe"); - $::progs{'lzma'} = conv_to_win_path("$bindir/lzma/lzma.exe"); + $::progs{'wget'} = conv_to_w32_path("$bindir/wget/wget.exe"); + $::progs{'tar'} = conv_to_w32_path("$bindir/tar.exe"); + $::progs{'lzmadec'} = conv_to_w32_path("$bindir/lzma/lzmadec.win32.exe"); + $::progs{'lzma'} = conv_to_w32_path("$bindir/lzma/lzma.exe"); } elsif (-r "$bindir/wget/wget.$platform") { $::progs{'wget'} = "$bindir/wget/wget.$platform"; } - return(-1) if (! -r $::progs{'lzmadec'}); - # + + # 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. + (my $lzmadec = $::progs{'lzmadec'}) =~ s/^"(.*)"/$1/; + return(-1) if (! -r $lzmadec); + # check that the programs are actually working my $nul = "/dev/null"; $nul = "nul" if ($^O =~ /^MSWin(32|64)$/i); @@ -1634,17 +1642,23 @@ EOF =pod -This function returns a "windowsified" path, i.e., replacing all forward -slashes to backslashes, and adding additional " around (in case of spaces -in $path). Furthermore it makes the path absolute. So if $path does not -start with an arbitrary char followed by : we add the output of `cd`. +This function returns a "windowsified" version of its single argument +I<path>, i.e., replaces all forward slashes with backslashes, and adds +an additional C<"> at the beginning and end if I<path> contains any +spaces. It also makes the path absolute. So if $path does not start +with one (arbitrary) characer followed by C<:>, we add the output of +C<`cd`>. + +The result is suitable for running in shell commands, but not file tests +or other manipulations, since in such internal Perl contexts, the quotes +would be considered part of the filename. =cut -sub conv_to_win_path { +sub conv_to_w32_path { my $p = shift; $p =~ s!/!\\!g; - # we need absolute pathes, too + # we need absolute paths, too if ($p !~ m!^.:!) { my $cwd = `cd`; die "sorry, could not find current working directory via cd?!" if ! $cwd; |