about summary refs log tree commit diff
path: root/scripts/generate-patches.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/generate-patches.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/generate-patches.pl.in')
-rwxr-xr-xscripts/generate-patches.pl.in13
1 files changed, 7 insertions, 6 deletions
diff --git a/scripts/generate-patches.pl.in b/scripts/generate-patches.pl.in
index cf9e241410d5..ef4ddcda4af5 100755
--- a/scripts/generate-patches.pl.in
+++ b/scripts/generate-patches.pl.in
@@ -45,6 +45,7 @@ sub findOutputPaths {
 
         # Ignore store expressions.
         next if ($p =~ /\.store$/);
+        next if ($p =~ /\.drv$/);
         
         # Ignore builders (too much ambiguity -- they're all called
         # `builder.sh').
@@ -69,7 +70,7 @@ my %dstOutPaths = findOutputPaths \%dstNarFiles, \%dstSuccessors;
 
 sub getNameVersion {
     my $p = shift;
-    $p =~ /\/[0-9a-f]+((?:-[a-zA-Z][^\/-]*)+)([^\/]*)$/;
+    $p =~ /\/[0-9a-z]+((?:-[a-zA-Z][^\/-]*)+)([^\/]*)$/;
     my $name = $1;
     my $version = $2;
     $name =~ s/^-//;
@@ -192,16 +193,16 @@ foreach my $p (keys %dstOutPaths) {
         system("@bunzip2@ < $dstNarBz2 > $tmpdir/B") == 0
             or die "cannot unpack $dstNarBz2";
 
-        system("@libexecdir@/bspatch $tmpdir/A $tmpdir/B $tmpdir/DIFF") == 0
+        system("@libexecdir@/bsdiff $tmpdir/A $tmpdir/B $tmpdir/DIFF") == 0
             or die "cannot compute binary diff";
 
-        my $baseHash = `@bindir@/nix-hash --flat $tmpdir/A` or die;
+        my $baseHash = `@bindir@/nix-hash --flat --type sha1 $tmpdir/A` or die;
         chomp $baseHash;
 
-        my $narHash = `@bindir@/nix-hash --flat $tmpdir/B` or die;
+        my $narHash = `@bindir@/nix-hash --flat --type sha1 $tmpdir/B` or die;
         chomp $narHash;
 
-        my $narDiffHash = `@bindir@/nix-hash --flat $tmpdir/DIFF` or die;
+        my $narDiffHash = `@bindir@/nix-hash --flat --type sha1 $tmpdir/DIFF` or die;
         chomp $narDiffHash;
 
         my $narDiffSize = (stat "$tmpdir/DIFF")[7];
@@ -234,7 +235,7 @@ foreach my $p (keys %dstOutPaths) {
         # Add the patch to the manifest.
         addPatch \%dstPatches, $p,
             { url => "$patchesURL/$finalName", hash => $narDiffHash
-            , size => $narDiffSize
+            , size => $narDiffSize, hashAlgo => "sha1"
             , basePath => $closest, baseHash => $baseHash
             , narHash => $narHash, patchType => "nar-bsdiff"
             };