diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2005-02-24 17:36:42 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2005-02-24 17:36:42 +0000 |
commit | 3259ae58119b93ca48a267ec90d7e1efb929fef8 (patch) | |
tree | 742731d8af77c491ddfb2c7100a3be1f4a4511a2 /scripts/readmanifest.pm.in | |
parent | 95e870a113e98bf23222535d842e525021a15f10 (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/readmanifest.pm.in')
-rw-r--r-- | scripts/readmanifest.pm.in | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/scripts/readmanifest.pm.in b/scripts/readmanifest.pm.in index 0d14ffd1b..fa4ac65ac 100644 --- a/scripts/readmanifest.pm.in +++ b/scripts/readmanifest.pm.in @@ -52,6 +52,7 @@ sub readManifest { my $narHash; my $references; my $deriver; + my $hashAlgo; while (<MANIFEST>) { chomp; @@ -75,6 +76,7 @@ sub readManifest { undef $patchType; $references = ""; $deriver = ""; + $hashAlgo = "md5"; } } else { @@ -104,7 +106,7 @@ sub readManifest { push @{$narFileList}, { url => $url, hash => $hash, size => $size , narHash => $narHash, references => $references - , deriver => $deriver + , deriver => $deriver, hashAlgo => $hashAlgo }; } @@ -119,12 +121,14 @@ sub readManifest { { url => $url, hash => $hash, size => $size , basePath => $basePath, baseHash => $baseHash , narHash => $narHash, patchType => $patchType + , hashAlgo => $hashAlgo }; } } elsif (/^\s*StorePath:\s*(\/\S+)\s*$/) { $storePath = $1; } + elsif (/^\s*HashAlgo:\s*(\S+)\s*$/) { $hashAlgo = $1; } elsif (/^\s*Hash:\s*(\S+)\s*$/) { $hash = $1; } elsif (/^\s*URL:\s*(\S+)\s*$/) { $url = $1; } elsif (/^\s*Size:\s*(\d+)\s*$/) { $size = $1; } @@ -162,7 +166,11 @@ sub writeManifest print MANIFEST " StorePath: $storePath\n"; print MANIFEST " HashAlgo: $narFile->{hashAlgo}\n"; print MANIFEST " NarURL: $narFile->{url}\n"; - print MANIFEST " MD5: $narFile->{hash}\n"; + if ($narFile->{hashAlgo} eq "md5") { + print MANIFEST " MD5: $narFile->{hash}\n"; + } else { + print MANIFEST " Hash: $narFile->{hash}\n"; + } print MANIFEST " NarHash: $narFile->{narHash}\n"; print MANIFEST " Size: $narFile->{size}\n"; print MANIFEST " References: $narFile->{references}\n" @@ -180,7 +188,11 @@ sub writeManifest print MANIFEST " StorePath: $storePath\n"; print MANIFEST " HashAlgo: $patch->{hashAlgo}\n"; print MANIFEST " NarURL: $patch->{url}\n"; - print MANIFEST " MD5: $patch->{hash}\n"; + if ($patch->{hashAlgo} eq "md5") { + print MANIFEST " MD5: $patch->{hash}\n"; + } else { + print MANIFEST " Hash: $patch->{hash}\n"; + } print MANIFEST " NarHash: $patch->{narHash}\n"; print MANIFEST " Size: $patch->{size}\n"; print MANIFEST " BasePath: $patch->{basePath}\n"; |