summaryrefslogtreecommitdiff
path: root/Master/tlpkg/TeXLive
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2018-05-18 23:46:50 +0000
committerNorbert Preining <preining@logic.at>2018-05-18 23:46:50 +0000
commita5eb764bf2b6f48b060a238df33fe168b049df57 (patch)
treece7c78a81613389e26c9b840a6659393c9ec27de /Master/tlpkg/TeXLive
parent9a4c4ce12a0a4eeb9f89d66e43f632b02b9f3ee6 (diff)
more work on lz4 compression, working build containers
git-svn-id: svn://tug.org/texlive/trunk@47759 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive')
-rw-r--r--Master/tlpkg/TeXLive/TLConfig.pm12
-rw-r--r--Master/tlpkg/TeXLive/TLPOBJ.pm38
-rw-r--r--Master/tlpkg/TeXLive/TLUtils.pm13
3 files changed, 34 insertions, 29 deletions
diff --git a/Master/tlpkg/TeXLive/TLConfig.pm b/Master/tlpkg/TeXLive/TLConfig.pm
index 71e50e946e7..eeeaa6e425f 100644
--- a/Master/tlpkg/TeXLive/TLConfig.pm
+++ b/Master/tlpkg/TeXLive/TLConfig.pm
@@ -24,10 +24,13 @@ BEGIN {
$DefaultCategory
$DefaultContainerFormat
$DefaultContainerExtension
- $AcceptedCompressors
+ @AcceptedCompressors
$AcceptedCompressorsRegexp
%CompressorProgram
+ %DecompressorProgram
%CompressorArgs
+ %DecompressorArgs
+ %CompressorExtension
$InfraLocation
$DatabaseName
$PackageBackupDir
@@ -112,8 +115,11 @@ our $DefaultContainerFormat = "xz";
our $DefaultContainerExtension = "tar.$DefaultContainerFormat";
our @AcceptedCompressors = qw/xz lz4/;
our $AcceptedCompressorsRegexp = "(xz|lz4)";
-our %CompressorProgram = ( 'xz' => 'xzdec', 'lz4' => 'lz4' );
-our %CompressorArgs = ( 'xz' => '', 'lz4' => '-dcf');
+our %CompressorProgram = ( 'xz' => 'xz', 'lz4' => 'lz4' );
+our %CompressorExtension = ( 'xz' => 'xz', 'lz4' => 'lz4' );
+our %CompressorArgs = ( 'xz' => ['-zf'], 'lz4' => ['-zf', '--rm', '-q']);
+our %DecompressorProgram = ( 'xz' => 'xz', 'lz4' => 'lz4' );
+our %DecompressorArgs = ( 'xz' => ['-dcf'], 'lz4' => ['-dcf']);
# archive (not user) settings.
# these can be overridden by putting them into 00texlive.config.tlpsrc
diff --git a/Master/tlpkg/TeXLive/TLPOBJ.pm b/Master/tlpkg/TeXLive/TLPOBJ.pm
index c662596f43a..ca1d1100931 100644
--- a/Master/tlpkg/TeXLive/TLPOBJ.pm
+++ b/Master/tlpkg/TeXLive/TLPOBJ.pm
@@ -12,6 +12,7 @@ sub module_revision { return $_modulerevision; }
use TeXLive::TLConfig qw($DefaultCategory $CategoriesRegexp
$MetaCategoriesRegexp $InfraLocation
+ @AcceptedCompressors %CompressorArgs %CompressorProgram %CompressorExtension
$RelocPrefix $RelocTree);
use TeXLive::TLCrypto;
use TeXLive::TLTREE;
@@ -558,8 +559,8 @@ sub common_texmf_tree {
sub make_container {
my ($self,$type,$instroot,$destdir,$containername,$relative) = @_;
- if (($type ne "xz") && ($type ne "tar")) {
- die "$0: TLPOBJ supports tar and xz containers, not $type";
+ if (!TeXLive::TLUtils::member($type, @AcceptedCompressors)) {
+ die "$0: TLPOBJ supports @AcceptedCompressors containers, not $type";
}
if (!defined($containername)) {
$containername = $self->name;
@@ -622,25 +623,22 @@ sub make_container {
close(TMP);
push(@files, "$tlpobjdir/$self->{'name'}.tlpobj");
$tarname = "$containername.tar";
- if ($type eq "tar") {
- $containername = $tarname;
- } else {
- $containername = "$tarname.xz";
- }
# start the fun
my $tar = $::progs{'tar'};
- my $xz;
if (!defined($tar)) {
tlwarn("$0: programs not set up, trying \"tar\".\n");
$tar = "tar";
}
- if ($type eq "xz") {
- $xz = $::progs{'xz'};
- if (!defined($xz)) {
- tlwarn("$0: programs not set up, trying \"xz\".\n");
- $xz = "xz";
- }
+ my $compressor = $::progs{$CompressorProgram{$type}};
+ my @compressorargs = @{$CompressorArgs{$type}};
+ my $compressorextension = $CompressorExtension{$type};
+ $containername = "$tarname.$compressorextension";
+ debug("selected compressor: $compressor with @compressorargs\n");
+ if (!defined($compressor)) {
+ # fall back to $type as compressor, but that shouldn't happen
+ tlwarn("$0: programs not set up, trying \"$type\".\n");
+ $compressor = $type;
}
# Here we need to distinguish between making the master containers for
@@ -721,13 +719,11 @@ sub make_container {
xsystem(@cmdline);
# compress it.
- if ($type eq "xz") {
- if (-r "$destdir/$tarname") {
- system($xz, "--force", "-z", "$destdir/$tarname");
- } else {
- tlwarn("$0: Couldn't find $destdir/$tarname to run $xz\n");
- return (0, 0, "");
- }
+ if (-r "$destdir/$tarname") {
+ system($compressor, @compressorargs, "$destdir/$tarname");
+ } else {
+ tlwarn("$0: Couldn't find $destdir/$tarname to run $xz\n");
+ return (0, 0, "");
}
# compute the size.
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm
index 476ebf5b5ef..4a5aebbb304 100644
--- a/Master/tlpkg/TeXLive/TLUtils.pm
+++ b/Master/tlpkg/TeXLive/TLUtils.pm
@@ -2147,7 +2147,7 @@ sub unpack {
# wget is again checked by download file
# my $wget = $::progs{'wget'};
# only check the necessary compressor program
- my $decompressor = TeXLive::TLUtils::quotify_path_with_spaces($::progs{$CompressorProgram{$type}});
+ my $decompressor = TeXLive::TLUtils::quotify_path_with_spaces($::progs{$DecompressorProgram{$type}});
my $decompressorArgs = $::progs{$DecompressorArgs{$type}};
if (!defined($decompressor)) {
return (0, "programs not set up properly");
@@ -2156,6 +2156,7 @@ sub unpack {
my $fn = basename($what);
my $pkg = $fn;
+ # TODO use %CompressorExtensions here!!!
$pkg =~ s/\.tar\.$AcceptedCompressorsRegexp$//;
my $tarfile;
my $remove_containerfile = $remove;
@@ -2327,13 +2328,15 @@ sub setup_programs {
$::progs{'xzdec'} = "xzdec";
$::progs{'xz'} = "xz";
$::progs{'tar'} = "tar";
+ $::progs{'lz4'} = "lz4";
if ($^O =~ /^MSWin/i) {
- $::progs{'wget'} = conv_to_w32_path("$bindir/wget/wget.exe");
- $::progs{'tar'} = conv_to_w32_path("$bindir/tar.exe");
+ $::progs{'wget'} = conv_to_w32_path("$bindir/wget/wget.exe");
+ $::progs{'tar'} = conv_to_w32_path("$bindir/tar.exe");
$::progs{'xzdec'} = conv_to_w32_path("$bindir/xz/xzdec.exe");
$::progs{'xz'} = conv_to_w32_path("$bindir/xz/xz.exe");
- for my $prog ("xzdec", "wget") {
+ $::progs{'lz4'} = conv_to_w32_path("$bindir/lz4/lz4.exe");
+ for my $prog ("xzdec", "wget", "lz4") {
my $opt = $prog eq "xzdec" ? "--help" : "--version";
my $ret = system("$::progs{$prog} $opt >nul 2>&1"); # on windows
if ($ret != 0) {
@@ -2359,7 +2362,7 @@ sub setup_programs {
$s += setup_unix_one('xzdec',"$bindir/xz/xzdec.$platform","--help");
$s += setup_unix_one('xz', "$bindir/xz/xz.$platform", "notest");
$s += setup_unix_one('lz4', "$bindir/lz4/lz4.$platform", "--version");
- $ok = ($s == 3); # failure return unless all are present.
+ $ok = ($s == 4); # failure return unless all are present.
}
return $ok;