summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2018-05-18 23:47:18 +0000
committerNorbert Preining <preining@logic.at>2018-05-18 23:47:18 +0000
commit3bc15870dc56d0f9d864db0c9b417b400ac7639f (patch)
tree20f298237ea2e91425a34e5caa460a76fe27cca9 /Master
parent3a86322b73c7a5688f1eba0f5edebd42255ff294 (diff)
more lz4 support, can now be selected via TEXLIVE_COMPRESSOR=lz4
git-svn-id: svn://tug.org/texlive/trunk@47763 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rwxr-xr-xMaster/texmf-dist/scripts/texlive/tlmgr.pl28
-rw-r--r--Master/tlpkg/TeXLive/TLPDB.pm12
-rw-r--r--Master/tlpkg/TeXLive/TLUtils.pm27
3 files changed, 45 insertions, 22 deletions
diff --git a/Master/texmf-dist/scripts/texlive/tlmgr.pl b/Master/texmf-dist/scripts/texlive/tlmgr.pl
index c514931693e..6b927fd2e70 100755
--- a/Master/texmf-dist/scripts/texlive/tlmgr.pl
+++ b/Master/texmf-dist/scripts/texlive/tlmgr.pl
@@ -1091,7 +1091,8 @@ sub backup_and_remove_package {
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 @@ sub restore_one_package {
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 @@ sub action_backup {
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 @@ sub action_update {
}
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
diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm
index 34e3414b32d..72d6f1e0f82 100644
--- a/Master/tlpkg/TeXLive/TLPDB.pm
+++ b/Master/tlpkg/TeXLive/TLPDB.pm
@@ -1891,14 +1891,14 @@ sub not_virtual_install_package {
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 @@ sub not_virtual_install_package {
# - 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 @@ sub _install_data {
}
# 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";
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm
index b92f5cc28e1..641c1986379 100644
--- a/Master/tlpkg/TeXLive/TLUtils.pm
+++ b/Master/tlpkg/TeXLive/TLUtils.pm
@@ -56,6 +56,7 @@ C<TeXLive::TLUtils> -- utilities used in TeX Live infrastructure
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 @@ BEGIN {
&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 @@ sub setup_unix_one {
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>