texlive[47763] Master: more lz4 support, can now be selected via
commits+preining at tug.org
commits+preining at tug.org
Sat May 19 01:47:19 CEST 2018
Revision: 47763
http://tug.org/svn/texlive?view=revision&revision=47763
Author: preining
Date: 2018-05-19 01:47:18 +0200 (Sat, 19 May 2018)
Log Message:
-----------
more lz4 support, can now be selected via TEXLIVE_COMPRESSOR=lz4
Modified Paths:
--------------
trunk/Master/texmf-dist/scripts/texlive/tlmgr.pl
trunk/Master/tlpkg/TeXLive/TLPDB.pm
trunk/Master/tlpkg/TeXLive/TLUtils.pm
Modified: trunk/Master/texmf-dist/scripts/texlive/tlmgr.pl
===================================================================
--- trunk/Master/texmf-dist/scripts/texlive/tlmgr.pl 2018-05-18 23:47:11 UTC (rev 47762)
+++ trunk/Master/texmf-dist/scripts/texlive/tlmgr.pl 2018-05-18 23:47:18 UTC (rev 47763)
@@ -1091,7 +1091,8 @@
return($F_WARNING);
}
if ($opts{"backup"}) {
- $tlp->make_container("xz", $localtlpdb->root,
+ my ($compressor, $compressorextension) = TeXLive::TLUtils::setup_compressor();
+ $tlp->make_container($compressor, $localtlpdb->root,
$opts{"backupdir"},
"${pkg}.r" . $tlp->revision,
$tlp->relocated);
@@ -1804,9 +1805,13 @@
my ($pkg, $rev, $bd) = @_;
# first remove the package, then reinstall it
# this way we get rid of useless files
- my $restore_file = "$bd/${pkg}.r${rev}.tar.xz";
- if (! -r $restore_file) {
- tlwarn("$prg: Cannot read $restore_file, no action taken\n");
+ my $restore_file;
+ for my $comptype (@AcceptedCompressors) {
+ my $ext = $CompressorExtension{$comptype};
+ $restore_file = "$bd/${pkg}.r${rev}.tar.$ext" if (-r "$bd/${pkg}.r${rev}.tar.$ext");
+ }
+ if (!$restore_file) {
+ tlwarn("$prg: Cannot find restore file $bd/${pkg}.r${rev}.tar.*, no action taken\n");
return ($F_ERROR);
}
$localtlpdb->remove_package($pkg);
@@ -2137,15 +2142,7 @@
clear_old_backups ($pkg, $opts{"backupdir"}, $opts{"clean"}, $opts{"dry-run"}, 1);
} else {
# for now default to xz and allow overriding with env var
- my $compressor = "xz";
- if ($ENV{'TEXLIVE_COMPRESSOR'}) {
- if (TeXLive::TLUtils::member($ENV{'TEXLIVE_COMPRESSOR'}, @TeXLive::TLConfig::AcceptedCompressors)) {
- $compressor = $ENV{'TEXLIVE_COMPRESSOR'};
- } else {
- tlwarn("$prog: unknown compressor in TEXLIVE_COMPRESSOR=$ENV{'TEXLIVE_COMPRESSOR'}, falling back to xz\n");
- }
- }
- my $compressorextension = $TeXLive::TLConfig::CompressorExtension{$compressor};
+ my ($compressor, $compressorextension) = TeXLive::TLUtils::setup_compressor();
my $tlp = $localtlpdb->get_package($pkg);
info("saving current status of $pkg to $opts{'backupdir'}/${pkg}.r" .
$tlp->revision . ".tar.$compressorextension\n");
@@ -3181,11 +3178,12 @@
}
if ($opts{"backup"} && !$opts{"dry-run"}) {
- $tlp->make_container("xz", $root,
+ my ($compressor, $compressorextension) = TeXLive::TLUtils::setup_compressor();
+ $tlp->make_container($compressor, $root,
$opts{"backupdir"}, "${pkg}.r" . $tlp->revision,
$tlp->relocated);
$unwind_package =
- "$opts{'backupdir'}/${pkg}.r" . $tlp->revision . ".tar.xz";
+ "$opts{'backupdir'}/${pkg}.r" . $tlp->revision . ".tar.$compressorextension";
if ($autobackup) {
# in case we do auto backups we remove older backups
Modified: trunk/Master/tlpkg/TeXLive/TLPDB.pm
===================================================================
--- trunk/Master/tlpkg/TeXLive/TLPDB.pm 2018-05-18 23:47:11 UTC (rev 47762)
+++ trunk/Master/tlpkg/TeXLive/TLPDB.pm 2018-05-18 23:47:18 UTC (rev 47763)
@@ -1891,14 +1891,14 @@
if ($media eq 'local_uncompressed') {
$container = \@installfiles;
} elsif ($media eq 'local_compressed') {
- for my $ext (@AcceptedCompressors) {
+ for my $ext (@TeXLive::TLConfig::AcceptedCompressors) {
if (-r "$root/$Archive/$pkg.tar.$ext") {
$container = "$root/$Archive/$pkg.tar.$ext";
}
}
if (!$container) {
- tlwarn("TLPDB: cannot find package $pkg.tar.$AcceptedCompressorsRegexp in $root/$Archive\n");
- next;
+ tlwarn("TLPDB: cannot find package $pkg.tar.$TeXLive::TLConfig::AcceptedCompressorsRegexp in $root/$Archive\n");
+ return(0);
}
} elsif (&media eq 'NET') {
$container = "$root/$Archive/$pkg.$TeXLive::TLConfig::DefaultContainerExtension";
@@ -1921,13 +1921,13 @@
# - there are actually src/doc files present
if ($container_src_split && $opt_src && $tlpobj->srcfiles) {
my $srccontainer = $container;
- $srccontainer =~ s/\.tar\.$AcceptedCompressorRegexp$/.source$1/;
+ $srccontainer =~ s/\.tar\.$TeXLive::TLConfig::AcceptedCompressorsRegexp$/.source.tar.$1/;
$self->_install_data ($srccontainer, $reloc, \@installfiles, $totlpdb, $tlpobj->srccontainersize, $tlpobj->srccontainerchecksum)
|| return(0);
}
if ($container_doc_split && $real_opt_doc && $tlpobj->docfiles) {
my $doccontainer = $container;
- $doccontainer =~ s/\.tar\.$AcceptedCompressorRegexp$/.doc$1/;
+ $doccontainer =~ s/\.tar\.$TeXLive::TLConfig::AcceptedCompressorsRegexp$/.doc.tar.$1/;
$self->_install_data ($doccontainer, $reloc, \@installfiles, $totlpdb, $tlpobj->doccontainersize, $tlpobj->doccontainerchecksum)
|| return(0);
}
@@ -2055,7 +2055,7 @@
}
# we always assume that copy will work
return(1);
- } elsif ($what =~ m,\.tar\.$AcceptedCompressorsRegexp$,) {
+ } elsif ($what =~ m,\.tar\.$TeXLive::TLConfig::AcceptedCompressorsRegexp$,) {
if ($reloc) {
if (!$totlpdb->setting("usertree")) {
$target .= "/$TeXLive::TLConfig::RelocTree";
Modified: trunk/Master/tlpkg/TeXLive/TLUtils.pm
===================================================================
--- trunk/Master/tlpkg/TeXLive/TLUtils.pm 2018-05-18 23:47:11 UTC (rev 47762)
+++ trunk/Master/tlpkg/TeXLive/TLUtils.pm 2018-05-18 23:47:18 UTC (rev 47763)
@@ -56,6 +56,7 @@
TeXLive::TLUtils::removed_dirs(@files);
TeXLive::TLUtils::download_file($path, $destination [, $progs ]);
TeXLive::TLUtils::setup_programs($bindir, $platform);
+ TeXLive::TLUtils::setup_compressor();
TeXLive::TLUtils::tlcmp($file, $file);
TeXLive::TLUtils::nulldev();
TeXLive::TLUtils::get_full_line($fh);
@@ -199,7 +200,7 @@
&True
&False
);
- @EXPORT = qw(setup_programs download_file process_logging_options
+ @EXPORT = qw(setup_programs setup_compressor download_file process_logging_options
tldie tlwarn info log debug ddebug dddebug debug_hash
win32 xchdir xsystem run_cmd sort_archs);
}
@@ -2478,6 +2479,30 @@
return 1;
}
+
+=item C<setup_compressor()>
+
+Setup compression method for containers.
+
+=cut
+
+# TODO TODO needs improvement, check also whether compressor prog is available!!!
+sub setup_compressor {
+ print "DEBUG: entering select compressor\n";
+ my $compressor = "xz";
+ if ($ENV{'TEXLIVE_COMPRESSOR'}) {
+ if (TeXLive::TLUtils::member($ENV{'TEXLIVE_COMPRESSOR'}, @TeXLive::TLConfig::AcceptedCompressors)) {
+ $compressor = $ENV{'TEXLIVE_COMPRESSOR'};
+ } else {
+ tlwarn("$prog: unknown compressor in TEXLIVE_COMPRESSOR=$ENV{'TEXLIVE_COMPRESSOR'}, falling back to xz\n");
+ }
+ }
+ my $compressorextension = $TeXLive::TLConfig::CompressorExtension{$compressor};
+ print "DEBUG: selected compressor $compressor\n";
+ return ($compressor, $compressorextension);
+}
+
+
=item C<download_file( $relpath, $destination [, $progs ] )>
Try to download the file given in C<$relpath> from C<$TeXLiveURL>
More information about the tex-live-commits
mailing list