Merge of change to merge_csv.pl change. Caused by moving of the Repo: No files changed.
authorMatt Davies <mattd@symbian.org>
Fri, 29 May 2009 14:58:58 +0100
changeset 122 5639fead6fba
parent 121 fc757bffbe1d (diff)
parent 120 73ffd91709ee (current diff)
child 124 6c171c40e012
child 127 5274345d5497
Merge of change to merge_csv.pl change. Caused by moving of the Repo: No files changed.
--- a/common/tools/analysis/merge_csv.pl	Fri May 29 13:17:14 2009 +0100
+++ b/common/tools/analysis/merge_csv.pl	Fri May 29 14:58:58 2009 +0100
@@ -17,7 +17,7 @@
 use strict;
 my $csvfile = shift @ARGV;
 my $filelist = shift @ARGV;
-
+my $zipfile = shift @ARGV;
 
 if(! -e $csvfile)
 {
@@ -29,7 +29,28 @@
 {
   die "Cannot find $filelist\n";
 }
+        my %ziptimes;
+        if(defined $zipfile)
+          {
+          open(ZIP,"7z l $zipfile 2>&1|")  or die "Error: Couldn't look in $zipfile\n";
+#          print "time,file\n";
+          while( my $line = <ZIP>)
+            {
+            if($line =~ m/^(\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2})\s\S{5}\s+(\d+)\s+\d+\s+(.+)$/) #ignoring packed size...
+              {
+              my $name = $3;
+              my $size = $2;
+              my $time = $1;
+              $name =~ s/\\/\//g;
+              $name = lc($name);
+              $ziptimes{$name} = $time;
+#              print "$time,$name\n";
+              }
+            }
+          close ZIP;
+          }
         my %files;
+
         open(FILES,"<$filelist") or die "Couldn't open $filelist\n";
         while(my $line = <FILES>)
         {
@@ -44,7 +65,7 @@
                 if($files{$file})
                 {
            
-                    $files{$file} = $files{$file}.",".$group;                                        
+                    $files{$file} = $files{$file}." ".$group; #Stop polluting next column                                        
                        print "Multi:$file".$files{$file}."\n";
 
                 }
@@ -61,7 +82,7 @@
         open(RESULTS,">$resultsfile") or die "Couldn't open write to $resultsfile\n";
         my $header = <CSV>;
         $header =~ s/\n//;
-        print RESULTS $header.",status\n";
+        print RESULTS $header.",status,time\n";
         my @fields = split(',',$header);
         my $targetindex = 0;
         my $counter = 0;
@@ -93,9 +114,10 @@
             {
               $bldinffiles{$bldinf} = 1;
             }
- 
+            my $found = 0; 
             if(defined $files{$target})
-                {                    
+                {
+                    $found = 1;                    
                     $line = $line.$files{$target};
                     if($files{$target} =~ m/fail/i)
                     {
@@ -105,6 +127,17 @@
                       }
                     }
                 }
+            if(defined $ziptimes{$target})
+              {
+                if($found)
+                {
+                  $line = $line.",".$ziptimes{$target};
+                }
+                else
+                {
+                  $line = $line.",,".$ziptimes{$target};
+                }
+              }     
             print RESULTS $line."\n";
             
             }