common/tools/raptor/RaptorReleaseable.pm
author Simon Howkins <simonh@symbian.org>
Tue, 18 Aug 2009 14:40:13 +0100
changeset 361 023e28d6bf31
parent 336 08d0bd91ad20
permissions -rw-r--r--
Moved all targets specific to the postbuild phase of the build into the postbuild ant file.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
242
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     1
# Copyright (c) 2009 Symbian Foundation Ltd
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     2
# This component and the accompanying materials are made available
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     3
# under the terms of the License "Eclipse Public License v1.0"
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     4
# which accompanies this distribution, and is available
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     5
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     6
#
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     7
# Initial Contributors:
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     8
# Symbian Foundation Ltd - initial contribution.
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     9
#
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    10
# Contributors:
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    11
#
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    12
# Description:
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    13
# Raptor parser module.
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    14
# Extract releaseable (whatlog) information
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    15
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    16
package RaptorReleaseable;
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    17
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    18
use strict;
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    19
use RaptorCommon;
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    20
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    21
our $reset_status = {};
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    22
my $buildlog_status = {};
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    23
my $whatlog_status = {};
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    24
my $bitmap_status = {};
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    25
my $resource_status = {};
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    26
my $build_status = {};
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    27
my $export_status = {};
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    28
my $stringtable_status = {};
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    29
my $archive_status = {};
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    30
my $archive_member_status = {};
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    31
my $whatlog_default_status = {};
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    32
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    33
$reset_status->{name} = 'reset_status';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    34
$reset_status->{next_status} = {buildlog=>$buildlog_status};
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    35
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    36
$buildlog_status->{name} = 'buildlog_status';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    37
$buildlog_status->{next_status} = {whatlog=>$whatlog_status};
336
08d0bd91ad20 Fix again releaseables dir not existing as erroronmissing dir is not supported
Dario Sestito <darios@symbian.org>
parents: 242
diff changeset
    38
$buildlog_status->{on_start} = 'RaptorReleaseable::on_start_buildlog';
242
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    39
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    40
$whatlog_status->{name} = 'whatlog_status';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    41
$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};
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    42
$whatlog_status->{on_start} = 'RaptorReleaseable::on_start_whatlog';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    43
$whatlog_status->{on_end} = 'RaptorReleaseable::on_end_whatlog';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    44
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    45
$bitmap_status->{name} = 'bitmap_status';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    46
$bitmap_status->{next_status} = {};
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    47
$bitmap_status->{on_start} = 'RaptorReleaseable::on_start_bitmap';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    48
$bitmap_status->{on_end} = 'RaptorReleaseable::on_end_whatlog_subtag';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    49
$bitmap_status->{on_chars} = 'RaptorReleaseable::on_chars_whatlog_subtag';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    50
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    51
$resource_status->{name} = 'resource_status';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    52
$resource_status->{next_status} = {};
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    53
$resource_status->{on_start} = 'RaptorReleaseable::on_start_resource';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    54
$resource_status->{on_end} = 'RaptorReleaseable::on_end_whatlog_subtag';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    55
$resource_status->{on_chars} = 'RaptorReleaseable::on_chars_whatlog_subtag';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    56
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    57
$build_status->{name} = 'build_status';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    58
$build_status->{next_status} = {};
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    59
$build_status->{on_start} = 'RaptorReleaseable::on_start_build';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    60
$build_status->{on_end} = 'RaptorReleaseable::on_end_whatlog_subtag';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    61
$build_status->{on_chars} = 'RaptorReleaseable::on_chars_whatlog_subtag';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    62
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    63
$stringtable_status->{name} = 'stringtable_status';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    64
$stringtable_status->{next_status} = {};
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    65
$stringtable_status->{on_start} = 'RaptorReleaseable::on_start_stringtable';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    66
$stringtable_status->{on_end} = 'RaptorReleaseable::on_end_whatlog_subtag';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    67
$stringtable_status->{on_chars} = 'RaptorReleaseable::on_chars_whatlog_subtag';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    68
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    69
$archive_status->{name} = 'archive_status';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    70
$archive_status->{next_status} = {member=>$archive_member_status};
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    71
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    72
$archive_member_status->{name} = 'archive_member_status';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    73
$archive_member_status->{next_status} = {};
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    74
$archive_member_status->{on_start} = 'RaptorReleaseable::on_start_archive_member';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    75
$archive_member_status->{on_end} = 'RaptorReleaseable::on_end_whatlog_subtag';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    76
$archive_member_status->{on_chars} = 'RaptorReleaseable::on_chars_whatlog_subtag';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    77
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    78
$export_status->{name} = 'export_status';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    79
$export_status->{next_status} = {};
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    80
$export_status->{on_start} = 'RaptorReleaseable::on_start_export';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    81
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    82
$whatlog_default_status->{name} = 'whatlog_default_status';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    83
$whatlog_default_status->{next_status} = {};
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    84
$whatlog_default_status->{on_start} = 'RaptorReleaseable::on_start_whatlog_default';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    85
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    86
my $whatlog_info = {};
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    87
my $curbldinf = 'unknown';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    88
my $curconfig = 'unknown';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    89
my $curfiletype = 'unknown';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    90
my $characters = '';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    91
336
08d0bd91ad20 Fix again releaseables dir not existing as erroronmissing dir is not supported
Dario Sestito <darios@symbian.org>
parents: 242
diff changeset
    92
sub on_start_buildlog
08d0bd91ad20 Fix again releaseables dir not existing as erroronmissing dir is not supported
Dario Sestito <darios@symbian.org>
parents: 242
diff changeset
    93
{
08d0bd91ad20 Fix again releaseables dir not existing as erroronmissing dir is not supported
Dario Sestito <darios@symbian.org>
parents: 242
diff changeset
    94
	mkdir("$::basedir/releaseables");
08d0bd91ad20 Fix again releaseables dir not existing as erroronmissing dir is not supported
Dario Sestito <darios@symbian.org>
parents: 242
diff changeset
    95
}
08d0bd91ad20 Fix again releaseables dir not existing as erroronmissing dir is not supported
Dario Sestito <darios@symbian.org>
parents: 242
diff changeset
    96
242
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    97
sub on_start_whatlog
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    98
{
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    99
	my ($el) = @_;
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   100
	
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   101
	$whatlog_info = {};
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   102
	
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   103
	my $bldinf = '';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   104
	my $config = '';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   105
	my $attributes = $el->{Attributes};
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   106
	for (keys %{$attributes})
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   107
	{
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   108
		#print "reading attribute $_\n";
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   109
		if ($attributes->{$_}->{'LocalName'} eq 'bldinf')
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   110
		{
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   111
			$bldinf = $attributes->{$_}->{'Value'};
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   112
			#print "bldinf=$bldinf\n";
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   113
		}
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   114
		elsif ($attributes->{$_}->{'LocalName'} eq 'config')
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   115
		{
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   116
			$config = $attributes->{$_}->{'Value'};
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   117
			$config =~ s,\.whatlog$,,;
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   118
		}
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   119
	}
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   120
	
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   121
	if ($bldinf eq '')
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   122
	{
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   123
		print "WARNING: whatlog tag with no bldinf attribute. Skipping\n";
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   124
		return;
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   125
	}
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   126
	
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   127
	$curbldinf = $bldinf;
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   128
	$curconfig = $config;
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   129
	$whatlog_info->{$curbldinf} = {} if (!defined $whatlog_info->{$curbldinf});
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   130
	$whatlog_info->{$curbldinf}->{$curconfig} = {} if (!defined $whatlog_info->{$curbldinf}->{$curconfig});
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   131
}
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   132
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   133
sub on_start_whatlog_subtag
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   134
{
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   135
	my ($ft) = @_;
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   136
	
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   137
	$curfiletype = $ft;
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   138
	$characters = '';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   139
	$whatlog_info->{$curbldinf}->{$curconfig}->{$curfiletype} = [] if (! defined $whatlog_info->{$curbldinf}->{$curconfig}->{$curfiletype});
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   140
}
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   141
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   142
sub on_chars_whatlog_subtag
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   143
{
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   144
	my ($ch) = @_;
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   145
	
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   146
	$characters .= $ch->{Data};
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   147
	
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   148
	#print "characters is now -->$characters<--\n";
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   149
}
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   150
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   151
sub on_end_whatlog_subtag
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   152
{
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   153
	$characters = normalize_filepath($characters);
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   154
	
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   155
	push(@{$whatlog_info->{$curbldinf}->{$curconfig}->{$curfiletype}}, $characters);
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   156
	
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   157
	$curfiletype = 'unknown';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   158
	$characters = '';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   159
}
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   160
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   161
sub on_start_bitmap
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   162
{
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   163
	on_start_whatlog_subtag('bitmap');
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   164
}
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   165
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   166
sub on_start_resource
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   167
{
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   168
	on_start_whatlog_subtag('resource');
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   169
}
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   170
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   171
sub on_start_build
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   172
{
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   173
	on_start_whatlog_subtag('build');
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   174
}
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   175
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   176
sub on_start_stringtable
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   177
{
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   178
	on_start_whatlog_subtag('stringtable');
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   179
}
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   180
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   181
sub on_start_archive_member
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   182
{
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   183
	on_start_whatlog_subtag('export');
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   184
}
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   185
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   186
sub on_start_export
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   187
{
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   188
	my ($el) = @_;
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   189
	
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   190
	$whatlog_info->{$curbldinf}->{$curconfig}->{export} = [] if (! defined $whatlog_info->{$curbldinf}->{$curconfig}->{export});
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   191
	
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   192
	my $destination = '';
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   193
	my $attributes = $el->{Attributes};
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   194
	for (keys %{$attributes})
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   195
	{
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   196
		#print "reading attribute $_\n";
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   197
		if ($attributes->{$_}->{'LocalName'} eq 'destination')
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   198
		{
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   199
			$destination = $attributes->{$_}->{'Value'};
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   200
			#print "destination=$destination\n";
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   201
			last;
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   202
		}
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   203
	}
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   204
	
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   205
	if ($destination eq '')
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   206
	{
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   207
		print "WARNING: export tag with no destination attribute. Skipping\n";
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   208
		return;
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   209
	}
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   210
	
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   211
	$destination = normalize_filepath($destination);
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   212
	
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   213
	push(@{$whatlog_info->{$curbldinf}->{$curconfig}->{export}}, $destination);
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   214
}
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   215
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   216
sub on_end_whatlog
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   217
{
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   218
	my $unknown_counter = 0;
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   219
	
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   220
	for my $bldinf (keys %{$whatlog_info})
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   221
	{
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   222
		for my $config (keys %{$whatlog_info->{$bldinf}})
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   223
		{
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   224
			my $normalized = lc($bldinf);
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   225
			$normalized =~ s,^[A-Za-z]:,,;
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   226
			$normalized =~ s,[\\],/,g;
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   227
			
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   228
			$normalized =~ m,^/sf/([^/]+)/([^/]+)/,;
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   229
			my $layer = $1;
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   230
			my $package = $2;
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   231
			
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   232
			mkdir("$::basedir/releaseables/$layer");
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   233
			mkdir("$::basedir/releaseables/$layer/$package");
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   234
			
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   235
			my $filename = "$::basedir/releaseables/$layer/$package/info.tsv";
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   236
			
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   237
			print "Writing info file $filename\n" if (!-f$filename);
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   238
			open(FILE, ">>$filename");
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   239
			
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   240
			for my $filetype (keys %{$whatlog_info->{$bldinf}->{$config}})
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   241
			{
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   242
				for (sort(@{$whatlog_info->{$bldinf}->{$config}->{$filetype}}))
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   243
				{
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   244
					print FILE "$_\t$filetype\t$config\n";
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   245
				}
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   246
			}
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   247
			
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   248
			close(FILE);
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   249
		}
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   250
	}
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   251
}
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   252
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   253
sub normalize_filepath
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   254
{
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   255
	my ($filepath) = @_;
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   256
	
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   257
	if ($filepath =~ m,[^\s^\r^\n]+(.*)[\r\n]+(.*)[^\s^\r^\n]+,)
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   258
	{
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   259
		print "WARNING: file path string extends over multiple line: $filepath. Removing all NL's and CR's\n";
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   260
	}
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   261
	
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   262
	# strip all CR's and NL's
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   263
	$filepath =~ s,[\r\n],,g;
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   264
	
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   265
	# strip all whitespaces at string start/end
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   266
	$filepath =~ s,^\s+,,g;
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   267
	$filepath =~ s,\s+$,,g;
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   268
	
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   269
	# remove drive letter and colon from the beginning of the string
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   270
	$filepath =~ s,^[A-Za-z]:,,;
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   271
	
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   272
	# normalize slashes
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   273
	$filepath =~ s,\\,/,g;
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   274
	$filepath =~ s,//,/,g;
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   275
	
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   276
	if ($filepath !~ m,^/epoc32/,i)
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   277
	{
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   278
		print "WARNING: file '$filepath' doesn't seem valid. Writing to info file anyway\n";
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   279
	}
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   280
	
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   281
	return $filepath;
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   282
}
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   283
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   284
sub on_start_whatlog_default
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   285
{
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   286
	my ($el) = @_;
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   287
	
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   288
	my $tagname = $el->{LocalName};
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   289
	
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   290
	print "WARNING: unsupported tag '$tagname' in <whatlog> context\n";
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   291
}
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   292
51e429810aba Modularized Raptor parser scripts
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   293
1;