bc_tools/update_knownissues.pl
author Dario Sestito <darios@symbian.org>
Mon, 28 Jun 2010 14:13:42 +0100
changeset 268 60fee4a35d67
parent 222 4ee1b1d72018
permissions -rw-r--r--
Comment out some debug info
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
215
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
     1
#!/usr/bin/perl
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
     2
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
     3
# Copyright (c) 2009 Symbian Foundation Ltd
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
     4
# This component and the accompanying materials are made available
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
     5
# under the terms of the License "Eclipse Public License v1.0"
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
     6
# which accompanies this distribution, and is available
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
     7
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
     8
#
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
     9
# Initial Contributors:
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    10
# Symbian Foundation Ltd - initial contribution.
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    11
#	Maciej Seroka, maciejs@symbian.org
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    12
#
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    13
# Description:
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    14
#   This is a tool for adding BC issues to Known Issues list.
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    15
#
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    16
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    17
use strict;
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    18
use Getopt::Long;
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    19
use XML::Simple;
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    20
use Tie::File;
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    21
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    22
my $hdr_report;
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    23
my $lib_report;
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    24
my $ki_file;
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    25
my $current_report;
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    26
my $header_num;
222
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
    27
my $issues_num;
215
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    28
my $n;
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    29
my $m;
222
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
    30
my $offset;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
    31
my $counter;
215
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    32
my $file_name;
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    33
my $check_sum;
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    34
my $comment = "Issue closed as invalid by the PkO (Not a BC break)."; # This is a default comment that will be added to Known Issues list with each header file.
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    35
my $header_found;
222
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
    36
my $library_found;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
    37
my $issue_found;
215
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    38
my $status;
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    39
my $line;
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    40
my @lines;
222
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
    41
my $temp_ref;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
    42
my $temp_line;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
    43
my $temp_issues_num;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
    44
my $my_issue;
215
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    45
my $help;
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    46
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    47
sub usage($);
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    48
sub help();
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    49
sub usage_error();
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    50
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    51
my %optmap = (  'headers-report' => \$hdr_report,
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    52
			    'libraries-report' => \$lib_report,
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    53
			    'knownissues-file' => \$ki_file,
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    54
				'help' => \$help);
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    55
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    56
GetOptions(\%optmap,
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    57
          'headers-report=s',
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    58
          'libraries-report=s',
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    59
          'knownissues-file=s',
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    60
		  'help!') 
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    61
          or usage_error();
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    62
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    63
if ($help) {
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    64
	help();
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    65
}
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    66
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    67
# --headers-report is mandatory.
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    68
usage_error(), unless (defined($hdr_report) || defined($lib_report));
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    69
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    70
# --knownissues-file is mandatory.
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    71
usage_error(), unless (defined($ki_file));
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    72
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    73
# Open Known Isses file.
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    74
tie @lines, 'Tie::File', $ki_file or die ("Cannot tie file \"$ki_file\". $!\n");
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    75
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    76
if ($hdr_report) {
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    77
	# Parse the input XML into hashrefs.
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    78
	print "Parsing " . $hdr_report . "... ";
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    79
	$current_report = XMLin("./$hdr_report", keeproot => 1,
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    80
		forcearray => [ 'header', 'baselineversion', 'currentversion', 'timestamp', 'day', 'month', 'year', 'hour', 'minute', 'second', #
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    81
		'haversion', 'formatversion', 'cmdlineparms', 'parm', 'pname', 'pvalue', 'knownissuesversion', 'os', 'version', 'buildweek', 'issuelist',#
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    82
		'headerfile', 'filename', 'comparefilename', 'status', 'comment', 'issue', 'checksum', 'shortname', 'issueid', 'typeid', 'identityid', #
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    83
		'identitydescription', 'typestring', 'cause', 'documentation', 'ignoreinformation', 'linenumber', 'severity', 'scseverity'], keyattr => [] );
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    84
	print "complete \n";
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    85
	# Get number of header files.
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    86
	my $header_num = @{$current_report->{'bbcresults'}->{'issuelist'}->[0]->{'headerfile'}};
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    87
	print "Number of header files in the report: $header_num \n";
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    88
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    89
	$n = 0;
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    90
	while ($n < $header_num) {
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    91
		$file_name = $current_report->{'bbcresults'}->{'issuelist'}->[0]->{'headerfile'}->[$n]->{'shortname'}->[0];
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    92
		$check_sum = $current_report->{'bbcresults'}->{'issuelist'}->[0]->{'headerfile'}->[$n]->{'checksum'}->[0];
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    93
		$m = 0;
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    94
		$header_found = 0;
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    95
		$status = 0;
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    96
		foreach (@lines) { 
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    97
			if (@lines[$m] =~ "\"$file_name\"") { # Mark header file as present in the Known Issues file.
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    98
				$header_found = 1;
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
    99
				$line = $m;
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   100
				last;
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   101
			}
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   102
			$m++;
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   103
		}
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   104
		if ($header_found) { # Ensure there is no duplicate in the Known Issues file.
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   105
			$m = 0;
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   106
			foreach (@lines) { 
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   107
				if (@lines[$m] =~ "checksum=\"$check_sum\"") { 
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   108
					$status = 1; # Means OK issue (already known).
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   109
					print "Duplicate found ($check_sum) for header file: $file_name\n";
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   110
					last;
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   111
				}
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   112
				$m++;
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   113
			}
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   114
		}
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   115
		if (($header_found) && (!($status))) { # Insert new version of header file.
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   116
			splice @lines, $line+1, 0, "    <version checksum=\"$check_sum\">";
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   117
			splice @lines, $line+2, 0, "      <status>OK<\/status>";
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   118
			splice @lines, $line+3, 0, "      <comment>$comment<\/comment>";
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   119
			splice @lines, $line+4, 0, "    <\/version>";
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   120
			print "New version ($check_sum) of header file: $file_name added to Known Issues list\n";
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   121
		}
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   122
		if (!($header_found)) { # Insert new header file.
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   123
			# Find the first occurrence of <headerfile>. - ASSUMPTION: at least one entry exists.
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   124
			$m = 0;
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   125
			foreach (@lines) { 
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   126
				if (@lines[$m] =~ "<headerfile") { 
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   127
					last; }
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   128
				else {
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   129
					$m++;
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   130
				}
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   131
			}
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   132
			splice @lines, $m, 0, "  <headerfile name=\"$file_name\">";
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   133
			splice @lines, $m+1, 0, "    <version checksum=\"$check_sum\">";
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   134
			splice @lines, $m+2, 0, "      <status>OK<\/status>";
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   135
			splice @lines, $m+3, 0, "      <comment>$comment<\/comment>";
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   136
			splice @lines, $m+4, 0, "    <\/version>";
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   137
			splice @lines, $m+5, 0, "  <\/headerfile>";
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   138
			print "Header file: $file_name ($check_sum) added to Known Issues list\n";
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   139
		}
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   140
		$n++;
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   141
	}
222
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   142
	# Free up memory resources.
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   143
	$current_report = ();
215
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   144
	print "OK\n";
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   145
}
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   146
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   147
if ($lib_report) {
222
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   148
	# Parse the input XMLs into hashrefs.
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   149
	print "Parsing " . $lib_report . "... ";
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   150
	$current_report = XMLin("./$lib_report", keeproot => 1,
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   151
		forcearray => [ 'header', 'baselineversion', 'currentversion', 'timestamp', 'day', 'month', 'year', 'hour', 'minute', 'second', #
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   152
		'laversion', 'formatversion', 'cmdlineparms', 'parm', 'pname', 'pvalue', 'knownissuesversion', 'os', 'version', 'buildweek', 'issuelist',#
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   153
		'library', 'name', 'comparefilename', 'shortname', 'baseplatform', 'currentplatform', 'issue', 'typeinfo', 'typeid', 'funcname', 'newfuncname', 'newfuncpos', #
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   154
		'bc_severity', 'sc_severity', 'status', 'comment', 'funcpos' ], keyattr => [] );
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   155
	print "complete \n";
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   156
	# Get number of libraries.
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   157
	my $lib_num = @{$current_report->{'bbcresults'}->{'issuelist'}->[0]->{'library'}};
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   158
	print "Number of libraries in the report: $lib_num \n";
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   159
	
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   160
	$n = 0;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   161
	while ($n < $lib_num) {
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   162
		$file_name = $current_report->{'bbcresults'}->{'issuelist'}->[0]->{'library'}->[$n]->{'shortname'}->[0];
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   163
		# Check if library present in the Known Issues file.
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   164
		$m = 0;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   165
		$library_found = 0;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   166
		foreach (@lines) { 
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   167
			if (@lines[$m] =~ "\"$file_name\"") { # Mark header file as present in the Known Issues file.
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   168
				$library_found = 1;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   169
				$line = $m;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   170
				last;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   171
			}
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   172
			$m++;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   173
		}
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   174
		if ($library_found) { # Some entries already persent in the Known Issues file for the current library.
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   175
			print "Found library: $file_name in line: $line\n";
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   176
			$issues_num = @{$current_report->{'bbcresults'}->{'issuelist'}->[0]->{'library'}->[$n]->{'issue'}};
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   177
			# Get library with all issues to $temp_ref;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   178
			$m = $line - 1;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   179
			$temp_line = "";
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   180
			do {
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   181
				$m++;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   182
				$temp_line = $temp_line . @lines[$m];
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   183
			} while (@lines[$m] !~ "<\/library>");
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   184
			$temp_ref = XMLin($temp_line, keeproot => 1,
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   185
			forcearray => [ 'library', 'issue', 'typeid', 'typeinfo', 'funcname', 'newfuncname', 'funcpos', #
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   186
			'newfuncpos', 'bc_severity', 'sc_severity', 'status', 'comment' ], keyattr => [] );
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   187
			$temp_issues_num = @{$temp_ref->{'library'}->[0]->{'issue'}};
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   188
			# For each issue related to the current library check for a matching issue in $temp_ref.
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   189
			foreach $my_issue (@{$current_report->{'bbcresults'}->{'issuelist'}->[0]->{'library'}->[$n]->{'issue'}}) {
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   190
				$issue_found = 0;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   191
				$m = 0;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   192
				while ($m < $temp_issues_num) {
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   193
					# Compare all possible values.
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   194
					if (($my_issue->{'typeid'}->[0] eq $temp_ref->{'library'}->[0]->{'issue'}->[$m]->{'typeid'}->[0]) &&
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   195
						($my_issue->{'typeinfo'}->[0] eq $temp_ref->{'library'}->[0]->{'issue'}->[$m]->{'typeinfo'}->[0]) &&
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   196
						($my_issue->{'funcname'}->[0] eq $temp_ref->{'library'}->[0]->{'issue'}->[$m]->{'funcname'}->[0]) &&
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   197
						($my_issue->{'newfuncname'}->[0] eq $temp_ref->{'library'}->[0]->{'issue'}->[$m]->{'newfuncname'}->[0]) &&
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   198
						($my_issue->{'funcpos'}->[0] eq $temp_ref->{'library'}->[0]->{'issue'}->[$m]->{'funcpos'}->[0]) &&
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   199
						($my_issue->{'newfuncpos'}->[0] eq $temp_ref->{'library'}->[0]->{'issue'}->[$m]->{'newfuncpos'}->[0]) &&
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   200
						($my_issue->{'bc_severity'}->[0] eq $temp_ref->{'library'}->[0]->{'issue'}->[$m]->{'bc_severity'}->[0]) &&
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   201
						($my_issue->{'sc_severity'}->[0] eq $temp_ref->{'library'}->[0]->{'issue'}->[$m]->{'sc_severity'}->[0]) &&
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   202
						($temp_ref->{'library'}->[0]->{'issue'}->[$m]->{'status'}->[0]) =~ "OK") {
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   203
						print "Duplicated issue found for library: $file_name\n";
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   204
						$issue_found = 1; # Do not add this issue to the Known Issues file.
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   205
						last;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   206
					}
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   207
					$m++;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   208
				}
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   209
				if (!$issue_found) { # Add the issue to the Known Issues file for exising library entry (as the top one).
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   210
					$offset = 1; # Initial offset value.
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   211
					splice @lines, $line+$offset, 0, "    <issue>"; $offset++;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   212
					if ($my_issue->{'typeid'}->[0]) { splice @lines, $line+$offset, 0, "      <typeid>$my_issue->{'typeid'}->[0]<\/typeid>"; $offset++; }
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   213
					if ($my_issue->{'typeinfo'}->[0]) { splice @lines, $line+$offset, 0, "      <typeinfo>$my_issue->{'typeinfo'}->[0]<\/typeinfo>"; $offset++; }
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   214
					if ($my_issue->{'funcname'}->[0]) { 
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   215
						# Fix ampersand, greater-than and less-than characters before saving.
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   216
						$my_issue->{'funcname'}->[0] =~ s/&/&amp;/g;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   217
						$my_issue->{'funcname'}->[0] =~ s/</&lt;/g;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   218
						$my_issue->{'funcname'}->[0] =~ s/>/&gt;/g;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   219
						splice @lines, $line+$offset, 0, "      <funcname>$my_issue->{'funcname'}->[0]<\/funcname>"; 
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   220
						$offset++;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   221
					}
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   222
					if ($my_issue->{'newfuncname'}->[0]) { 
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   223
						# Fix ampersand, greater-than and less-than characters before saving.
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   224
						$my_issue->{'newfuncname'}->[0] =~ s/&/&amp;/g;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   225
						$my_issue->{'newfuncname'}->[0] =~ s/</&lt;/g;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   226
						$my_issue->{'newfuncname'}->[0] =~ s/>/&gt;/g;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   227
						splice @lines, $line+$offset, 0, "      <newfuncname>$my_issue->{'newfuncname'}->[0]<\/newfuncname>";
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   228
						$offset++;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   229
					}
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   230
					if ($my_issue->{'funcpos'}->[0]) { splice @lines, $line+$offset, 0, "      <funcpos>$my_issue->{'funcpos'}->[0]<\/funcpos>"; $offset++; }
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   231
					if ($my_issue->{'newfuncpos'}->[0]) { splice @lines, $line+$offset, 0, "      <newfuncpos>$my_issue->{'newfuncpos'}->[0]<\/newfuncpos>"; $offset++; }
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   232
					if ($my_issue->{'bc_severity'}->[0]) { splice @lines, $line+$offset, 0, "      <bc_severity>$my_issue->{'bc_severity'}->[0]<\/bc_severity>"; $offset++; }
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   233
					if ($my_issue->{'sc_severity'}->[0]) { splice @lines, $line+$offset, 0, "      <sc_severity>$my_issue->{'sc_severity'}->[0]<\/sc_severity>"; $offset++; }
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   234
					splice @lines, $line+$offset, 0, "      <status>OK<\/status>"; $offset++;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   235
					splice @lines, $line+$offset, 0, "      <comment>$comment<\/comment>"; $offset++;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   236
					splice @lines, $line+$offset, 0, "    <\/issue>";
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   237
					print "New issue added to Known Issues list for library: $file_name\n";
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   238
				}
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   239
			}
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   240
			$temp_ref = ();
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   241
		} else { # Add the whole new entry for the current library.
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   242
			# Find the first occurrence of <library>. - ASSUMPTION: at least one entry exists.
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   243
			$m = 0;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   244
			foreach (@lines) { 
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   245
				if (@lines[$m] =~ "<library") { 
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   246
					last; }
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   247
				else {
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   248
					$m++;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   249
				}
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   250
			}
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   251
			$offset = 0; # Initial offset value.
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   252
			splice @lines, $m+$offset, 0, "  <library name=\"$file_name\">"; $offset++;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   253
			print "Library: $file_name added to Known Issues list\n";
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   254
			$counter = 1;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   255
			foreach $my_issue (@{$current_report->{'bbcresults'}->{'issuelist'}->[0]->{'library'}->[$n]->{'issue'}}) {	
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   256
				print "Adding issue: $counter... ";
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   257
				splice @lines, $m+$offset, 0, "    <issue>"; $offset++;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   258
				if ($my_issue->{'typeid'}->[0]) { splice @lines, $m+$offset, 0, "      <typeid>$my_issue->{'typeid'}->[0]<\/typeid>"; $offset++; }
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   259
				if ($my_issue->{'typeinfo'}->[0]) { splice @lines, $m+$offset, 0, "      <typeinfo>$my_issue->{'typeinfo'}->[0]<\/typeinfo>"; $offset++; }
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   260
				if ($my_issue->{'funcname'}->[0]) { 
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   261
					# Fix ampersand, greater-than and less-than characters before saving.
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   262
					$my_issue->{'funcname'}->[0] =~ s/&/&amp;/g;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   263
					$my_issue->{'funcname'}->[0] =~ s/</&lt;/g;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   264
					$my_issue->{'funcname'}->[0] =~ s/>/&gt;/g;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   265
					splice @lines, $m+$offset, 0, "      <funcname>$my_issue->{'funcname'}->[0]<\/funcname>"; 
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   266
					$offset++;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   267
				}
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   268
				if ($my_issue->{'newfuncname'}->[0]) { 
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   269
					# Fix ampersand, greater-than and less-than characters before saving.
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   270
					$my_issue->{'newfuncname'}->[0] =~ s/&/&amp;/g;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   271
					$my_issue->{'newfuncname'}->[0] =~ s/</&lt;/g;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   272
					$my_issue->{'newfuncname'}->[0] =~ s/>/&gt;/g;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   273
					splice @lines, $m+$offset, 0, "      <newfuncname>$my_issue->{'newfuncname'}->[0]<\/newfuncname>";
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   274
					$offset++;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   275
				}
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   276
				if ($my_issue->{'funcpos'}->[0]) { splice @lines, $m+$offset, 0, "      <funcpos>$my_issue->{'funcpos'}->[0]<\/funcpos>"; $offset++; }
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   277
				if ($my_issue->{'newfuncpos'}->[0]) { splice @lines, $m+$offset, 0, "      <newfuncpos>$my_issue->{'newfuncpos'}->[0]<\/newfuncpos>"; $offset++; }
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   278
				if ($my_issue->{'bc_severity'}->[0]) { splice @lines, $m+$offset, 0, "      <bc_severity>$my_issue->{'bc_severity'}->[0]<\/bc_severity>"; $offset++; }
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   279
				if ($my_issue->{'sc_severity'}->[0]) { splice @lines, $m+$offset, 0, "      <sc_severity>$my_issue->{'sc_severity'}->[0]<\/sc_severity>"; $offset++; }
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   280
				splice @lines, $m+$offset, 0, "      <status>OK<\/status>"; $offset++;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   281
				splice @lines, $m+$offset, 0, "      <comment>$comment<\/comment>"; $offset++;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   282
				splice @lines, $m+$offset, 0, "    <\/issue>"; $offset++;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   283
				print "done\n";
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   284
				$counter++;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   285
			}
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   286
			splice @lines, $m+$offset, 0, "  <\/library>";
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   287
		}
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   288
		$n++;
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   289
	}
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   290
	# Free up memory resources.
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   291
	$current_report = ();
4ee1b1d72018 Implemented update of Known Issues file based on libraries reports in update_knownissues.pl
Maciej Seroka <maciejs@symbian.org>
parents: 215
diff changeset
   292
	print "OK\n";
215
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   293
}
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   294
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   295
untie @lines;
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   296
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   297
exit 0;
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   298
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   299
sub usage($)
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   300
{
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   301
    my $error = shift;
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   302
    my $fh = $error == 0 ? *STDOUT : *STDERR;
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   303
    print $fh "update_knownissues.pl\n" .
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   304
            "Specify the headers report or\/and libraries report and the known issues file\n" .
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   305
            "synopsis:\n" .
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   306
            "  update_knownissues.pl --help\n" .
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   307
            "  update_knownissues.pl [--headers-report=FILENAME1] [--libraries-report=FILENAME2] [--knownissues-file=FILENAME3] \n" .
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   308
            "options:\n" .
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   309
            "  --help                        Display this help and exit\n" .
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   310
            "  --headers-report=FILENAME1    FILENAME1 is the name of the filtered headers (sub-)report.\n" .
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   311
            "  --libraries-report=FILENAME2  FILENAME2 is the name of the filtered libraries report. This option is not implemented yet.\n" .
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   312
            "  --knownissues-file=FILENAME3  FILENAME3 is the name of the known issues file which will be updated.\n";
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   313
    exit $error;            
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   314
}
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   315
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   316
sub help()
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   317
{
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   318
    usage(0);
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   319
}
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   320
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   321
sub usage_error()
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   322
{
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   323
    usage(1);
74890d706f0c Added tools for filtering bc reports and updating known issues file
maciejs
parents:
diff changeset
   324
}