From 8a183473880d35d01df3cc03402814a03a0bc131 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Fri, 18 May 2018 23:47:04 +0000 Subject: tlmgr initial support for lz4 backups git-svn-id: svn://tug.org/texlive/trunk@47761 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/scripts/texlive/tlmgr.pl | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'Master/texmf-dist/scripts') diff --git a/Master/texmf-dist/scripts/texlive/tlmgr.pl b/Master/texmf-dist/scripts/texlive/tlmgr.pl index b15bbd54a36..51b1679effe 100755 --- a/Master/texmf-dist/scripts/texlive/tlmgr.pl +++ b/Master/texmf-dist/scripts/texlive/tlmgr.pl @@ -1761,7 +1761,15 @@ sub get_available_backups { # for my $dirent (@dirents) { next if (-d $dirent); - next if ($dirent !~ m/^(.*)\.r([0-9]+)\.tar\.xz$/); + my $has_accepted_compressiontype = 0; + for my $comptype (@AcceptedCompressors) { + my $ext = $CompressorExtension{$comptype}; + $has_accepted_compressiontype = 1 if ($dirent =~ m/\.tar\.$ext$/); + } + next if (!$has_accepted_compressiontype); + if ($dirent !~ m/^(.*)\.r([0-9]+)\.tar\.(.*)$/) { + next; + } if (!$do_stat) { $backups{$1}->{$2} = 1; next; @@ -1938,7 +1946,7 @@ sub action_restore { for my $p (sort keys %backups) { my @tmp = sort {$b <=> $a} (keys %{$backups{$p}}); my $rev = $tmp[0]; - print "Restoring $p, $rev from $opts{'backupdir'}/${p}.r${rev}.tar.xz\n"; + print "Restoring $p, $rev from $opts{'backupdir'}/${p}.r${rev}.tar.*\n"; if (!$opts{"dry-run"}) { # first remove the package, then reinstall it # this way we get rid of useless files @@ -2128,11 +2136,12 @@ sub action_backup { if ($clean_mode) { clear_old_backups ($pkg, $opts{"backupdir"}, $opts{"clean"}, $opts{"dry-run"}, 1); } else { + my $compressorextension = $TeXLive::TLConfig::CompressorExtension{'lz4'}; my $tlp = $localtlpdb->get_package($pkg); info("saving current status of $pkg to $opts{'backupdir'}/${pkg}.r" . - $tlp->revision . ".tar.xz\n"); + $tlp->revision . ".tar.$compressorextension\n"); if (!$opts{"dry-run"}) { - $tlp->make_container("xz", $localtlpdb->root, + $tlp->make_container("lz4", $localtlpdb->root, $opts{"backupdir"}, "${pkg}.r" . $tlp->revision); } } -- cgit v1.2.3