1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-28 22:01:15 +02:00

Support xz compression in the download-using-manifests substituter

This commit is contained in:
Eelco Dolstra 2012-09-19 17:33:42 -04:00
parent 00092b2d35
commit 20582e9ae3
3 changed files with 21 additions and 8 deletions

View file

@ -339,13 +339,19 @@ while (scalar @path > 0) {
print LOGFILE "$$ narfile $narFile->{url} $size $v\n";
Nix::Utils::checkURL $narFile->{url};
my $decompressor =
$narFile->{compressionType} eq "bzip2" ? "$Nix::Config::bzip2 -d" :
$narFile->{compressionType} eq "xz" ? "$Nix::Config::xz -d" :
die "unknown compression type `$narFile->{compressionType}'";
if ($curStep < $maxStep) {
# The archive will be used a base to a patch.
system("$curl '$narFile->{url}' | $Nix::Config::bzip2 -d > $tmpNar") == 0
system("$curl '$narFile->{url}' | $decompressor > $tmpNar") == 0
or die "cannot download and unpack `$narFile->{url}' into `$v'\n";
} else {
# Unpack the archive into the target path.
system("$curl '$narFile->{url}' | $Nix::Config::bzip2 -d | $Nix::Config::binDir/nix-store --restore '$v'") == 0
system("$curl '$narFile->{url}' | $decompressor | $Nix::Config::binDir/nix-store --restore '$v'") == 0
or die "cannot download and unpack `$narFile->{url}' into `$v'\n";
}

View file

@ -227,6 +227,7 @@ for (my $n = 0; $n < scalar @storePaths; $n++) {
{ url => "$archivesURL/$narName"
, hash => "sha256:$compressedHash"
, size => $compressedSize
, compressionType => $compressionType
, narHash => "$narHash"
, narSize => $narSize
, references => join(" ", @{$refs})