uh_parser/releaseables.pm
author Dario Sestito <darios@symbian.org>
Thu, 02 Sep 2010 11:48:45 +0100
changeset 317 2ca4533db9fe
parent 313 8e1488905621
child 319 3c4e66eaef4a
permissions -rw-r--r--
Add debug lines to help understanding why total releasables are not displayed correctly during the builds
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
177
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     1
# Copyright (c) 2009 Symbian Foundation Ltd
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     2
# This component and the accompanying materials are made available
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     3
# under the terms of the License "Eclipse Public License v1.0"
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     4
# which accompanies this distribution, and is available
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     5
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     6
#
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     7
# Initial Contributors:
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     8
# Symbian Foundation Ltd - initial contribution.
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     9
#
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    10
# Contributors:
258
08436a227940 Add author information. Reviewed descriptions
Dario Sestito <darios@symbian.org>
parents: 223
diff changeset
    11
# Dario Sestito <darios@symbian.org>
177
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    12
#
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    13
# Description:
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    14
# Raptor parser module.
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    15
# Extract releaseable (whatlog) information
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    16
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    17
package releaseables;
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    18
298
27d2c4249a97 Fix: Missing 'missing' info
Dario Sestito <darios@symbian.org>
parents: 260
diff changeset
    19
use File::Path;
313
8e1488905621 Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents: 298
diff changeset
    20
use File::Find;
298
27d2c4249a97 Fix: Missing 'missing' info
Dario Sestito <darios@symbian.org>
parents: 260
diff changeset
    21
177
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    22
use strict;
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    23
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    24
our $reset_status = {};
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    25
my $buildlog_status = {};
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    26
my $whatlog_status = {};
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    27
my $bitmap_status = {};
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    28
my $resource_status = {};
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    29
my $build_status = {};
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    30
my $export_status = {};
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    31
my $stringtable_status = {};
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    32
my $archive_status = {};
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    33
my $archive_member_status = {};
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    34
my $whatlog_default_status = {};
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    35
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    36
$reset_status->{name} = 'reset_status';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    37
$reset_status->{next_status} = {buildlog=>$buildlog_status};
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    38
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    39
$buildlog_status->{name} = 'buildlog_status';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    40
$buildlog_status->{next_status} = {whatlog=>$whatlog_status};
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    41
$buildlog_status->{on_start} = 'releaseables::on_start_buildlog';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    42
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    43
$whatlog_status->{name} = 'whatlog_status';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    44
$whatlog_status->{next_status} = {bitmap=>$bitmap_status, resource=>$resource_status, build=>$build_status, export=>$export_status, stringtable=>$stringtable_status, archive=>$archive_status, '?default?'=>$whatlog_default_status};
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    45
$whatlog_status->{on_start} = 'releaseables::on_start_whatlog';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    46
$whatlog_status->{on_end} = 'releaseables::on_end_whatlog';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    47
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    48
$bitmap_status->{name} = 'bitmap_status';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    49
$bitmap_status->{next_status} = {};
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    50
$bitmap_status->{on_start} = 'releaseables::on_start_bitmap';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    51
$bitmap_status->{on_end} = 'releaseables::on_end_whatlog_subtag';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    52
$bitmap_status->{on_chars} = 'releaseables::on_chars_whatlog_subtag';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    53
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    54
$resource_status->{name} = 'resource_status';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    55
$resource_status->{next_status} = {};
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    56
$resource_status->{on_start} = 'releaseables::on_start_resource';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    57
$resource_status->{on_end} = 'releaseables::on_end_whatlog_subtag';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    58
$resource_status->{on_chars} = 'releaseables::on_chars_whatlog_subtag';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    59
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    60
$build_status->{name} = 'build_status';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    61
$build_status->{next_status} = {};
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    62
$build_status->{on_start} = 'releaseables::on_start_build';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    63
$build_status->{on_end} = 'releaseables::on_end_whatlog_subtag';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    64
$build_status->{on_chars} = 'releaseables::on_chars_whatlog_subtag';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    65
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    66
$stringtable_status->{name} = 'stringtable_status';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    67
$stringtable_status->{next_status} = {};
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    68
$stringtable_status->{on_start} = 'releaseables::on_start_stringtable';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    69
$stringtable_status->{on_end} = 'releaseables::on_end_whatlog_subtag';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    70
$stringtable_status->{on_chars} = 'releaseables::on_chars_whatlog_subtag';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    71
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    72
$archive_status->{name} = 'archive_status';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    73
$archive_status->{next_status} = {member=>$archive_member_status};
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    74
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    75
$archive_member_status->{name} = 'archive_member_status';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    76
$archive_member_status->{next_status} = {};
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    77
$archive_member_status->{on_start} = 'releaseables::on_start_archive_member';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    78
$archive_member_status->{on_end} = 'releaseables::on_end_whatlog_subtag';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    79
$archive_member_status->{on_chars} = 'releaseables::on_chars_whatlog_subtag';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    80
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    81
$export_status->{name} = 'export_status';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    82
$export_status->{next_status} = {};
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    83
$export_status->{on_start} = 'releaseables::on_start_export';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    84
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    85
$whatlog_default_status->{name} = 'whatlog_default_status';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    86
$whatlog_default_status->{next_status} = {};
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    87
$whatlog_default_status->{on_start} = 'releaseables::on_start_whatlog_default';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    88
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    89
my $whatlog_info = {};
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    90
my $curbldinf = 'unknown';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    91
my $curconfig = 'unknown';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    92
my $curfiletype = 'unknown';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    93
my $characters = '';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    94
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    95
sub on_start_buildlog
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    96
{
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    97
	
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    98
}
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    99
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   100
sub on_start_whatlog
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   101
{
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   102
	my ($el) = @_;
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   103
	
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   104
	$whatlog_info = {};
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   105
	
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   106
	my $bldinf = '';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   107
	my $config = '';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   108
	my $attributes = $el->{Attributes};
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   109
	for (keys %{$attributes})
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   110
	{
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   111
		#print "reading attribute $_\n";
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   112
		if ($attributes->{$_}->{'LocalName'} eq 'bldinf')
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   113
		{
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   114
			$bldinf = $attributes->{$_}->{'Value'};
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   115
			#print "bldinf=$bldinf\n";
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   116
		}
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   117
		elsif ($attributes->{$_}->{'LocalName'} eq 'config')
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   118
		{
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   119
			$config = $attributes->{$_}->{'Value'};
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   120
			$config =~ s,\.whatlog$,,;
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   121
		}
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   122
	}
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   123
	
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   124
	if ($bldinf eq '')
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   125
	{
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   126
		print "WARNING: whatlog tag with no bldinf attribute. Skipping\n";
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   127
		return;
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   128
	}
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   129
	
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   130
	$curbldinf = $bldinf;
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   131
	$curconfig = $config;
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   132
	$whatlog_info->{$curbldinf} = {} if (!defined $whatlog_info->{$curbldinf});
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   133
	$whatlog_info->{$curbldinf}->{$curconfig} = {} if (!defined $whatlog_info->{$curbldinf}->{$curconfig});
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   134
}
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   135
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   136
sub on_start_whatlog_subtag
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   137
{
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   138
	my ($ft) = @_;
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   139
	
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   140
	$curfiletype = $ft;
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   141
	$characters = '';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   142
	$whatlog_info->{$curbldinf}->{$curconfig}->{$curfiletype} = [] if (! defined $whatlog_info->{$curbldinf}->{$curconfig}->{$curfiletype});
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   143
}
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   144
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   145
sub on_chars_whatlog_subtag
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   146
{
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   147
	my ($ch) = @_;
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   148
	
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   149
	$characters .= $ch->{Data};
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   150
	
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   151
	#print "characters is now -->$characters<--\n";
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   152
}
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   153
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   154
sub on_end_whatlog_subtag
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   155
{
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   156
	$characters = normalize_filepath($characters);
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   157
	
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   158
	push(@{$whatlog_info->{$curbldinf}->{$curconfig}->{$curfiletype}}, $characters);
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   159
	
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   160
	$curfiletype = 'unknown';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   161
	$characters = '';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   162
}
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   163
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   164
sub on_start_bitmap
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   165
{
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   166
	on_start_whatlog_subtag('bitmap');
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   167
}
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   168
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   169
sub on_start_resource
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   170
{
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   171
	on_start_whatlog_subtag('resource');
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   172
}
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   173
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   174
sub on_start_build
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   175
{
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   176
	on_start_whatlog_subtag('build');
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   177
}
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   178
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   179
sub on_start_stringtable
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   180
{
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   181
	on_start_whatlog_subtag('stringtable');
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   182
}
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   183
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   184
sub on_start_archive_member
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   185
{
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   186
	on_start_whatlog_subtag('export');
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   187
}
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   188
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   189
sub on_start_export
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   190
{
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   191
	my ($el) = @_;
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   192
	
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   193
	$whatlog_info->{$curbldinf}->{$curconfig}->{export} = [] if (! defined $whatlog_info->{$curbldinf}->{$curconfig}->{export});
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   194
	
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   195
	my $destination = '';
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   196
	my $attributes = $el->{Attributes};
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   197
	for (keys %{$attributes})
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   198
	{
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   199
		#print "reading attribute $_\n";
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   200
		if ($attributes->{$_}->{'LocalName'} eq 'destination')
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   201
		{
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   202
			$destination = $attributes->{$_}->{'Value'};
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   203
			#print "destination=$destination\n";
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   204
			last;
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   205
		}
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   206
	}
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   207
	
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   208
	if ($destination eq '')
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   209
	{
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   210
		print "WARNING: export tag with no destination attribute. Skipping\n";
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   211
		return;
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   212
	}
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   213
	
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   214
	$destination = normalize_filepath($destination);
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   215
	
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   216
	push(@{$whatlog_info->{$curbldinf}->{$curconfig}->{export}}, $destination);
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   217
}
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   218
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   219
sub on_end_whatlog
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   220
{
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   221
	my $unknown_counter = 0;
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   222
	
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   223
	for my $bldinf (keys %{$whatlog_info})
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   224
	{
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   225
		for my $config (keys %{$whatlog_info->{$bldinf}})
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   226
		{
298
27d2c4249a97 Fix: Missing 'missing' info
Dario Sestito <darios@symbian.org>
parents: 260
diff changeset
   227
			my $normalized = $bldinf;
27d2c4249a97 Fix: Missing 'missing' info
Dario Sestito <darios@symbian.org>
parents: 260
diff changeset
   228
			RaptorCommon::normalize_bldinf_path(\$normalized);
27d2c4249a97 Fix: Missing 'missing' info
Dario Sestito <darios@symbian.org>
parents: 260
diff changeset
   229
			
27d2c4249a97 Fix: Missing 'missing' info
Dario Sestito <darios@symbian.org>
parents: 260
diff changeset
   230
			my $package = RaptorCommon::get_package_subpath($normalized);
177
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   231
			
298
27d2c4249a97 Fix: Missing 'missing' info
Dario Sestito <darios@symbian.org>
parents: 260
diff changeset
   232
			mkpath("$::releaseablesdir/$package");
177
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   233
			
298
27d2c4249a97 Fix: Missing 'missing' info
Dario Sestito <darios@symbian.org>
parents: 260
diff changeset
   234
			my $filename = "$::releaseablesdir/$package/info.tsv";
27d2c4249a97 Fix: Missing 'missing' info
Dario Sestito <darios@symbian.org>
parents: 260
diff changeset
   235
			$package =~ s,/,_,g;
27d2c4249a97 Fix: Missing 'missing' info
Dario Sestito <darios@symbian.org>
parents: 260
diff changeset
   236
			my $filenamemissing = "$::raptorbitsdir/$package\_missing.txt" if ($::missing);
177
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   237
			
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   238
			print "Writing info file $filename\n" if (!-f$filename);
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   239
			open(FILE, ">>$filename");
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   240
			
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   241
			for my $filetype (keys %{$whatlog_info->{$bldinf}->{$config}})
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   242
			{
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   243
				for (sort(@{$whatlog_info->{$bldinf}->{$config}->{$filetype}}))
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   244
				{
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   245
					print FILE "$_\t$filetype\t$config\n";
216
2c2dbe93b84b Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents: 177
diff changeset
   246
					my $file = $_;
2c2dbe93b84b Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents: 177
diff changeset
   247
					
2c2dbe93b84b Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents: 177
diff changeset
   248
					if($::missing && !-f $file)
2c2dbe93b84b Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents: 177
diff changeset
   249
					{
223
604012c39141 Minor adjustments to UH parser
Dario Sestito <darios@symbian.org>
parents: 216
diff changeset
   250
            open(MISSING, ">>$filenamemissing");
604012c39141 Minor adjustments to UH parser
Dario Sestito <darios@symbian.org>
parents: 216
diff changeset
   251
            print MISSING $file."\n";
604012c39141 Minor adjustments to UH parser
Dario Sestito <darios@symbian.org>
parents: 216
diff changeset
   252
            close(MISSING);
604012c39141 Minor adjustments to UH parser
Dario Sestito <darios@symbian.org>
parents: 216
diff changeset
   253
          }
177
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   254
				}
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   255
			}
223
604012c39141 Minor adjustments to UH parser
Dario Sestito <darios@symbian.org>
parents: 216
diff changeset
   256
			close(FILE);
177
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   257
		}
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   258
	}
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   259
}
313
8e1488905621 Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents: 298
diff changeset
   260
8e1488905621 Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents: 298
diff changeset
   261
sub count_distinct
8e1488905621 Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents: 298
diff changeset
   262
{
8e1488905621 Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents: 298
diff changeset
   263
	my @files;
8e1488905621 Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents: 298
diff changeset
   264
    my $finder = sub {
8e1488905621 Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents: 298
diff changeset
   265
        return if ! -f;
8e1488905621 Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents: 298
diff changeset
   266
        return if ! /\.tsv$/;
8e1488905621 Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents: 298
diff changeset
   267
        push @files, $File::Find::name;
8e1488905621 Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents: 298
diff changeset
   268
    };
8e1488905621 Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents: 298
diff changeset
   269
    find($finder, $::releaseablesdir);
8e1488905621 Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents: 298
diff changeset
   270
	
8e1488905621 Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents: 298
diff changeset
   271
	for my $file (@files)
8e1488905621 Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents: 298
diff changeset
   272
	{
8e1488905621 Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents: 298
diff changeset
   273
		$file =~ /$::releaseablesdir[\\\/](.*)[\\\/]info\.tsv/;
8e1488905621 Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents: 298
diff changeset
   274
		my $package = $1;
8e1488905621 Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents: 298
diff changeset
   275
		$package =~ s,\\,/,g;
8e1488905621 Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents: 298
diff changeset
   276
		
8e1488905621 Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents: 298
diff changeset
   277
		my @releasables;
8e1488905621 Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents: 298
diff changeset
   278
		open(FILE, $file);
8e1488905621 Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents: 298
diff changeset
   279
		while (<FILE>)
8e1488905621 Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents: 298
diff changeset
   280
		{
8e1488905621 Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents: 298
diff changeset
   281
			my $line = $_;
8e1488905621 Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents: 298
diff changeset
   282
			next if ($line !~ /^([^\t]*)\t[^\t]*\t[^\t]*$/);
8e1488905621 Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents: 298
diff changeset
   283
			push @releasables, $1;
8e1488905621 Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents: 298
diff changeset
   284
		}
8e1488905621 Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents: 298
diff changeset
   285
		close(FILE);
8e1488905621 Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents: 298
diff changeset
   286
		#for my $r (@releasables) {print "$r\n";}
8e1488905621 Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents: 298
diff changeset
   287
		#print "\n\n\n\n";
8e1488905621 Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents: 298
diff changeset
   288
		my $previous = '';
8e1488905621 Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents: 298
diff changeset
   289
		my @distincts = grep {$_ ne $previous && ($previous = $_, 1) } sort @releasables;
8e1488905621 Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents: 298
diff changeset
   290
		
8e1488905621 Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents: 298
diff changeset
   291
		my $nd = scalar(@distincts);
317
2ca4533db9fe Add debug lines to help understanding why total releasables are not displayed correctly during the builds
Dario Sestito <darios@symbian.org>
parents: 313
diff changeset
   292
		print "adding $package -> $nd to releaseables_by_package\n";
313
8e1488905621 Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents: 298
diff changeset
   293
		$::releaseables_by_package->{$package} = $nd;
8e1488905621 Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents: 298
diff changeset
   294
	}
8e1488905621 Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents: 298
diff changeset
   295
}
8e1488905621 Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents: 298
diff changeset
   296
216
2c2dbe93b84b Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents: 177
diff changeset
   297
sub remove_missing_duplicates
2c2dbe93b84b Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents: 177
diff changeset
   298
{
2c2dbe93b84b Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents: 177
diff changeset
   299
	opendir(DIR, $::raptorbitsdir);
2c2dbe93b84b Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents: 177
diff changeset
   300
    my @files = grep((-f "$::raptorbitsdir/$_" && $_ !~ /^\.\.?$/ && $_ =~ /_missing\.txt$/), readdir(DIR));
2c2dbe93b84b Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents: 177
diff changeset
   301
    close(DIR);
2c2dbe93b84b Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents: 177
diff changeset
   302
2c2dbe93b84b Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents: 177
diff changeset
   303
	for my $file (@files)
2c2dbe93b84b Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents: 177
diff changeset
   304
	{
2c2dbe93b84b Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents: 177
diff changeset
   305
		open(FILE, "+<$::raptorbitsdir/$file");	
313
8e1488905621 Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents: 298
diff changeset
   306
		#print "working on $file\n";	
216
2c2dbe93b84b Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents: 177
diff changeset
   307
	
2c2dbe93b84b Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents: 177
diff changeset
   308
		# Read it
2c2dbe93b84b Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents: 177
diff changeset
   309
		my @content = <FILE>;
2c2dbe93b84b Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents: 177
diff changeset
   310
2c2dbe93b84b Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents: 177
diff changeset
   311
		# Sort it, and grep to remove duplicates
2c2dbe93b84b Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents: 177
diff changeset
   312
		my $previous = "\n\n";
2c2dbe93b84b Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents: 177
diff changeset
   313
		@content = grep {$_ ne $previous && ($previous = $_, 1) } sort @content;
2c2dbe93b84b Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents: 177
diff changeset
   314
2c2dbe93b84b Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents: 177
diff changeset
   315
		# Write it
2c2dbe93b84b Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents: 177
diff changeset
   316
		seek(FILE, 0, 0);
2c2dbe93b84b Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents: 177
diff changeset
   317
		print FILE @content;
2c2dbe93b84b Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents: 177
diff changeset
   318
		truncate(FILE,tell(FILE));
2c2dbe93b84b Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents: 177
diff changeset
   319
	
2c2dbe93b84b Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents: 177
diff changeset
   320
		close(FILE);
2c2dbe93b84b Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents: 177
diff changeset
   321
	}
2c2dbe93b84b Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents: 177
diff changeset
   322
}
177
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   323
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   324
sub normalize_filepath
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   325
{
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   326
	my ($filepath) = @_;
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   327
	
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   328
	if ($filepath =~ m,[^\s^\r^\n]+(.*)[\r\n]+(.*)[^\s^\r^\n]+,)
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   329
	{
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   330
		print "WARNING: file path string extends over multiple line: $filepath. Removing all NL's and CR's\n";
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   331
	}
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   332
	
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   333
	# strip all CR's and NL's
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   334
	$filepath =~ s,[\r\n],,g;
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   335
	
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   336
	# strip all whitespaces at string start/end
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   337
	$filepath =~ s,^\s+,,g;
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   338
	$filepath =~ s,\s+$,,g;
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   339
	
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   340
	# remove drive letter and colon from the beginning of the string
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   341
	$filepath =~ s,^[A-Za-z]:,,;
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   342
	
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   343
	# normalize slashes
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   344
	$filepath =~ s,\\,/,g;
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   345
	$filepath =~ s,//,/,g;
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   346
	
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   347
	if ($filepath !~ m,^/epoc32/,i)
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   348
	{
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   349
		print "WARNING: file '$filepath' doesn't seem valid. Writing to info file anyway\n";
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   350
	}
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   351
	
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   352
	return $filepath;
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   353
}
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   354
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   355
sub on_start_whatlog_default
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   356
{
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   357
	my ($el) = @_;
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   358
	
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   359
	my $tagname = $el->{LocalName};
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   360
	
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   361
	print "WARNING: unsupported tag '$tagname' in <whatlog> context\n";
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   362
}
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   363
6d3c3db11e72 Add Raptor uh parser
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   364
1;