Fix parallel xz compression

This commit is contained in:
Johannes 'josch' Schauer 2019-11-29 08:51:10 +01:00
parent aad36777e8
commit 9f2ea61265
Signed by: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -161,7 +161,7 @@ sub get_tar_compressor($) {
} elsif ($filename =~ /\.lz4$/) { } elsif ($filename =~ /\.lz4$/) {
return 'lz4'; return 'lz4';
} elsif ($filename =~ /\.(xz|txz)$/) { } elsif ($filename =~ /\.(xz|txz)$/) {
return 'xz'; return ('xz', '--threads=0');
} elsif ($filename =~ /\.zst$/) { } elsif ($filename =~ /\.zst$/) {
return 'zstd'; return 'zstd';
} }
@ -2443,11 +2443,6 @@ sub main() {
my $exitstatus = 0; my $exitstatus = 0;
my @taropts = ('--sort=name', "--mtime=\@$mtime", '--clamp-mtime', '--numeric-owner', '--one-file-system', '-c', '--exclude=./dev'); my @taropts = ('--sort=name', "--mtime=\@$mtime", '--clamp-mtime', '--numeric-owner', '--one-file-system', '-c', '--exclude=./dev');
# Use parallel xz compression
if (defined $tar_compressor and $tar_compressor eq 'xz') {
push @taropts, '-Ixz --threads=0'
}
# disable signals so that we can fork and change behaviour of the signal # disable signals so that we can fork and change behaviour of the signal
# handler in the parent and child without getting interrupted # handler in the parent and child without getting interrupted
my $sigset = POSIX::SigSet->new(SIGINT, SIGHUP, SIGPIPE, SIGTERM); my $sigset = POSIX::SigSet->new(SIGINT, SIGHUP, SIGPIPE, SIGTERM);