common/tools/analysis/merge_csv_orphans.pl
author Matt Davies <mattd@symbian.org>
Fri, 29 May 2009 17:46:02 +0100
changeset 127 5274345d5497
permissions -rw-r--r--
Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
127
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
     1
#!/usr/bin/perl
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
     2
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
     3
# Copyright (c) 2009 Symbian Foundation Ltd
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
     4
# This component and the accompanying materials are made available
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
     5
# under the terms of the License "Eclipse Public License v1.0"
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
     6
# which accompanies this distribution, and is available
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
     7
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
     8
#
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
     9
# Initial Contributors:
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    10
# Symbian Foundation Ltd - initial contribution.
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    11
# 
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    12
# Contributors:
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    13
#
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    14
# Description:
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    15
# Adds info form a file to a CSV
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    16
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    17
use strict;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    18
my $csvfile = shift @ARGV;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    19
my $filelist = shift @ARGV;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    20
my $zipfile = shift @ARGV;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    21
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    22
if(! -e $csvfile)
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    23
{
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    24
  die "cannot find $csvfile\n";
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    25
}
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    26
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    27
  
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    28
if(!-e $filelist)
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    29
{
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    30
  die "Cannot find $filelist\n";
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    31
}
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    32
        my %ziptimes;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    33
        my %zipused;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    34
        if(defined $zipfile)
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    35
          {
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    36
          open(ZIP,"7z l $zipfile 2>&1|")  or die "Error: Couldn't look in $zipfile\n";
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    37
#          print "time,file\n";
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    38
          while( my $line = <ZIP>)
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    39
            {
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    40
            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...
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    41
              {
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    42
              my $name = $3;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    43
              my $size = $2;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    44
              my $time = $1;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    45
              $name =~ s/\\/\//g;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    46
              $name = lc($name);
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    47
              $ziptimes{$name} = $time;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    48
#              print "$time,$name\n";
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    49
              }
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    50
            }
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    51
          close ZIP;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    52
          }
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    53
        my %files;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    54
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    55
        open(FILES,"<$filelist") or die "Couldn't open $filelist\n";
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    56
        while(my $line = <FILES>)
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    57
        {
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    58
            $line =~ s/\\/\//g;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    59
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    60
            if($line =~ m/^(.+)\s*:\s(.+\S)\s*$/)
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    61
            {
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    62
                my $group = $1;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    63
                my $file = $2;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    64
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    65
                $file = lc($file);
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    66
                if($files{$file})
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    67
                {
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    68
           
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    69
                    $files{$file} = $files{$file}." ".$group; #Stop polluting next column                                        
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    70
                       print "Multi:$file".$files{$file}."\n";
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    71
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    72
                }
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    73
                else
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    74
                {
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    75
                     $files{$file} = ",".$group;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    76
                }
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    77
            }                
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    78
        }
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    79
        close FILE;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    80
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    81
        open(CSV,"<$csvfile") or die "Couldn't open $csvfile\n";
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    82
        my $resultsfile = $csvfile."_results.csv"; 
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    83
        open(RESULTS,">$resultsfile") or die "Couldn't open write to $resultsfile\n";
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    84
        my $header = <CSV>;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    85
        $header =~ s/\n//;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    86
        print RESULTS $header.",status,time\n";
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    87
        my @fields = split(',',$header);
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    88
        my $targetindex = 0;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    89
        my $counter = 0;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    90
        my $bldinfindex = 0;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    91
        my %failed;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    92
        my %bldinffiles;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    93
        foreach my $column (@fields)
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    94
        {
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    95
            if($column =~ m/target/)
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    96
            {
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    97
                $targetindex = $counter;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    98
            }
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    99
            elsif($column =~ m/bldinf/)
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   100
            {
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   101
              $bldinfindex = $counter;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   102
            }
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   103
            ++$counter;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   104
        }
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   105
        ++$counter;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   106
        my $timeindex = $counter;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   107
#        print "\ntarget:$targetindex\tbuildinf:$bldinfindex\n";
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   108
        while(my $line = <CSV>)
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   109
            {
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   110
            $line =~ s/\n//;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   111
            @fields = split(',',$line);
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   112
            my $target = $fields[$targetindex];
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   113
            $target = lc($target);
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   114
            my $bldinf = $fields[$bldinfindex];
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   115
            if(!defined $bldinffiles{$bldinf})
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   116
            {
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   117
              $bldinffiles{$bldinf} = 1;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   118
            }
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   119
            my $found = 0; 
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   120
            if(defined $files{$target})
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   121
                {
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   122
                    $found = 1;                    
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   123
                    $line = $line.$files{$target};
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   124
                    if($files{$target} =~ m/fail/i)
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   125
                    {
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   126
                      if(!defined $failed{$bldinf})
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   127
                      {
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   128
                        $failed{$bldinf} = 1;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   129
                      }
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   130
                    }
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   131
                }
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   132
            if(defined $ziptimes{$target})
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   133
              {
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   134
                $zipused{$target} = 1;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   135
                if($found)
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   136
                {
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   137
                  $line = $line.",".$ziptimes{$target};
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   138
                }
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   139
                else
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   140
                {
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   141
                  $line = $line.",,".$ziptimes{$target};
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   142
                }
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   143
              }     
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   144
            print RESULTS $line."\n";
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   145
            
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   146
            }            
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   147
        close CSV;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   148
        
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   149
        foreach my $target (sort(keys %ziptimes))
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   150
        {
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   151
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   152
          if(!defined $zipused{$target})
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   153
          {
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   154
            my $time = $ziptimes{$target};
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   155
            my $columnCounter=0;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   156
            my @row;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   157
            while($columnCounter <= $counter)
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   158
            {
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   159
              if($columnCounter == $bldinfindex)
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   160
              {
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   161
                push(@row,"Orphaned,");
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   162
              }
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   163
              elsif($columnCounter == $targetindex)
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   164
              {
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   165
                push(@row,"$target,");
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   166
              }
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   167
              elsif($columnCounter == $timeindex-1)
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   168
              {
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   169
                push(@row,"untouched,");
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   170
              }
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   171
              elsif($columnCounter == $timeindex)
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   172
              {
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   173
                push(@row,"$time,");
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   174
              }              
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   175
              else
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   176
              {
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   177
                push(@row,",");
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   178
              }
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   179
              ++$columnCounter;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   180
            }
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   181
            print RESULTS @row;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   182
            print RESULTS "\n";
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   183
          }
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   184
        }  
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   185
        close RESULTS;
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   186
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   187
        foreach my $bldinf (sort(keys %bldinffiles))
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   188
        {
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   189
          if(!defined $failed{$bldinf})
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   190
          {
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   191
            print "OK:\t$bldinf\n";
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   192
          }
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   193
        }
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   194
        foreach my $bldinf (sort(keys %failed))
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   195
        {
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   196
            print "Failed:\t$bldinf\n";
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   197
        }
5274345d5497 Added merge_csv_orphans.pl - Would just change merge_csv.pl but I've been hacking and don't trust it yet.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   198