about summary refs log tree commit diff
path: root/scripts/readmanifest.pm.in
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/readmanifest.pm.in')
-rw-r--r--scripts/readmanifest.pm.in18
1 files changed, 15 insertions, 3 deletions
diff --git a/scripts/readmanifest.pm.in b/scripts/readmanifest.pm.in
index 0d14ffd1baeb..fa4ac65ac820 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";