results2html: Add SHA-1 and SHA-256 to .tar.gz build products.
authorBen Pfaff <blp@cs.stanford.edu>
Thu, 13 Feb 2014 05:00:23 +0000 (21:00 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Thu, 13 Feb 2014 05:00:23 +0000 (21:00 -0800)
Requested by John Darrington because guix requires a sha256 of the source
trees that it downloads.

results2html

index a5a7688e5a8b040e534be21267409628eb6f635b..1e8ea802226110c44f73f6b883ddd2b288e2bbdd 100755 (executable)
@@ -3,6 +3,7 @@
 use strict;
 use warnings;
 
+use Digest::SHA;
 use File::Spec;
 use HTML::Entities qw();
 use URI::Escape;
@@ -175,7 +176,17 @@ foreach my $p (@products) {
     print INDEX encode_entities ($p->{NAME}), ": " if defined ($p->{NAME});
     print INDEX "<a href=\"", encode_entities ($p->{HREF}), "\">";
     print INDEX encode_entities ($p->{PRODUCT});
-    print INDEX "</a></li>\n";
+    print INDEX "</a>\n";
+    if ($p->{PRODUCT} =~ /\.tar\.gz$/) {
+       my $sha = Digest::SHA->new(1);
+       $sha->addfile($p->{PRODUCT});
+       print INDEX "<br>sha1: ", $sha->hexdigest, "\n";
+
+       $sha = Digest::SHA->new(256);
+       $sha->addfile($p->{PRODUCT});
+       print INDEX "<br>sha256: ", $sha->hexdigest, "\n";
+    }
+    print INDEX "</li>\n";
 }
 print INDEX "</ul>\n";