about summary refs log tree commit diff
path: root/scripts/download-using-manifests.pl.in
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-09-19T21·33-0400
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-09-19T21·33-0400
commit20582e9ae3c6eb14212a285489c1a573117d046c (patch)
tree59e9e6f03f40b3408ddbe7cbb3f49699e7c7591f /scripts/download-using-manifests.pl.in
parent00092b2d356293a7af9d4d8125a689f90c461591 (diff)
Support xz compression in the download-using-manifests substituter
Diffstat (limited to 'scripts/download-using-manifests.pl.in')
-rwxr-xr-xscripts/download-using-manifests.pl.in10
1 files changed, 8 insertions, 2 deletions
diff --git a/scripts/download-using-manifests.pl.in b/scripts/download-using-manifests.pl.in
index 24f7c98e0cb9..7a76076d7a80 100755
--- a/scripts/download-using-manifests.pl.in
+++ b/scripts/download-using-manifests.pl.in
@@ -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";
         }