about summary refs log tree commit diff
path: root/scripts/download-using-manifests.pl.in
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2005-02-24T17·36+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2005-02-24T17·36+0000
commit3259ae58119b93ca48a267ec90d7e1efb929fef8 (patch)
tree742731d8af77c491ddfb2c7100a3be1f4a4511a2 /scripts/download-using-manifests.pl.in
parent95e870a113e98bf23222535d842e525021a15f10 (diff)
* Properly specify the hash algorithm in the manifests, and read it
  too.
* Change the default hash for nix-prefetch-url back to md5, since
  that's what we use in Nixpkgs (for now; a birthday attack is rather
  unlikely there).  

Diffstat (limited to 'scripts/download-using-manifests.pl.in')
-rw-r--r--scripts/download-using-manifests.pl.in8
1 files changed, 5 insertions, 3 deletions
diff --git a/scripts/download-using-manifests.pl.in b/scripts/download-using-manifests.pl.in
index 5698f49ae4aa..890f8787cd91 100644
--- a/scripts/download-using-manifests.pl.in
+++ b/scripts/download-using-manifests.pl.in
@@ -96,7 +96,7 @@ while ($queueFront < scalar @queue) {
         foreach my $patch (@{$patchList}) {
             if (isValidPath($patch->{basePath})) {
                 # !!! this should be cached
-                my $hash = `@bindir@/nix-hash "$patch->{basePath}"`;
+                my $hash = `@bindir@/nix-hash --type '$patch->{hashAlgo}' "$patch->{basePath}"`;
                 chomp $hash;
 #                print "  MY HASH is $hash\n";
                 if ($hash ne $patch->{baseHash}) {
@@ -175,8 +175,10 @@ my $maxStep = scalar @path;
 sub downloadFile {
     my $url = shift;
     my $hash = shift;
+    my $hashAlgo = shift;
     $ENV{"PRINT_PATH"} = 1;
     $ENV{"QUIET"} = 1;
+    $ENV{"NIX_HASH_ALGO"} = $hashAlgo;
     my ($hash2, $path) = `@bindir@/nix-prefetch-url '$url' '$hash'`;
     chomp $hash2;
     chomp $path;
@@ -205,7 +207,7 @@ while (scalar @path > 0) {
 
         # Download the patch.
         print "  downloading patch...\n";
-        my $patchPath = downloadFile "$patch->{url}", "$patch->{hash}";
+        my $patchPath = downloadFile "$patch->{url}", "$patch->{hash}", "$patch->{hashAlgo}";
 
         # Turn the base path into a NAR archive, to which we can
         # actually apply the patch.
@@ -232,7 +234,7 @@ while (scalar @path > 0) {
         
         # Download the archive.
         print "  downloading archive...\n";
-        my $narFilePath = downloadFile "$narFile->{url}", "$narFile->{hash}";
+        my $narFilePath = downloadFile "$narFile->{url}", "$narFile->{hash}", "$narFile->{hashAlgo}";
 
         # Unpack the archive into the target path.
         print "  unpacking archive...\n";