diff options
Diffstat (limited to 'Master/tlpkg/TeXLive')
-rw-r--r-- | Master/tlpkg/TeXLive/TLConfig.pm | 3 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLPDB.pm | 2 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLUtils.pm | 98 |
3 files changed, 77 insertions, 26 deletions
diff --git a/Master/tlpkg/TeXLive/TLConfig.pm b/Master/tlpkg/TeXLive/TLConfig.pm index 108e54d003b..338cbb5a040 100644 --- a/Master/tlpkg/TeXLive/TLConfig.pm +++ b/Master/tlpkg/TeXLive/TLConfig.pm @@ -128,7 +128,8 @@ our %FallbackDownloaderArgs = ( # the way we package things on the web our $DefaultCompressorFormat = "xz"; our $DefaultContainerExtension = "tar.$DefaultCompressorFormat"; -our @AcceptedCompressors = qw/xz lz4 gzip/; +# mind that the order here is important as gives also the preference! +our @AcceptedCompressors = qw/lz4 gzip xz/; our $AcceptedCompressorsRegexp = "(xz|lz4|gzip)"; our %CompressorProgram = ( 'xz' => 'xz', 'gzip' => 'gzip', 'lz4' => 'lz4'); our %CompressorExtension = ( 'xz' => 'xz', 'gzip' => 'gz', 'lz4' => 'lz4'); diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm index 3c3f4a3dce3..0670a64c6f8 100644 --- a/Master/tlpkg/TeXLive/TLPDB.pm +++ b/Master/tlpkg/TeXLive/TLPDB.pm @@ -324,7 +324,7 @@ sub from_file { # if we have xz available we try the xz file my $xz_succeeded = 0 ; my $compressorextension = "<UNSET>"; - if (defined($::progs{$DefaultCompressorFormat})) { + if (defined($::progs{$DecompressorProgram{$DefaultCompressorFormat}})) { # we first try the xz compressed file my ($xzfh, $xzfile) = TeXLive::TLUtils::tl_tmpfile(); close($xzfh); diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index 508195135d9..86bc13d27ab 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -2330,14 +2330,11 @@ sub setup_programs { my ($bindir, $platform) = @_; my $ok = 1; - if ($^O =~ /^MSWin/i) { - # we don't do any actual testing on Windows! - $::progs{'wget'} = conv_to_w32_path("$bindir/wget/wget.exe"); - $::progs{'tar'} = conv_to_w32_path("$bindir/tar.exe"); - $::progs{'xz'} = conv_to_w32_path("$bindir/xz/xz.exe"); - $::progs{'lz4'} = conv_to_w32_path("$bindir/lz4/lz4.exe"); - $::progs{'working_downloaders'} = [ qw/wget/ ]; - $::progs{'working_compressors'} = [ qw/xz lz4/ ]; + my $isWin = ($^O =~ /^MSWin/i); + + if ($isWin) { + setup_windows_one('tar', "$bindir/tar.exe", "--version", 1); + $platform = "exe"; } else { # tar needs to be provided by the system! $::progs{'tar'} = "tar"; @@ -2350,24 +2347,30 @@ sub setup_programs { $::installerdir = "$bindir/../.."; $platform = platform(); } - # setup of the fallback downloaders - my @working_downloaders; - for my $dltype (@AcceptedFallbackDownloaders) { - my $defprog = $FallbackDownloaderProgram{$dltype}; - # do not warn on errors - push @working_downloaders, $dltype if - setup_unix_one($defprog, "$bindir/$dltype/$defprog.$platform", "--version", 1); - } - $::progs{'working_downloaders'} = [ @working_downloaders ]; - my @working_compressors; - for my $comptype (@AcceptedCompressors) { - my $defprog = $CompressorProgram{$comptype}; - # do not warn on errors - push @working_compressors, $comptype if - setup_unix_one($defprog, "$bindir/$comptype/$defprog.$platform", "--version", 1); + } + + # setup of the fallback downloaders + my @working_downloaders; + for my $dltype (@AcceptedFallbackDownloaders) { + my $defprog = $FallbackDownloaderProgram{$dltype}; + # do not warn on errors + push @working_downloaders, $dltype if + setup_one(($isWin ? "w32" : "unix"), $defprog, "$bindir/$dltype/$defprog.$platform", "--version", 1); + } + $::progs{'working_downloaders'} = [ @working_downloaders ]; + my @working_compressors; + for my $comptype (@AcceptedCompressors) { + my $defprog = $CompressorProgram{$comptype}; + # do not warn on errors + if (setup_one(($isWin ? "w32" : "unix"), $defprog, "$bindir/$comptype/$defprog.$platform", "--version", 1)) { + push @working_compressors, $comptype; + # also set up $::{'compressor'} if not already done + # this selects the first one + # but we might reset this depending on TEXLIVE_COMPRESSOR setting, see below + defined($::prog{'compressor'}) || ($::prog{'compressor'} = $comptype); } - $::progs{'working_compressors'} = [ @working_compressors ]; } + $::progs{'working_compressors'} = [ @working_compressors ]; # check whether selected downloader/compressor is working # for downloader we allow 'lwp' as setting, too @@ -2385,6 +2388,14 @@ sub setup_programs { tlwarn("Detected working compressors: @{$::progs{'working_compressors'}}\n"); $ok = 0; } + # + # setup default compressor $::progs{'compressor'} which is used in tlmgr in the + # calls to make_container. By default we have already chosen the first that is + # actually working from our list of @AcceptableCompressors, but let the user + # override this. + if ($ENV{'TEXLIVE_COMPRESSOR'}) { + $::progs{'compressor'} = $ENV{'TEXLIVE_COMPRESSOR'}; + } if ($::opt_verbosity >= 1) { require Data::Dumper; @@ -2396,6 +2407,45 @@ sub setup_programs { return $ok; } +sub setup_one { + my ($what, $p, $def, $arg, $donotwarn) = @_; + if ($what eq "unix") { + return(setup_unix_one($p, $def, $arg, $donotwarn)); + } else { + return(setup_windows_one($p, $def, $arg, $donotwarn)); + } +} + +sub setup_windows_one { + my ($p, $def, $arg, $donotwarn) = @_; + debug("(w32) trying to set up $p, default $def, arg $arg\n"); + my $ready = 0; + if (-r $def) { + my $prog = conv_to_w32_path($def); + my $ret = system("$prog $arg >nul 2>&1"); # on windows + if ($ret == 0) { + $::progs{$p} = $prog; + $ready = 1; + } else { + tlwarn("Setting up $p with $def as $prog didn't work\n"); + system("$prog $arg"); + } + } else { + debug("Default progrma $def not readable?\n"); + } + return($ready) if ($ready); + # still here, try plain name without any specification + debug("trying to test for plain prog name $p\n"); + $ret = system("$p $arg >nul 2>&1"); + if ($ret == 0) { + debug("program $p seems to be in the path!\n"); + $::progs{$p} = $p; + return(1); + } + return(0); +} + + # setup one prog on unix using the following logic: # - if the shipped one is -x and can be executed, use it |