common/tools/analysis/find_collisions.pl
author Dario Sestito <darios@symbian.org>
Fri, 11 Dec 2009 14:51:21 +0000
changeset 826 602c0e7df6d1
parent 230 75af1c9cfd87
permissions -rw-r--r--
Update the PDK baseline for symbian2 builds
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
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    25
  if(! -e $csvfile)
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    26
  {
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    27
    die "cannot find $csvfile\n";
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    28
  }
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
  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
    31
  my $header = <CSV>;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    32
  $header =~ s/\n//;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    33
  print RESULTS $header.",status\n";
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    34
  my @fields = split(',',$header);
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    35
  my $targetindex = 0;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    36
  my $counter = 0;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    37
  my $bldinfindex = 0;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    38
  my $makefileindex = 0;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    39
  my $typeindex = 0;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    40
  my $extindex = 0;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    41
  my %failed;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    42
  my %bldinffiles;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    43
  
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    44
  my %targets;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    45
  
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    46
  foreach my $column (@fields)
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    47
  {
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    48
      if($column =~ m/target/)
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    49
      {
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    50
          $targetindex = $counter;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    51
      }
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    52
      elsif($column =~ m/bldinf/)
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    53
      {
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    54
        $bldinfindex = $counter;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    55
      }
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    56
      elsif($column =~ m/makefile/)
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    57
      {
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    58
        $makefileindex = $counter;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    59
      }
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    60
      elsif($column =~ m/type/)
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    61
      {
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    62
        $typeindex = $counter;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    63
      }
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    64
      elsif($column =~ m/extension/)
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    65
      {
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    66
        $extindex = $counter;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    67
      }
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    68
      ++$counter;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    69
  }
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    70
#        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
    71
    #header
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    72
  my $resultsfile = $csvfile."_collisions.csv"; 
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    73
  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
    74
  
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    75
  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
    76
  while(my $line = <CSV>)
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    77
      {
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    78
      $line =~ s/\n//;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    79
      @fields = split(',',$line);
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    80
      my $target = $fields[$targetindex];
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    81
      $target = lc($target);
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    82
      my $makefile = $fields[$makefileindex];
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    83
      my $bldinf =   $fields[$bldinfindex];
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    84
                
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    85
      if(defined $targets{$target})
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    86
        {
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    87
          my $currentmakefile = $targets{$target};
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    88
          if($makefile eq "")
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    89
          {
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    90
            $makefile = $bldinf;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    91
          }
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    92
          if (!($currentmakefile eq $makefile))
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    93
            {
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    94
            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
    95
            my $ext = $fields[$extindex];
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    96
            my $collision = "-";
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    97
            if($type eq "export")
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    98
            {
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
    99
              $collision = diffcollision($target,$currentmakefile,$makefile);
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   100
            }   
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   101
            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
   102
            }
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
      else
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   105
        {
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   106
          if($makefile eq "")
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   107
          {
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   108
             $targets{$target} = $bldinf;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   109
          }
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   110
          else
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   111
          {
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   112
            $targets{$target} = $makefile;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   113
          }  
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
  close RESULTS;    
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   117
  close CSV;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   118
}
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
sub diffcollision($$$)
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   121
{
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   122
  my $target = shift;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   123
  my $left = shift;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   124
  my $right = shift;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   125
  
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   126
  $target =~ s/\//\\/g;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   127
  $left  =~ s/\//\\/g;
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   128
  $right =~ s/\//\\/g;  
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   129
  my $ret = "unknown";
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   130
  if(!-e $target)
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   131
  {
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   132
    $ret = "missing";
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   133
  }
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   134
  else
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   135
  {
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   136
    if(-e $left && -e $right)
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   137
    {
230
75af1c9cfd87 Find_collisions.pl - modified tool to use 'FC' instead of 'diff' for finding origins. (gcc 'diff' not currently in builds)
MattD <mattd@symbian.org>
parents: 147
diff changeset
   138
      my $leftdiff = 1;
75af1c9cfd87 Find_collisions.pl - modified tool to use 'FC' instead of 'diff' for finding origins. (gcc 'diff' not currently in builds)
MattD <mattd@symbian.org>
parents: 147
diff changeset
   139
      my $rightdiff = 1;
75af1c9cfd87 Find_collisions.pl - modified tool to use 'FC' instead of 'diff' for finding origins. (gcc 'diff' not currently in builds)
MattD <mattd@symbian.org>
parents: 147
diff changeset
   140
      open(DIFF,"fc $left $target|") or die "couldn't execute fc";
75af1c9cfd87 Find_collisions.pl - modified tool to use 'FC' instead of 'diff' for finding origins. (gcc 'diff' not currently in builds)
MattD <mattd@symbian.org>
parents: 147
diff changeset
   141
      print "fc $left $target\n";
101
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   142
      
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   143
      while(my $line = <DIFF>)
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   144
      {
230
75af1c9cfd87 Find_collisions.pl - modified tool to use 'FC' instead of 'diff' for finding origins. (gcc 'diff' not currently in builds)
MattD <mattd@symbian.org>
parents: 147
diff changeset
   145
        
75af1c9cfd87 Find_collisions.pl - modified tool to use 'FC' instead of 'diff' for finding origins. (gcc 'diff' not currently in builds)
MattD <mattd@symbian.org>
parents: 147
diff changeset
   146
        if($line =~ m/FC:\sno\sdifferences\sencountered/i)
101
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   147
        {
230
75af1c9cfd87 Find_collisions.pl - modified tool to use 'FC' instead of 'diff' for finding origins. (gcc 'diff' not currently in builds)
MattD <mattd@symbian.org>
parents: 147
diff changeset
   148
          $leftdiff = 0;
101
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   149
        }
230
75af1c9cfd87 Find_collisions.pl - modified tool to use 'FC' instead of 'diff' for finding origins. (gcc 'diff' not currently in builds)
MattD <mattd@symbian.org>
parents: 147
diff changeset
   150
        print "\t$line";
101
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
230
75af1c9cfd87 Find_collisions.pl - modified tool to use 'FC' instead of 'diff' for finding origins. (gcc 'diff' not currently in builds)
MattD <mattd@symbian.org>
parents: 147
diff changeset
   154
      open(DIFF,"fc $right $target|") or die "couldn't execute fc";
75af1c9cfd87 Find_collisions.pl - modified tool to use 'FC' instead of 'diff' for finding origins. (gcc 'diff' not currently in builds)
MattD <mattd@symbian.org>
parents: 147
diff changeset
   155
      print "fc $right $target\n";
101
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
      {
230
75af1c9cfd87 Find_collisions.pl - modified tool to use 'FC' instead of 'diff' for finding origins. (gcc 'diff' not currently in builds)
MattD <mattd@symbian.org>
parents: 147
diff changeset
   158
        if($line =~ m/FC:\sno\sdifferences\sencountered/i)
101
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   159
        {
230
75af1c9cfd87 Find_collisions.pl - modified tool to use 'FC' instead of 'diff' for finding origins. (gcc 'diff' not currently in builds)
MattD <mattd@symbian.org>
parents: 147
diff changeset
   160
          $rightdiff = 0;
101
71122b8e1c7b Added find_collisions.pl Updated the readme.txt for instructions.
Matt Davies <mattd@symbian.org>
parents:
diff changeset
   161
        }
230
75af1c9cfd87 Find_collisions.pl - modified tool to use 'FC' instead of 'diff' for finding origins. (gcc 'diff' not currently in builds)
MattD <mattd@symbian.org>
parents: 147
diff changeset
   162
        print "\t$line";
101
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
}