texlive[47759] Master/tlpkg/TeXLive: more work on lz4 compression,
commits+preining at tug.org
commits+preining at tug.org
Sat May 19 01:46:50 CEST 2018
Revision: 47759
http://tug.org/svn/texlive?view=revision&revision=47759
Author: preining
Date: 2018-05-19 01:46:50 +0200 (Sat, 19 May 2018)
Log Message:
-----------
more work on lz4 compression, working build containers
Modified Paths:
--------------
trunk/Master/tlpkg/TeXLive/TLConfig.pm
trunk/Master/tlpkg/TeXLive/TLPOBJ.pm
trunk/Master/tlpkg/TeXLive/TLUtils.pm
Modified: trunk/Master/tlpkg/TeXLive/TLConfig.pm
===================================================================
--- trunk/Master/tlpkg/TeXLive/TLConfig.pm 2018-05-18 23:46:42 UTC (rev 47758)
+++ trunk/Master/tlpkg/TeXLive/TLConfig.pm 2018-05-18 23:46:50 UTC (rev 47759)
@@ -24,10 +24,13 @@
$DefaultCategory
$DefaultContainerFormat
$DefaultContainerExtension
- $AcceptedCompressors
+ @AcceptedCompressors
$AcceptedCompressorsRegexp
%CompressorProgram
+ %DecompressorProgram
%CompressorArgs
+ %DecompressorArgs
+ %CompressorExtension
$InfraLocation
$DatabaseName
$PackageBackupDir
@@ -112,8 +115,11 @@
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
Modified: trunk/Master/tlpkg/TeXLive/TLPOBJ.pm
===================================================================
--- trunk/Master/tlpkg/TeXLive/TLPOBJ.pm 2018-05-18 23:46:42 UTC (rev 47758)
+++ trunk/Master/tlpkg/TeXLive/TLPOBJ.pm 2018-05-18 23:46:50 UTC (rev 47759)
@@ -12,6 +12,7 @@
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 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 @@
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 @@
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.
Modified: trunk/Master/tlpkg/TeXLive/TLUtils.pm
===================================================================
--- trunk/Master/tlpkg/TeXLive/TLUtils.pm 2018-05-18 23:46:42 UTC (rev 47758)
+++ trunk/Master/tlpkg/TeXLive/TLUtils.pm 2018-05-18 23:46:50 UTC (rev 47759)
@@ -2147,7 +2147,7 @@
# 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 @@
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 @@
$::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 @@
$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;
More information about the tex-live-commits
mailing list