texlive[47834] Master/tlpkg/TeXLive: try setup on windows in similar
commits+preining at tug.org
commits+preining at tug.org
Fri May 25 05:40:14 CEST 2018
Revision: 47834
http://tug.org/svn/texlive?view=revision&revision=47834
Author: preining
Date: 2018-05-25 05:40:14 +0200 (Fri, 25 May 2018)
Log Message:
-----------
try setup on windows in similar fashion as unix
Modified Paths:
--------------
trunk/Master/tlpkg/TeXLive/TLConfig.pm
trunk/Master/tlpkg/TeXLive/TLPDB.pm
trunk/Master/tlpkg/TeXLive/TLUtils.pm
Modified: trunk/Master/tlpkg/TeXLive/TLConfig.pm
===================================================================
--- trunk/Master/tlpkg/TeXLive/TLConfig.pm 2018-05-25 02:27:29 UTC (rev 47833)
+++ trunk/Master/tlpkg/TeXLive/TLConfig.pm 2018-05-25 03:40:14 UTC (rev 47834)
@@ -128,7 +128,8 @@
# 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');
Modified: trunk/Master/tlpkg/TeXLive/TLPDB.pm
===================================================================
--- trunk/Master/tlpkg/TeXLive/TLPDB.pm 2018-05-25 02:27:29 UTC (rev 47833)
+++ trunk/Master/tlpkg/TeXLive/TLPDB.pm 2018-05-25 03:40:14 UTC (rev 47834)
@@ -324,7 +324,7 @@
# 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);
Modified: trunk/Master/tlpkg/TeXLive/TLUtils.pm
===================================================================
--- trunk/Master/tlpkg/TeXLive/TLUtils.pm 2018-05-25 02:27:29 UTC (rev 47833)
+++ trunk/Master/tlpkg/TeXLive/TLUtils.pm 2018-05-25 03:40:14 UTC (rev 47834)
@@ -2330,14 +2330,11 @@
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 @@
$::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);
+ }
+
+ # 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_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);
- }
- $::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 @@
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,7 +2407,46 @@
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
# - if the shipped one is -x but cannot be executed, copy it. set -x
More information about the tex-live-commits
mailing list