common/tools/analysis/find_collisions.pl
author Dario Sestito <darios@symbian.org>
Fri, 26 Jun 2009 17:33:05 +0100
changeset 221 3f8d2ea13886
parent 101 71122b8e1c7b
child 147 2854ff67dd37
permissions -rw-r--r--
Changed PDK to 2.0.c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
101
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
     1
#!/usr/bin/perl
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
     2
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
     3
# Copyright (c) 2009 Symbian Foundation Ltd
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
     4
# This component and the accompanying materials are made available
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
     5
# under the terms of the License "Eclipse Public License v1.0"
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
     6
# which accompanies this distribution, and is available
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
     7
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
     8
#
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
     9
# Initial Contributors:
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    10
# Symbian Foundation Ltd - initial contribution.
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    11
# 
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    12
# Contributors:
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    13
#
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    14
# Description:
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    15
# Adds info form a file to a CSV
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    16
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    17
use strict;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    18
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    19
main();
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    20
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    21
sub main()
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    22
{
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    23
  my $csvfile = shift @ARGV;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    24
  my $filelist = shift @ARGV;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    25
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    26
  if(! -e $csvfile)
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    27
  {
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    28
    die "cannot find $csvfile\n";
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    29
  }
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    30
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    31
  open(CSV,"<$csvfile") or die "Couldn't open $csvfile\n";
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    32
  my $header = <CSV>;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    33
  $header =~ s/\n//;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    34
  print RESULTS $header.",status\n";
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    35
  my @fields = split(',',$header);
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    36
  my $targetindex = 0;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    37
  my $counter = 0;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    38
  my $bldinfindex = 0;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    39
  my $makefileindex = 0;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    40
  my $typeindex = 0;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    41
  my $extindex = 0;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    42
  my %failed;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    43
  my %bldinffiles;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    44
  
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    45
  my %targets;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    46
  
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    47
  foreach my $column (@fields)
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    48
  {
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    49
      if($column =~ m/target/)
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    50
      {
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    51
          $targetindex = $counter;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    52
      }
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    53
      elsif($column =~ m/bldinf/)
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    54
      {
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    55
        $bldinfindex = $counter;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    56
      }
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    57
      elsif($column =~ m/makefile/)
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    58
      {
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    59
        $makefileindex = $counter;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    60
      }
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    61
      elsif($column =~ m/type/)
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    62
      {
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    63
        $typeindex = $counter;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    64
      }
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    65
      elsif($column =~ m/extension/)
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    66
      {
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    67
        $extindex = $counter;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    68
      }
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    69
      ++$counter;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    70
  }
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    71
#        print "\ntarget:$targetindex\tbuildinf:$bldinfindex\n";
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    72
    #header
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    73
  my $resultsfile = $csvfile."_collisions.csv"; 
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    74
  open(RESULTS, ">$resultsfile") or die "Coudn't open $resultsfile";
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    75
  
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    76
  print RESULTS "Collision,target,extension,type,source1,source2\n";
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    77
  while(my $line = <CSV>)
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    78
      {
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    79
      $line =~ s/\n//;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    80
      @fields = split(',',$line);
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    81
      my $target = $fields[$targetindex];
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    82
      $target = lc($target);
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    83
      my $makefile = $fields[$makefileindex];
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    84
      my $bldinf =   $fields[$bldinfindex];
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    85
                
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    86
      if(defined $targets{$target})
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    87
        {
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    88
          my $currentmakefile = $targets{$target};
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    89
          if($makefile eq "")
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    90
          {
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    91
            $makefile = $bldinf;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    92
          }
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    93
          if (!($currentmakefile eq $makefile))
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    94
            {
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    95
            my $type = $fields[$typeindex]; #DODGY - smoe custom makefiles also clash with export headers...
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    96
            my $ext = $fields[$extindex];
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    97
            my $collision = "-";
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    98
            if($type eq "export")
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    99
            {
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   100
              $collision = diffcollision($target,$currentmakefile,$makefile);
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   101
            }   
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   102
            print RESULTS "$collision,$target,$ext,$type,$currentmakefile,$makefile\n";
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   103
            }
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   104
        }
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   105
      else
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   106
        {
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   107
          if($makefile eq "")
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   108
          {
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   109
             $targets{$target} = $bldinf;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   110
          }
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   111
          else
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   112
          {
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   113
            $targets{$target} = $makefile;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   114
          }  
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   115
        }      
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   116
      }
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   117
  close RESULTS;    
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   118
  close CSV;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   119
}
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   120
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   121
sub diffcollision($$$)
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   122
{
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   123
  my $target = shift;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   124
  my $left = shift;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   125
  my $right = shift;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   126
  
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   127
  $target =~ s/\//\\/g;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   128
  $left  =~ s/\//\\/g;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   129
  $right =~ s/\//\\/g;  
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   130
  my $ret = "unknown";
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   131
  if(!-e $target)
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   132
  {
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   133
    $ret = "missing";
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   134
  }
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   135
  else
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   136
  {
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   137
    if(-e $left && -e $right)
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   138
    {
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   139
      my $leftdiff = 0;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   140
      my $rightdiff = 0;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   141
      open(DIFF,"diff $left $target|") or die "couldn't execute diff";
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   142
      print "diff $left $target\n";
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   143
      
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   144
      while(my $line = <DIFF>)
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   145
      {
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   146
        if($line =~ m/\S+/)
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   147
        {
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   148
          $leftdiff = 1;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   149
          print "\t$line";
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   150
        }
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   151
      }
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   152
      close DIFF;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   153
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   154
      open(DIFF,"diff $right $target|") or die "couldn't execute diff";
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   155
      print "diff $right $target\n";
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   156
      while( my $line = <DIFF>)
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   157
      {
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   158
        if($line =~ m/\S+/)
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   159
        {
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   160
          $rightdiff = 1;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   161
         print "\t$line";
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   162
        }
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   163
      }
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   164
      close DIFF;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   165
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   166
     if($leftdiff && !$rightdiff )
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   167
        {$ret = "match right";}
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   168
     elsif($rightdiff && !$leftdiff)
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   169
        {$ret = "match left";}
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   170
     elsif($rightdiff && $leftdiff)
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   171
        {$ret = "match neither";}
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   172
     elsif(!$rightdiff && !$leftdiff)
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   173
        {$ret = "match both";}                  
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   174
    }
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   175
  
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   176
    
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   177
  }
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   178
  return $ret; 
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   179
}