williamr/summarise_rnd_binaries.pl
author Shabe Razvi <shaber@symbian.org>
Wed, 03 Feb 2010 16:24:44 +0000
changeset 145 44e403e0f4cd
parent 2 a600c1a596f7
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
     1
#! perl
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
     2
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
     3
# Copyright (c) 2009 Symbian Foundation Ltd
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
     4
# This component and the accompanying materials are made available
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
     5
# under the terms of the License "Eclipse Public License v1.0"
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
     6
# which accompanies this distribution, and is available
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
     7
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
     8
#
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
     9
# Initial Contributors:
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    10
# Symbian Foundation Ltd - initial contribution.
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    11
# 
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    12
# Contributors:
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    13
#
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    14
# Description:
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    15
# Perl script to summarise the R&D binaries listing
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    16
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    17
use strict;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    18
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    19
my %grouped_by_basename;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    20
my $line;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    21
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    22
while ($line=<>)
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    23
  {
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    24
  # 2009-04-30 11:26:58 D....            0            0  epoc32\cshlpcmp_template
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    25
  # 2009-03-20 22:22:18 .....        72192        16307  epoc32\cshlpcmp_template\cshelp2000.dot
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    26
  
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    27
  next if (length($line) < 54);
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    28
  
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    29
  my $dir_attribute = substr($line, 20, 1);  
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    30
  if ($dir_attribute eq ".")
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    31
    {
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    32
    chomp $line;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    33
    my $fullpath = substr($line, 53);
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    34
    my $filename = substr($fullpath, rindex($fullpath,"\\")+1);
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    35
    my $basename = lc substr($filename, 0, index($filename,"."));
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    36
    
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    37
    if ($basename =~ /^(.*){[0-9a-f]+}$/)
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    38
      {
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    39
      # import library
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    40
      $basename = $1;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    41
      }
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    42
    elsif ($basename =~ /^(.*)_\d+$/)
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    43
      {
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    44
      # language variant in basename rather than extension
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    45
      $basename = $1;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    46
      }
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    47
    elsif ($basename =~ /^(.*)_(aif|reg)$/)
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    48
      {
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    49
      # Uikon file grouping
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    50
      $basename = $1;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    51
      }
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    52
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    53
    if (!defined $grouped_by_basename{$basename})
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    54
      {
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    55
      $grouped_by_basename{$basename} = ();
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    56
      }
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    57
    push @{$grouped_by_basename{$basename}}, $fullpath;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    58
    next;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    59
    }
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    60
  }
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    61
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    62
sub summarise_extensions(@)
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    63
  {
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    64
  my @files = @_;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    65
  my $resources = 0;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    66
  my $exes = 0;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    67
  my $dlls = 0;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    68
  my $libs = 0;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    69
  my $maps = 0;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    70
  my $headers = 0;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    71
  my $others = 0;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    72
  my %what_others;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    73
  
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    74
  foreach my $file (@files)
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    75
    {
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    76
    my $extension = substr($file,rindex($file, "."));
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    77
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    78
    if ($extension =~ /^.r\d+$/io)
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    79
      {
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    80
      $what_others{".rNN"} += 1;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    81
      next;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    82
      }
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    83
    if ($extension =~ /^.o\d+$/io)
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    84
      {
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    85
      $what_others{".oNNNN"} += 1;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    86
      next;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    87
      }
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    88
    $what_others{$extension} += 1;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    89
    }
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    90
  foreach my $extension (sort keys %what_others)
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    91
    {
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    92
    printf "%d %s, ", $what_others{$extension}, $extension;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    93
    }
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    94
  print "\n";
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    95
  }
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    96
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    97
my $count = 0;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    98
foreach my $basename (sort keys %grouped_by_basename)
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
    99
  {
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
   100
  my @files = @{$grouped_by_basename{$basename}};
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
   101
  next if (! grep /winscw|tools/, @files);  # ignore ARMV5 only for now...
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
   102
  printf "%6d\t%s\t", scalar @files, $basename;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
   103
  summarise_extensions(@files);
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
   104
  $count++;
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
   105
  }
a600c1a596f7 Create "williamr" directory in utilities, and add an assortment of Perl scripts
William Roberts <williamr@symbian.org>
parents:
diff changeset
   106
printf "%d distinct missing basenames (from %d total)\n", $count, scalar keys %grouped_by_basename;