tools/summarise_rvct_errors.pl
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 11:44:26 +0100
changeset 3 5578c2bec847
child 4 c0296ad2454d
permissions -rw-r--r--
Update gcce summary tool to note the affected packages, and update summary text Add basic RVCT summary tool and corresponding summary.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
     1
#! perl
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
     2
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
     3
# Copyright (c) 2010 Symbian Foundation Ltd
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
     4
# This component and the accompanying materials are made available
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
     5
# under the terms of the License "Eclipse Public License v1.0"
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
     6
# which accompanies this distribution, and is available
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
     7
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
     8
#
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
     9
# Initial Contributors:
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    10
# Symbian Foundation Ltd - initial contribution.
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    11
# 
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    12
# Contributors:
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    13
#
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    14
# Description:
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    15
# Perl script to summarise GCC logs
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    16
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    17
use strict;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    18
use Getopt::Long;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    19
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    20
sub Usage($)
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    21
  {
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    22
  my ($msg) = @_;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    23
  
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    24
  print "$msg\n\n" if ($msg ne "");
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    25
  
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    26
	print <<'EOF';
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    27
summarise_gcc_errors.pl - simple script for analysing gcc error logs
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    28
	
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    29
This script will read a collection of GCC output logs and summarise
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    30
the error messages in various useful ways.
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    31
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    32
Options:
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    33
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    34
-warnings      process warnings as well as errors
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    35
-verbose       list the files associated with each error
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    36
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    37
EOF
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    38
  exit (1);  
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    39
  }
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    40
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    41
my $warnings = 0;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    42
my $verbose = 0;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    43
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    44
# Analyse the rest of command-line parameters
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    45
if (!GetOptions(
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    46
    "w|warnings" => \$warnings,
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    47
    "v|verbose" => \$verbose,
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    48
    ))
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    49
  {
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    50
  Usage("Invalid argument");
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    51
  }
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    52
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    53
my $current_package = ""; 
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    54
my %files;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    55
my %errors_by_file;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    56
my %error_count_by_file;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    57
my %errors;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    58
my %message_ids;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    59
my %files_by_message_id;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    60
my %messages_by_id;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    61
my %unique_message_counts;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    62
my %all_message_counts;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    63
my $next_message_id = 1;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    64
my %packages_by_file;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    65
my %package_count_by_file;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    66
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    67
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    68
my $line;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    69
while ($line = <>)
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    70
	{
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    71
	# </pre>os/usb, usb_CompilerCompatibility.005, SF_builds/usb/builds/CompilerCompatibility/usb_CompilerCompatibility.005/html/os_usb_failures.html
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    72
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    73
	if ($line =~/\/html\/([^\/]+)_failures.html/)
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    74
		{
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    75
		$current_package = $1;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    76
		$current_package =~ s/_/\//;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    77
		next;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    78
		}
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    79
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    80
	# &quot;J:/sf/app/commonemail/emailservices/emailclientapi/src/emailmailbox.cpp&quot;, line 49: Warning:  #830-D: function &quot;CBase::operator new(TUint, TLeave)&quot; has no corresponding operator delete (to be called if an exception is thrown during initialization of an allocated object)
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    81
	
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    82
	if ($line =~ /^&quot;(...*)&quot;, line (\d+): ([^:]+):\s+([^:]+): (.*)$/)
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    83
		{
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    84
		my $filename = $1;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    85
		my $lineno = $2;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    86
		my $messagetype = $3;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    87
		my $message_id = $4;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    88
		my $message = $5;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    89
		
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    90
		if ($messagetype eq "Warning" && !$warnings)
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    91
			{
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    92
			next;		# ignore warnings
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    93
			}
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    94
		
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    95
		$filename =~ s/^.://;		# remove drive letter
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    96
		
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    97
		$message =~ s/&quot;/\"/g;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    98
		$message =~ s/&amp;/&/g;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
    99
		$message =~ s/&gt;/>/g;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   100
		$message =~ s/&lt;/</g;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   101
		$message =~ s/&#39;/'/g;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   102
		my $generic_message = "$messagetype: $message_id: $message";
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   103
		$generic_message =~ s/'offsetof'/"offsetof"/;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   104
		$generic_message =~ s/'([^a-zA-Z])'/"\1"/g;	# don't catch ';' in next substitution
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   105
		$generic_message =~ s/\"[^\"]+\"/XX/g;	# suppress quoted bits of the actual instance
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   106
		
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   107
		if (!defined $message_ids{$generic_message})
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   108
			{
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   109
			$message_ids{$generic_message} = $message_id;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   110
			$messages_by_id{$message_id} = $generic_message;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   111
			$all_message_counts{$message_id} = 1;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   112
			}
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   113
		else
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   114
			{
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   115
			$all_message_counts{$message_id} += 1;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   116
			}
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   117
		my $instance = sprintf("%s:%d: %s-#%d", $filename, $lineno, $messagetype, $message_id);
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   118
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   119
		my $packages = $packages_by_file{$filename};
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   120
		if (!defined $packages)
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   121
			{
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   122
			$packages_by_file{$filename} = "\t$current_package\t";
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   123
			$package_count_by_file{$filename} = 1;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   124
			}
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   125
		else
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   126
			{
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   127
			if (index($packages,"\t$current_package\t") < 0)
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   128
				{
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   129
				$packages_by_file{$filename} .= "\t$current_package\t";
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   130
				$package_count_by_file{$filename} += 1;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   131
				}
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   132
			}
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   133
		
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   134
		if (defined $files{$instance})
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   135
			{
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   136
			# already seen this one
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   137
			next;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   138
			}
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   139
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   140
		if (!defined $unique_message_counts{$message_id})
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   141
			{
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   142
			$unique_message_counts{$message_id} = 1;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   143
			}
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   144
		else
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   145
			{
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   146
			$unique_message_counts{$message_id} += 1;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   147
			}
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   148
		$files{$instance} = $message;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   149
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   150
		if (!defined $files_by_message_id{$message_id})
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   151
			{
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   152
			$files_by_message_id{$message_id} = $filename;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   153
			}
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   154
		else
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   155
			{
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   156
			$files_by_message_id{$message_id} .= "\n$filename";
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   157
			}
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   158
				
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   159
		my $error = sprintf "%-5d: %s: %s: %s", $lineno, $messagetype, $message_id, $message;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   160
		if (!defined $errors_by_file{$filename})
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   161
			{
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   162
			$errors_by_file{$filename} = $error;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   163
			$error_count_by_file{$filename} = 1;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   164
			}
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   165
		else
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   166
			{
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   167
			$errors_by_file{$filename} .= "\n$error";
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   168
			$error_count_by_file{$filename} += 1;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   169
			}
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   170
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   171
		next;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   172
		}
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   173
	}
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   174
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   175
# clean up the file lists
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   176
my %filecount_by_message_id;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   177
foreach my $id (keys %files_by_message_id)
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   178
	{
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   179
	my @longlist = split /\n/, $files_by_message_id{$id};
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   180
	my %uniq;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   181
	foreach my $file (@longlist)
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   182
		{
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   183
		$uniq{$file} = 1;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   184
		}
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   185
	my $uniqlist = join( "\n\t", sort keys %uniq);
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   186
	$files_by_message_id{$id} = $uniqlist;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   187
	$filecount_by_message_id{$id} = scalar keys %uniq;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   188
	}
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   189
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   190
print "\n\n====Occurrences of messages (distinct, all)\n";
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   191
foreach my $id ( sort {$unique_message_counts{$b} <=> $unique_message_counts{$a}} keys %unique_message_counts)
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   192
	{
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   193
	printf "%-6d\t%-6d\t%s\n", $unique_message_counts{$id}, $all_message_counts{$id}, $messages_by_id{$id};
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   194
	}
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   195
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   196
print "\n\n====Files affected per message\n";
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   197
foreach my $id ( sort {$filecount_by_message_id{$b} <=> $filecount_by_message_id{$a}} keys %filecount_by_message_id)
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   198
	{
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   199
	printf "%-6d\t%s\n", $filecount_by_message_id{$id}, $messages_by_id{$id};
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   200
	if ($verbose)
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   201
		{
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   202
		print "\t", $files_by_message_id{$id};
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   203
		}
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   204
	}
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   205
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   206
print "\n\n====Packages impacted (if > 1)\n";
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   207
foreach my $file ( sort {$package_count_by_file{$b} <=> $package_count_by_file{$a}} keys %package_count_by_file)
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   208
	{
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   209
	if ($package_count_by_file{$file} < 2)
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   210
		{
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   211
		next;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   212
		}
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   213
	my ($empty,@packages) = split /\t+/, $packages_by_file{$file};
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   214
	printf "%-6d\t%s\n\t(%s)\n",$package_count_by_file{$file}, $file, join(", ", @packages);
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   215
	}
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   216
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   217
print "\n\n====Affected files by package\n";
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   218
my $current_package = "";
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   219
my @currentfiles;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   220
foreach my $file (sort keys %error_count_by_file)
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   221
	{
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   222
	my ($root, $sf, $layer, $packagename, @rest) = split /[\/\\]/, $file;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   223
	my $package = "$sf/$layer/$packagename";
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   224
	if ($layer eq "include")
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   225
		{
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   226
		$package = "$sf/$layer";
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   227
		}
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   228
	if ($package ne $current_package)
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   229
		{
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   230
		if ($current_package ne "")
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   231
			{
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   232
			printf "%-6d\t%s\n", scalar @currentfiles, $current_package;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   233
			print join("\n",@currentfiles);
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   234
			print "\n";
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   235
			}
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   236
		$current_package = $package;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   237
		@currentfiles = ();
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   238
		}
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   239
	my $filedetails = sprintf "\t%-6d\t%s", $error_count_by_file{$file}, $file;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   240
	push @currentfiles, $filedetails;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   241
	}
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   242
printf "%-6d\t%s\n", scalar @currentfiles, $current_package;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   243
print join("\n",@currentfiles);
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   244
print "\n";
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   245
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   246
print "\n\n====Messages by file\n";
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   247
foreach my $file ( sort keys %error_count_by_file)
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   248
	{
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   249
	my @details = split "\n", $errors_by_file{$file};
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   250
	printf "%-6d\t%s\n\t", $error_count_by_file{$file}, $file;
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   251
	print join("\n\t", @details);
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   252
	print "\n";
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   253
	}
5578c2bec847 Update gcce summary tool to note the affected packages, and update summary text
William Roberts <williamr@symbian.org>
parents:
diff changeset
   254