src/hg/encode/encodeDownloadsPage/encodeDownloadsPage.pl 1.22

1.22 2010/01/12 03:02:20 kate
Create md5sum.txt file
Index: src/hg/encode/encodeDownloadsPage/encodeDownloadsPage.pl
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/encode/encodeDownloadsPage/encodeDownloadsPage.pl,v
retrieving revision 1.21
retrieving revision 1.22
diff -b -B -U 4 -r1.21 -r1.22
--- src/hg/encode/encodeDownloadsPage/encodeDownloadsPage.pl	2 Nov 2009 19:48:55 -0000	1.21
+++ src/hg/encode/encodeDownloadsPage/encodeDownloadsPage.pl	12 Jan 2010 03:02:20 -0000	1.22
@@ -31,13 +31,15 @@
     $opt_db
     $opt_verbose
     /;
 
+our $checksumFile = "md5sum.txt";
+
 sub usage {
     print STDERR <<END;
 usage: hgEncodeDownloads.pl {index.html} [downloads-dir]
 
-Creates the an HTML page listing the downloads in the current directory or optional directory
+Creates an HTML page and README text file listing the downloads in the current directory or optional directory.
 
 options:
     -help               Displays this usage info
     -preamble=file      File containing introductory information (written in HTML) that will be included in this file (default preamble.html)
@@ -295,8 +297,9 @@
 # -rw-rw-r--  1 101M 2008-10-27 14:34 /usr/local/apache/htdocs/goldenPath/hg18/wgEncodeYaleChIPseq/wgEncodeYaleChIPseqSignalK562Pol2.wig.gz
 if(length(@fileList) == 0) {
     die ("ERROR; No files were found in \'$downloadsDir\' that match \'$fileMask\'.\n");
 }
+my @files;      # Stripped down to filenames, for checksumming
 
 # TODO determine whether we should even look this up
 $opt_db = "hg18" if(!defined $opt_db);
 my $db = HgDb->new(DB => $opt_db);
@@ -324,8 +327,9 @@
     my @file = split(/\s+/, $line);      # White space
 #print OUT_FILE join ' ', @file,"\n";
     my @path = split('/', $file[5]);    # split on /
     my $fileName = $path[$#path]; # Last element
+    push @files, $fileName;
     my $tableName = "";
     my $dataType  = "";
     ### Special case for Elnitski BiPs !!!
     my $database = "hg18"; # default
@@ -498,8 +502,16 @@
 print OUT_FILE "</TABLE>\n";
 
 htmlEndPage(*OUT_FILE);
 
+# create file of checksums
+open STDOUT, ">$checksumFile" or die "Cannot open $checksumFile file";
+foreach my $file (@files) {
+    system("md5sum", $file);
+}
+close STDOUT;
+
 chdir $downloadsDir;
 chmod 0775, $indexHtml;
+chmod 0775, $checksumFile;
 
 exit 0;