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