# HG changeset patch # User Dario Sestito # Date 1247481510 -3600 # Node ID 51e429810aba4d757d0b7a077ff3d217f9b789d9 # Parent c451bd0c0782c5144422db4ecc7dc3ce49953451 Modularized Raptor parser scripts diff -r c451bd0c0782 -r 51e429810aba common/build.xml --- a/common/build.xml Thu Jul 09 14:24:10 2009 +0100 +++ b/common/build.xml Mon Jul 13 11:38:30 2009 +0100 @@ -812,9 +812,10 @@ - + + - + diff -r c451bd0c0782 -r 51e429810aba common/templates/truclean.ant.xml.ftl --- a/common/templates/truclean.ant.xml.ftl Thu Jul 09 14:24:10 2009 +0100 +++ b/common/templates/truclean.ant.xml.ftl Mon Jul 13 11:38:30 2009 +0100 @@ -13,7 +13,7 @@ - + diff -r c451bd0c0782 -r 51e429810aba common/tools/raptor/RaptorCommon.pm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/raptor/RaptorCommon.pm Mon Jul 13 11:38:30 2009 +0100 @@ -0,0 +1,23 @@ +# Copyright (c) 2009 Symbian Foundation Ltd +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Symbian Foundation Ltd - initial contribution. +# +# Contributors: +# +# Description: +# Common constants for the raptor parser suite + +package RaptorCommon; + +our $CATEGORY_GENERAL = 'general'; +our $CATEGORY_RAPTORERROR = 'raptor_error'; + +our $SEVERITY_UNKNOWN = 'unknown'; +our $SEVERITY_CRITICAL = 'critical'; + +1; diff -r c451bd0c0782 -r 51e429810aba common/tools/raptor/RaptorError.pm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/raptor/RaptorError.pm Mon Jul 13 11:38:30 2009 +0100 @@ -0,0 +1,89 @@ +# Copyright (c) 2009 Symbian Foundation Ltd +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Symbian Foundation Ltd - initial contribution. +# +# Contributors: +# +# Description: +# Raptor parser module. +# Extract, analyzes and dumps raptor errors i.e. content of tags from a raptor log file + +package RaptorError; + +use strict; +use RaptorCommon; + +our $reset_status = {}; +my $buildlog_status = {}; +my $buildlog_error_status = {}; + +$reset_status->{name} = 'reset_status'; +$reset_status->{next_status} = {buildlog=>$buildlog_status}; + +$buildlog_status->{name} = 'buildlog_status'; +$buildlog_status->{next_status} = {error=>$buildlog_error_status}; + +$buildlog_error_status->{name} = 'buildlog_error_status'; +$buildlog_error_status->{next_status} = {}; +$buildlog_error_status->{on_start} = 'RaptorError::on_start_buildlog_error'; +$buildlog_error_status->{on_end} = 'RaptorError::on_end_buildlog_error'; +$buildlog_error_status->{on_chars} = 'RaptorError::on_chars_buildlog_error'; + +my $characters = ''; + +my $category = $RaptorCommon::CATEGORY_RAPTORERROR; + +sub process +{ + my ($text) = @_; + + my $severity = $RaptorCommon::SEVERITY_UNKNOWN; + + if ($text =~ m,Cannot process schema version .* of file,) + { + $severity = $RaptorCommon::SEVERITY_CRITICAL; + + #dump_error($category, $severity, $text); + print "$category, $severity, $text\n"; + } +} + +sub on_start_buildlog_error +{ + my $filename = "$::basedir/errors.txt"; + print "Writing error file $filename\n" if (!-f$filename); + open(FILE, ">>$filename"); +} + +sub on_chars_buildlog_error +{ + my ($ch) = @_; + + #print "on_chars_buildlog_error\n"; + + $characters .= $ch->{Data}; + + #print "characters is now -->$characters<--\n"; +} + +sub on_end_buildlog_error +{ + #print "on_end_buildlog_error\n"; + + process($characters); + + print FILE $characters if ($characters =~ m,[^\s^\r^\n],); + print FILE "\n" if ($characters !~ m,[\r\n]$, ); + + $characters = ''; + + close(FILE); +} + + +1; \ No newline at end of file diff -r c451bd0c0782 -r 51e429810aba common/tools/raptor/RaptorInfo.pm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/raptor/RaptorInfo.pm Mon Jul 13 11:38:30 2009 +0100 @@ -0,0 +1,89 @@ +# Copyright (c) 2009 Symbian Foundation Ltd +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Symbian Foundation Ltd - initial contribution. +# +# Contributors: +# +# Description: +# Raptor parser module. +# Extract, analyzes and dumps raptor info text i.e. content of tags from a raptor log file + +package RaptorInfo; + +use strict; +use RaptorCommon; + +our $reset_status = {}; +my $buildlog_status = {}; +my $buildlog_info_status = {}; + +$reset_status->{name} = 'reset_status'; +$reset_status->{next_status} = {buildlog=>$buildlog_status}; + +$buildlog_status->{name} = 'buildlog_status'; +$buildlog_status->{next_status} = {info=>$buildlog_info_status}; + +$buildlog_info_status->{name} = 'buildlog_info_status'; +$buildlog_info_status->{next_status} = {}; +$buildlog_info_status->{on_start} = 'RaptorInfo::on_start_buildlog_info'; +$buildlog_info_status->{on_end} = 'RaptorInfo::on_end_buildlog_info'; +$buildlog_info_status->{on_chars} = 'RaptorInfo::on_chars_buildlog_info'; + +my $characters = ''; + +my $category = $RaptorCommon::CATEGORY_RAPTORINFO; + +sub process +{ + my ($text) = @_; + + my $severity = $RaptorCommon::SEVERITY_UNKNOWN; + + if ($text =~ m,unmatchable,) + { + $severity = $RaptorCommon::SEVERITY_CRITICAL; + + #dump_error($category, $severity, $text); + print "$category, $severity, $text\n"; + } +} + +sub on_start_buildlog_info +{ + my $filename = "$::basedir/info.txt"; + print "Writing info file $filename\n" if (!-f$filename); + open(FILE, ">>$filename"); +} + +sub on_chars_buildlog_info +{ + my ($ch) = @_; + + #print "on_chars_buildlog_info\n"; + + $characters .= $ch->{Data}; + + #print "characters is now -->$characters<--\n"; +} + +sub on_end_buildlog_info +{ + #print "on_end_buildlog_info\n"; + + process($characters); + + print FILE $characters if ($characters =~ m,[^\s^\r^\n],); + print FILE "\n" if ($characters !~ m,[\r\n]$, ); + + $characters = ''; + + close(FILE); +} + + +1; \ No newline at end of file diff -r c451bd0c0782 -r 51e429810aba common/tools/raptor/RaptorRecipe.pm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/raptor/RaptorRecipe.pm Mon Jul 13 11:38:30 2009 +0100 @@ -0,0 +1,128 @@ +# Copyright (c) 2009 Symbian Foundation Ltd +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Symbian Foundation Ltd - initial contribution. +# +# Contributors: +# +# Description: +# Raptor parser module. +# Extract, analyzes and dumps raptor recipes i.e. content of tags from a raptor log file + +package RaptorRecipe; + +use strict; +use RaptorCommon; + +our $reset_status = {}; +my $buildlog_status = {}; +my $buildlog_recipe_status = {}; + +$reset_status->{name} = 'reset_status'; +$reset_status->{next_status} = {buildlog=>$buildlog_status}; + +$buildlog_status->{name} = 'buildlog_status'; +$buildlog_status->{next_status} = {recipe=>$buildlog_recipe_status}; + +$buildlog_recipe_status->{name} = 'buildlog_recipe_status'; +$buildlog_recipe_status->{next_status} = {}; +$buildlog_recipe_status->{on_start} = 'RaptorRecipe::on_start_buildlog_recipe'; +$buildlog_recipe_status->{on_end} = 'RaptorRecipe::on_end_buildlog_recipe'; +$buildlog_recipe_status->{on_chars} = 'RaptorRecipe::on_chars_buildlog_recipe'; + +my $characters = ''; +my $recipe_info = {}; + +my $category = $RaptorCommon::CATEGORY_RAPTORRECIPE; + +sub process +{ + my ($text) = @_; + + my $severity = $RaptorCommon::SEVERITY_UNKNOWN; + + if ($text =~ m,Cannot process schema version .* of file,) + { + $severity = $RaptorCommon::SEVERITY_CRITICAL; + + #dump_recipe($category, $severity, $text); + print "$category, $severity, $text\n"; + } +} + +sub on_start_buildlog_recipe +{ + my ($el) = @_; + + $recipe_info = {}; + $characters = ''; + + my $attrstring = ''; + my $bldinf = ''; + + my $attributes = $el->{Attributes}; + for (keys %{$attributes}) + { + if ($attributes->{$_}->{'LocalName'} eq 'bldinf') + { + $bldinf = $attributes->{$_}->{'Value'}; + } + + $attrstring .= "$attributes->{$_}->{'LocalName'}}='$attributes->{$_}->{'Value'}' "; + + } + + if ($bldinf eq '') + { + print "WARNING: recipe tag with no bldinf attribute. Associating to package unknown/unknown\n"; + $bldinf = "/sf/unknown/unknown/group/bld.inf"; + } + + $recipe_info->{bldinf} = $bldinf; + + $characters = "\n"; +} + +sub on_chars_buildlog_recipe +{ + my ($ch) = @_; + + #print "on_chars_buildlog_recipe\n"; + + $characters .= $ch->{Data}; + + #print "characters is now -->$characters<--\n"; +} + +sub on_end_buildlog_recipe +{ + #print "on_end_buildlog_recipe\n"; + + $characters .= "\n\n"; + + my $normalized = lc($recipe_info->{bldinf}); + $normalized =~ s,^[A-Za-z]:,,; + $normalized =~ s,[\\],/,g; + + $normalized =~ m,^/sf/([^/]+)/([^/]+)/,; + my $layer = $1; + my $package = $2; + + mkdir("$::basedir/recipes"); + mkdir("$::basedir/recipes/$layer"); + mkdir("$::basedir/recipes/$layer/$package"); + + my $filename = "$::basedir/recipes/$layer/$package/recipes.txt"; + + print "Writing recipes file $filename\n" if (!-f$filename); + open(FILE, ">>$filename"); + print FILE $characters; + close(FILE); +} + + +1; \ No newline at end of file diff -r c451bd0c0782 -r 51e429810aba common/tools/raptor/RaptorReleaseable.pm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/raptor/RaptorReleaseable.pm Mon Jul 13 11:38:30 2009 +0100 @@ -0,0 +1,288 @@ +# Copyright (c) 2009 Symbian Foundation Ltd +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Symbian Foundation Ltd - initial contribution. +# +# Contributors: +# +# Description: +# Raptor parser module. +# Extract releaseable (whatlog) information + +package RaptorReleaseable; + +use strict; +use RaptorCommon; + +our $reset_status = {}; +my $buildlog_status = {}; +my $whatlog_status = {}; +my $bitmap_status = {}; +my $resource_status = {}; +my $build_status = {}; +my $export_status = {}; +my $stringtable_status = {}; +my $archive_status = {}; +my $archive_member_status = {}; +my $whatlog_default_status = {}; + +$reset_status->{name} = 'reset_status'; +$reset_status->{next_status} = {buildlog=>$buildlog_status}; + +$buildlog_status->{name} = 'buildlog_status'; +$buildlog_status->{next_status} = {whatlog=>$whatlog_status}; + +$whatlog_status->{name} = 'whatlog_status'; +$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}; +$whatlog_status->{on_start} = 'RaptorReleaseable::on_start_whatlog'; +$whatlog_status->{on_end} = 'RaptorReleaseable::on_end_whatlog'; + +$bitmap_status->{name} = 'bitmap_status'; +$bitmap_status->{next_status} = {}; +$bitmap_status->{on_start} = 'RaptorReleaseable::on_start_bitmap'; +$bitmap_status->{on_end} = 'RaptorReleaseable::on_end_whatlog_subtag'; +$bitmap_status->{on_chars} = 'RaptorReleaseable::on_chars_whatlog_subtag'; + +$resource_status->{name} = 'resource_status'; +$resource_status->{next_status} = {}; +$resource_status->{on_start} = 'RaptorReleaseable::on_start_resource'; +$resource_status->{on_end} = 'RaptorReleaseable::on_end_whatlog_subtag'; +$resource_status->{on_chars} = 'RaptorReleaseable::on_chars_whatlog_subtag'; + +$build_status->{name} = 'build_status'; +$build_status->{next_status} = {}; +$build_status->{on_start} = 'RaptorReleaseable::on_start_build'; +$build_status->{on_end} = 'RaptorReleaseable::on_end_whatlog_subtag'; +$build_status->{on_chars} = 'RaptorReleaseable::on_chars_whatlog_subtag'; + +$stringtable_status->{name} = 'stringtable_status'; +$stringtable_status->{next_status} = {}; +$stringtable_status->{on_start} = 'RaptorReleaseable::on_start_stringtable'; +$stringtable_status->{on_end} = 'RaptorReleaseable::on_end_whatlog_subtag'; +$stringtable_status->{on_chars} = 'RaptorReleaseable::on_chars_whatlog_subtag'; + +$archive_status->{name} = 'archive_status'; +$archive_status->{next_status} = {member=>$archive_member_status}; + +$archive_member_status->{name} = 'archive_member_status'; +$archive_member_status->{next_status} = {}; +$archive_member_status->{on_start} = 'RaptorReleaseable::on_start_archive_member'; +$archive_member_status->{on_end} = 'RaptorReleaseable::on_end_whatlog_subtag'; +$archive_member_status->{on_chars} = 'RaptorReleaseable::on_chars_whatlog_subtag'; + +$export_status->{name} = 'export_status'; +$export_status->{next_status} = {}; +$export_status->{on_start} = 'RaptorReleaseable::on_start_export'; + +$whatlog_default_status->{name} = 'whatlog_default_status'; +$whatlog_default_status->{next_status} = {}; +$whatlog_default_status->{on_start} = 'RaptorReleaseable::on_start_whatlog_default'; + +my $whatlog_info = {}; +my $curbldinf = 'unknown'; +my $curconfig = 'unknown'; +my $curfiletype = 'unknown'; +my $characters = ''; + +sub on_start_whatlog +{ + my ($el) = @_; + + $whatlog_info = {}; + + my $bldinf = ''; + my $config = ''; + my $attributes = $el->{Attributes}; + for (keys %{$attributes}) + { + #print "reading attribute $_\n"; + if ($attributes->{$_}->{'LocalName'} eq 'bldinf') + { + $bldinf = $attributes->{$_}->{'Value'}; + #print "bldinf=$bldinf\n"; + } + elsif ($attributes->{$_}->{'LocalName'} eq 'config') + { + $config = $attributes->{$_}->{'Value'}; + $config =~ s,\.whatlog$,,; + } + } + + if ($bldinf eq '') + { + print "WARNING: whatlog tag with no bldinf attribute. Skipping\n"; + return; + } + + $curbldinf = $bldinf; + $curconfig = $config; + $whatlog_info->{$curbldinf} = {} if (!defined $whatlog_info->{$curbldinf}); + $whatlog_info->{$curbldinf}->{$curconfig} = {} if (!defined $whatlog_info->{$curbldinf}->{$curconfig}); +} + +sub on_start_whatlog_subtag +{ + my ($ft) = @_; + + $curfiletype = $ft; + $characters = ''; + $whatlog_info->{$curbldinf}->{$curconfig}->{$curfiletype} = [] if (! defined $whatlog_info->{$curbldinf}->{$curconfig}->{$curfiletype}); +} + +sub on_chars_whatlog_subtag +{ + my ($ch) = @_; + + $characters .= $ch->{Data}; + + #print "characters is now -->$characters<--\n"; +} + +sub on_end_whatlog_subtag +{ + $characters = normalize_filepath($characters); + + push(@{$whatlog_info->{$curbldinf}->{$curconfig}->{$curfiletype}}, $characters); + + $curfiletype = 'unknown'; + $characters = ''; +} + +sub on_start_bitmap +{ + on_start_whatlog_subtag('bitmap'); +} + +sub on_start_resource +{ + on_start_whatlog_subtag('resource'); +} + +sub on_start_build +{ + on_start_whatlog_subtag('build'); +} + +sub on_start_stringtable +{ + on_start_whatlog_subtag('stringtable'); +} + +sub on_start_archive_member +{ + on_start_whatlog_subtag('export'); +} + +sub on_start_export +{ + my ($el) = @_; + + $whatlog_info->{$curbldinf}->{$curconfig}->{export} = [] if (! defined $whatlog_info->{$curbldinf}->{$curconfig}->{export}); + + my $destination = ''; + my $attributes = $el->{Attributes}; + for (keys %{$attributes}) + { + #print "reading attribute $_\n"; + if ($attributes->{$_}->{'LocalName'} eq 'destination') + { + $destination = $attributes->{$_}->{'Value'}; + #print "destination=$destination\n"; + last; + } + } + + if ($destination eq '') + { + print "WARNING: export tag with no destination attribute. Skipping\n"; + return; + } + + $destination = normalize_filepath($destination); + + push(@{$whatlog_info->{$curbldinf}->{$curconfig}->{export}}, $destination); +} + +sub on_end_whatlog +{ + my $unknown_counter = 0; + + for my $bldinf (keys %{$whatlog_info}) + { + for my $config (keys %{$whatlog_info->{$bldinf}}) + { + my $normalized = lc($bldinf); + $normalized =~ s,^[A-Za-z]:,,; + $normalized =~ s,[\\],/,g; + + $normalized =~ m,^/sf/([^/]+)/([^/]+)/,; + my $layer = $1; + my $package = $2; + + mkdir("$::basedir/releaseables"); + mkdir("$::basedir/releaseables/$layer"); + mkdir("$::basedir/releaseables/$layer/$package"); + + my $filename = "$::basedir/releaseables/$layer/$package/info.tsv"; + + print "Writing info file $filename\n" if (!-f$filename); + open(FILE, ">>$filename"); + + for my $filetype (keys %{$whatlog_info->{$bldinf}->{$config}}) + { + for (sort(@{$whatlog_info->{$bldinf}->{$config}->{$filetype}})) + { + print FILE "$_\t$filetype\t$config\n"; + } + } + + close(FILE); + } + } +} + +sub normalize_filepath +{ + my ($filepath) = @_; + + if ($filepath =~ m,[^\s^\r^\n]+(.*)[\r\n]+(.*)[^\s^\r^\n]+,) + { + print "WARNING: file path string extends over multiple line: $filepath. Removing all NL's and CR's\n"; + } + + # strip all CR's and NL's + $filepath =~ s,[\r\n],,g; + + # strip all whitespaces at string start/end + $filepath =~ s,^\s+,,g; + $filepath =~ s,\s+$,,g; + + # remove drive letter and colon from the beginning of the string + $filepath =~ s,^[A-Za-z]:,,; + + # normalize slashes + $filepath =~ s,\\,/,g; + $filepath =~ s,//,/,g; + + if ($filepath !~ m,^/epoc32/,i) + { + print "WARNING: file '$filepath' doesn't seem valid. Writing to info file anyway\n"; + } + + return $filepath; +} + +sub on_start_whatlog_default +{ + my ($el) = @_; + + my $tagname = $el->{LocalName}; + + print "WARNING: unsupported tag '$tagname' in context\n"; +} + +1; \ No newline at end of file diff -r c451bd0c0782 -r 51e429810aba common/tools/raptor/RaptorSAXHandler.pm --- a/common/tools/raptor/RaptorSAXHandler.pm Thu Jul 09 14:24:10 2009 +0100 +++ b/common/tools/raptor/RaptorSAXHandler.pm Mon Jul 13 11:38:30 2009 +0100 @@ -22,11 +22,13 @@ return bless {}, $type; } -sub set_init_status +sub add_observer { - my ($self, $initialstatus) = @_; + my ($self, $name, $initialstatus) = @_; - $self->{status} = $initialstatus; + $self->{observers} = {} if (!defined $self->{observers}); + + $self->{observers}->{$name} = $initialstatus; } sub start_document @@ -46,23 +48,30 @@ #print "start_element($tagname)\n"; - - if (defined $self->{status}->{next_status}->{$tagname}) + for my $observer (keys %{$self->{observers}}) { - my $oldstatus = $self->{status}; - $self->{status} = $self->{status}->{next_status}->{$tagname}; - #print "status is now $self->{status}->{name}\n"; - $self->{status}->{next_status}->{$tagname} = $oldstatus; - &{$self->{status}->{on_start}}($el) if (defined $self->{status}->{on_start}); - } - elsif (defined $self->{status}->{next_status}->{'?default?'}) - { - #print "changing to default status\n"; - my $oldstatus = $self->{status}; - $self->{status} = $self->{status}->{next_status}->{'?default?'}; - #print "status is now ?default?\n"; - $self->{status}->{next_status}->{$tagname} = $oldstatus; - &{$self->{status}->{on_start}}($el) if (defined $self->{status}->{on_start}); + #print "processing observer $observer: $self->{observers}->{$observer} $self->{observers}->{$observer}->{name}\n"; + #for (keys %{$self->{observers}->{$observer}->{next_status}}) {print "$_\n";} + + if (defined $self->{observers}->{$observer}->{next_status}->{$tagname}) + { + #print "processing observer $observer\n"; + my $oldstatus = $self->{observers}->{$observer}; + $self->{observers}->{$observer} = $self->{observers}->{$observer}->{next_status}->{$tagname}; + #print "$observer: status is now $self->{observers}->{$observer}->{name}\n"; + $self->{observers}->{$observer}->{next_status}->{$tagname} = $oldstatus; + &{$self->{observers}->{$observer}->{on_start}}($el) if (defined $self->{observers}->{$observer}->{on_start}); + } + elsif (defined $self->{observers}->{$observer}->{next_status}->{'?default?'}) + { + #print "processing observer $observer\n"; + #print "changing to default status\n"; + my $oldstatus = $self->{observers}->{$observer}; + $self->{observers}->{$observer} = $self->{observers}->{$observer}->{next_status}->{'?default?'}; + #print "status is now ?default?\n"; + $self->{observers}->{$observer}->{next_status}->{$tagname} = $oldstatus; + &{$self->{observers}->{$observer}->{on_start}}($el) if (defined $self->{observers}->{$observer}->{on_start}); + } } } @@ -75,11 +84,14 @@ #print "end_element($tagname)\n"; - if (defined $self->{status}->{next_status}->{$tagname}) + for my $observer (keys %{$self->{observers}}) { - &{$self->{status}->{on_end}}($el) if (defined $self->{status}->{on_end}); - $self->{status} = $self->{status}->{next_status}->{$tagname}; - #print "status is now $self->{status}->{name}\n"; + if (defined $self->{observers}->{$observer}->{next_status}->{$tagname}) + { + &{$self->{observers}->{$observer}->{on_end}}($el) if (defined $self->{observers}->{$observer}->{on_end}); + $self->{observers}->{$observer} = $self->{observers}->{$observer}->{next_status}->{$tagname}; + #print "status is now $self->{observers}->{$observer}->{name}\n"; + } } } @@ -87,7 +99,10 @@ { my ($self, $ch) = @_; - &{$self->{status}->{on_chars}}($ch) if (defined $self->{status}->{on_chars}); + for my $observer (keys %{$self->{observers}}) + { + &{$self->{observers}->{$observer}->{on_chars}}($ch) if (defined $self->{observers}->{$observer}->{on_chars}); + } } 1; diff -r c451bd0c0782 -r 51e429810aba common/tools/raptor/RaptorUnreciped.pm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/raptor/RaptorUnreciped.pm Mon Jul 13 11:38:30 2009 +0100 @@ -0,0 +1,63 @@ +# Copyright (c) 2009 Symbian Foundation Ltd +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Symbian Foundation Ltd - initial contribution. +# +# Contributors: +# +# Description: +# Raptor parser module. +# Extract, analyzes and dumps text in context which doesn't belong to any tags + +package RaptorUnreciped; + +use strict; +use RaptorCommon; + +our $reset_status = {}; +my $buildlog_status = {}; +my $buildlog_subtag_status = {}; + +$reset_status->{name} = 'reset_status'; +$reset_status->{next_status} = {buildlog=>$buildlog_status}; + +$buildlog_status->{name} = 'buildlog_status'; +$buildlog_status->{next_status} = {'?default?'=>$buildlog_subtag_status}; +$buildlog_status->{on_start} = 'RaptorUnreciped::on_start_buildlog'; +$buildlog_status->{on_end} = 'RaptorUnreciped::on_end_buildlog'; +$buildlog_status->{on_chars} = 'RaptorUnreciped::on_chars_buildlog'; + +$buildlog_subtag_status->{name} = 'buildlog_subtag_status'; +$buildlog_subtag_status->{next_status} = {}; + +my $characters = ''; + +sub on_start_buildlog +{ + my $filename = "$::basedir/unreciped.txt"; + print "Writing unreciped file $filename\n" if (!-f$filename); + open(FILE, ">>$filename"); +} + +sub on_chars_buildlog +{ + my ($ch) = @_; + + my $characters = $ch->{Data}; + + print FILE $characters if ($characters =~ m,[^\s^\r^\n],); + + #print "characters is now -->$characters<--\n"; +} + +sub on_end_buildlog +{ + close(FILE); +} + + +1; \ No newline at end of file diff -r c451bd0c0782 -r 51e429810aba common/tools/raptor/RaptorWarning.pm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/raptor/RaptorWarning.pm Mon Jul 13 11:38:30 2009 +0100 @@ -0,0 +1,89 @@ +# Copyright (c) 2009 Symbian Foundation Ltd +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Symbian Foundation Ltd - initial contribution. +# +# Contributors: +# +# Description: +# Raptor parser module. +# Extract, analyzes and dumps raptor warnings i.e. content of tags from a raptor log file + +package RaptorWarning; + +use strict; +use RaptorCommon; + +our $reset_status = {}; +my $buildlog_status = {}; +my $buildlog_warning_status = {}; + +$reset_status->{name} = 'reset_status'; +$reset_status->{next_status} = {buildlog=>$buildlog_status}; + +$buildlog_status->{name} = 'buildlog_status'; +$buildlog_status->{next_status} = {warning=>$buildlog_warning_status}; + +$buildlog_warning_status->{name} = 'buildlog_warning_status'; +$buildlog_warning_status->{next_status} = {}; +$buildlog_warning_status->{on_start} = 'RaptorWarning::on_start_buildlog_warning'; +$buildlog_warning_status->{on_end} = 'RaptorWarning::on_end_buildlog_warning'; +$buildlog_warning_status->{on_chars} = 'RaptorWarning::on_chars_buildlog_warning'; + +my $characters = ''; + +my $category = $RaptorCommon::CATEGORY_RAPTORWARNING; + +sub process +{ + my ($text) = @_; + + my $severity = $RaptorCommon::SEVERITY_UNKNOWN; + + if ($text =~ m,unmatchable,) + { + $severity = $RaptorCommon::SEVERITY_CRITICAL; + + #dump_error($category, $severity, $text); + print "$category, $severity, $text\n"; + } +} + +sub on_start_buildlog_warning +{ + my $filename = "$::basedir/warnings.txt"; + print "Writing warning file $filename\n" if (!-f$filename); + open(FILE, ">>$filename"); +} + +sub on_chars_buildlog_warning +{ + my ($ch) = @_; + + #print "on_chars_buildlog_warning\n"; + + $characters .= $ch->{Data}; + + #print "characters is now -->$characters<--\n"; +} + +sub on_end_buildlog_warning +{ + #print "on_end_buildlog_warning\n"; + + process($characters); + + print FILE $characters if ($characters =~ m,[^\s^\r^\n],); + print FILE "\n" if ($characters !~ m,[\r\n]$, ); + + $characters = ''; + + close(FILE); +} + + +1; \ No newline at end of file diff -r c451bd0c0782 -r 51e429810aba common/tools/raptor/package_what.pl --- a/common/tools/raptor/package_what.pl Thu Jul 09 14:24:10 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,340 +0,0 @@ -# Copyright (c) 2009 Symbian Foundation Ltd -# This component and the accompanying materials are made available -# under the terms of the License "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Symbian Foundation Ltd - initial contribution. -# -# Contributors: -# -# Description: -# Extracts whatlog information from a raptor log file - -use strict; - -use XML::SAX; -use RaptorSAXHandler; -use Getopt::Long; - -my @logfiles; -my $basedir = ''; -my $append = 0; -my $help = 0; -GetOptions(( - 'log:s' => \@logfiles, - 'basedir:s' => \$basedir, - 'append!' => \$append, - 'help!' => \$help -)); - -$help = 1 if (!@logfiles); - -if ($help) -{ - print "Extracts whatlog information from a raptor log file\n"; - print "Usage: perl package_what.pl --log=FILE1 --log=FILE2 [OPTIONS]\n"; - print "where OPTIONS are:\n"; - print "\t--basedir=DIR Generate info files under DIR\n"; - print "\t--append Do not stop if basedir exists but append newly extracted info to already existing.\n"; - exit(0); -} - -my $reset_status = {}; -my $buildlog_status = {}; -my $whatlog_status = {}; -my $bitmap_status = {}; -my $resource_status = {}; -my $build_status = {}; -my $export_status = {}; -my $stringtable_status = {}; -my $archive_status = {}; -my $archive_member_status = {}; -my $whatlog_default_status = {}; - -$reset_status->{name} = 'reset_status'; -$reset_status->{next_status} = {buildlog=>$buildlog_status}; - -$buildlog_status->{name} = 'buildlog_status'; -$buildlog_status->{next_status} = {whatlog=>$whatlog_status}; - -$whatlog_status->{name} = 'whatlog_status'; -$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}; -$whatlog_status->{on_start} = 'main::on_start_whatlog'; -$whatlog_status->{on_end} = 'main::on_end_whatlog'; - -$bitmap_status->{name} = 'bitmap_status'; -$bitmap_status->{next_status} = {}; -$bitmap_status->{on_start} = 'main::on_start_bitmap'; -$bitmap_status->{on_end} = 'main::on_end_whatlog_subtag'; -$bitmap_status->{on_chars} = 'main::on_chars_whatlog_subtag'; - -$resource_status->{name} = 'resource_status'; -$resource_status->{next_status} = {}; -$resource_status->{on_start} = 'main::on_start_resource'; -$resource_status->{on_end} = 'main::on_end_whatlog_subtag'; -$resource_status->{on_chars} = 'main::on_chars_whatlog_subtag'; - -$build_status->{name} = 'build_status'; -$build_status->{next_status} = {}; -$build_status->{on_start} = 'main::on_start_build'; -$build_status->{on_end} = 'main::on_end_whatlog_subtag'; -$build_status->{on_chars} = 'main::on_chars_whatlog_subtag'; - -$stringtable_status->{name} = 'stringtable_status'; -$stringtable_status->{next_status} = {}; -$stringtable_status->{on_start} = 'main::on_start_stringtable'; -$stringtable_status->{on_end} = 'main::on_end_whatlog_subtag'; -$stringtable_status->{on_chars} = 'main::on_chars_whatlog_subtag'; - -$archive_status->{name} = 'archive_status'; -$archive_status->{next_status} = {member=>$archive_member_status}; - -$archive_member_status->{name} = 'archive_member_status'; -$archive_member_status->{next_status} = {}; -$archive_member_status->{on_start} = 'main::on_start_archive_member'; -$archive_member_status->{on_end} = 'main::on_end_whatlog_subtag'; -$archive_member_status->{on_chars} = 'main::on_chars_whatlog_subtag'; - -$export_status->{name} = 'export_status'; -$export_status->{next_status} = {}; -$export_status->{on_start} = 'main::on_start_export'; - -$whatlog_default_status->{name} = 'whatlog_default_status'; -$whatlog_default_status->{next_status} = {}; -$whatlog_default_status->{on_start} = 'main::on_start_whatlog_default'; - -my $whatlog_info = {}; -my $curbldinf = 'unknown'; -my $curconfig = 'unknown'; -my $curfiletype = 'unknown'; -my $characters = ''; - -if (!$basedir) -{ - $basedir = time; - - print "Using $basedir as basedir.\n"; -} -if (-d $basedir) -{ - if ($append) - { - print "Directory $basedir exists. Appending new info to it.\n"; - } - else - { - print "Directory $basedir exists. Quitting.\n"; - exit(1); - } -} -mkdir($basedir); -#print "Created dir $basedir.\n"; - -my $saxhandler = RaptorSAXHandler->new(); -$saxhandler->set_init_status($reset_status); -my $parser = XML::SAX::ParserFactory->parser(Handler=>$saxhandler); -for (@logfiles) -{ - $parser->parse_uri($_); -} - - -sub on_start_whatlog -{ - my ($el) = @_; - - #print "on_start_whatlog\n"; - - $whatlog_info = {}; - - my $bldinf = ''; - my $config = ''; - my $attributes = $el->{Attributes}; - for (keys %{$attributes}) - { - #print "reading attribute $_\n"; - if ($attributes->{$_}->{'LocalName'} eq 'bldinf') - { - $bldinf = $attributes->{$_}->{'Value'}; - #print "bldinf=$bldinf\n"; - } - elsif ($attributes->{$_}->{'LocalName'} eq 'config') - { - $config = $attributes->{$_}->{'Value'}; - $config =~ s,\.whatlog$,,; - } - } - - if ($bldinf eq '') - { - print "WARNING: whatlog tag with no bldinf attribute. Skipping\n"; - return; - } - - $curbldinf = $bldinf; - $curconfig = $config; - $whatlog_info->{$curbldinf} = {} if (!defined $whatlog_info->{$curbldinf}); - $whatlog_info->{$curbldinf}->{$curconfig} = {} if (!defined $whatlog_info->{$curbldinf}->{$curconfig}); -} - -sub on_start_whatlog_subtag -{ - my ($ft) = @_; - - $curfiletype = $ft; - $characters = ''; - $whatlog_info->{$curbldinf}->{$curconfig}->{$curfiletype} = [] if (! defined $whatlog_info->{$curbldinf}->{$curconfig}->{$curfiletype}); -} - -sub on_chars_whatlog_subtag -{ - my ($ch) = @_; - - $characters .= $ch->{Data}; - - #print "characters is now -->$characters<--\n"; -} - -sub on_end_whatlog_subtag -{ - $characters = normalize_filepath($characters); - - push(@{$whatlog_info->{$curbldinf}->{$curconfig}->{$curfiletype}}, $characters); - - $curfiletype = 'unknown'; - $characters = ''; -} - -sub on_start_bitmap -{ - on_start_whatlog_subtag('bitmap'); -} - -sub on_start_resource -{ - on_start_whatlog_subtag('resource'); -} - -sub on_start_build -{ - on_start_whatlog_subtag('build'); -} - -sub on_start_stringtable -{ - on_start_whatlog_subtag('stringtable'); -} - -sub on_start_archive_member -{ - on_start_whatlog_subtag('export'); -} - -sub on_start_export -{ - my ($el) = @_; - - $whatlog_info->{$curbldinf}->{$curconfig}->{export} = [] if (! defined $whatlog_info->{$curbldinf}->{$curconfig}->{export}); - - my $destination = ''; - my $attributes = $el->{Attributes}; - for (keys %{$attributes}) - { - #print "reading attribute $_\n"; - if ($attributes->{$_}->{'LocalName'} eq 'destination') - { - $destination = $attributes->{$_}->{'Value'}; - #print "destination=$destination\n"; - last; - } - } - - if ($destination eq '') - { - print "WARNING: export tag with no destination attribute. Skipping\n"; - return; - } - - $destination = normalize_filepath($destination); - - push(@{$whatlog_info->{$curbldinf}->{$curconfig}->{export}}, $destination); -} - -sub on_end_whatlog -{ - my $unknown_counter = 0; - - for my $bldinf (keys %{$whatlog_info}) - { - for my $config (keys %{$whatlog_info->{$bldinf}}) - { - my $normalized = lc($bldinf); - $normalized =~ s,^[A-Za-z]:,,; - $normalized =~ s,[\\],/,g; - - $normalized =~ m,^/sf/([^/]+)/([^/]+)/,; - my $layer = $1; - my $package = $2; - - mkdir("$basedir/$layer"); - mkdir("$basedir/$layer/$package"); - - my $filename = "$basedir/$layer/$package/info.tsv"; - - print "Writing info file $filename\n" if (!-f$filename); - open(FILE, ">>$filename"); - - for my $filetype (keys %{$whatlog_info->{$bldinf}->{$config}}) - { - for (sort(@{$whatlog_info->{$bldinf}->{$config}->{$filetype}})) - { - print FILE "$_\t$filetype\t$config\n"; - } - } - - close(FILE); - } - } -} - -sub normalize_filepath -{ - my ($filepath) = @_; - - if ($filepath =~ m,[^\s^\r^\n]+(.*)[\r\n]+(.*)[^\s^\r^\n]+,) - { - print "WARNING: file path string extends over multiple line: $filepath. Removing all NL's and CR's\n"; - } - - # strip all CR's and NL's - $filepath =~ s,[\r\n],,g; - - # strip all whitespaces at string start/end - $filepath =~ s,^\s+,,g; - $filepath =~ s,\s+$,,g; - - # remove drive letter and colon from the beginning of the string - $filepath =~ s,^[A-Za-z]:,,; - - # normalize slashes - $filepath =~ s,\\,/,g; - $filepath =~ s,//,/,g; - - if ($filepath !~ m,^/epoc32/,i) - { - print "WARNING: file '$filepath' doesn't seem valid. Writing to info file anyway\n"; - } - - return $filepath; -} - -sub on_start_whatlog_default -{ - my ($el) = @_; - - my $tagname = $el->{LocalName}; - - print "WARNING: unsupported tag '$tagname' in context\n"; -} \ No newline at end of file diff -r c451bd0c0782 -r 51e429810aba common/tools/raptor/parse.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/raptor/parse.pl Mon Jul 13 11:38:30 2009 +0100 @@ -0,0 +1,126 @@ +# Copyright (c) 2009 Symbian Foundation Ltd +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Symbian Foundation Ltd - initial contribution. +# +# Contributors: +# +# Description: +# Run the raptor parsers + +use strict; +use RaptorReleaseable; +use RaptorError; +use RaptorWarning; +use RaptorInfo; +use RaptorUnreciped; +use RaptorRecipe; + +use XML::SAX; +use RaptorSAXHandler; +use Getopt::Long; + +my @logfiles; +my $releaseable_module = 0; +my $error_module = 0; +my $warning_module = 0; +my $info_module = 0; +my $unreciped_module = 0; +my $recipe_module = 0; +our $basedir = ''; +my $append = 0; +my $help = 0; +GetOptions(( + 'log:s' => \@logfiles, + 'releaseable!' => \$releaseable_module, + 'error!' => \$error_module, + 'warning!' => \$warning_module, + 'info!' => \$info_module, + 'unreciped!' => \$unreciped_module, + 'recipe!' => \$recipe_module, + 'basedir:s' => \$basedir, + 'append!' => \$append, + 'help!' => \$help +)); + +$help = 1 if (!@logfiles); + +if ($help) +{ + print "Run the raptor parsers\n"; + print "Usage: perl parse.pl [MODULES] --log=FILE1 --log=FILE2 ... [OPTIONS]\n"; + print "where MODULES are:\n"; + print "\t--releaseable Extract releaseable (whatlog) information\n"; + print "\t--error Extracts raptor errors, i.e. content of tags\n"; + print "\t--warning Extracts raptor warnings, i.e. content of tags\n"; + print "\t--info Extracts raptor info text i.e. content of tags from a raptor log file\n"; + print "\t--unreciped Extracts output text in context which doesn't belong to any tags\n"; + print "\t--recipe Extract, analyzes and dumps raptor recipes i.e. content of tags from a raptor log file\n"; + print "where OPTIONS are:\n"; + print "\t--basedir=DIR Generate output file under DIR\n"; + print "\t--append Do not stop if basedir exists but append newly extracted info to already existing.\n"; + exit(0); +} + +if (!$basedir) +{ + $basedir = time; + + print "Using $basedir as basedir.\n"; +} +if (-d $basedir) +{ + if ($append) + { + print "Directory $basedir exists. Appending new info to it.\n"; + } + else + { + print "Directory $basedir exists. Quitting.\n"; + exit(1); + } +} +mkdir($basedir); +#print "Created dir $basedir.\n"; + +my $saxhandler = RaptorSAXHandler->new(); +if ($releaseable_module) +{ + print "Adding RaptorReleaseable module to the observers\n"; + $saxhandler->add_observer('RaptorReleaseable', $RaptorReleaseable::reset_status); +} +if ($error_module) +{ + print "Adding RaptorError module to the observers\n"; + $saxhandler->add_observer('RaptorError', $RaptorError::reset_status); +} +if ($warning_module) +{ + print "Adding RaptorWarning module to the observers\n"; + $saxhandler->add_observer('RaptorWarning', $RaptorWarning::reset_status); +} +if ($info_module) +{ + print "Adding RaptorInfo module to the observers\n"; + $saxhandler->add_observer('RaptorInfo', $RaptorInfo::reset_status); +} +if ($unreciped_module) +{ + print "Adding RaptorUnreciped module to the observers\n"; + $saxhandler->add_observer('RaptorUnreciped', $RaptorUnreciped::reset_status); +} +if ($recipe_module) +{ + print "Adding RaptorRecipe module to the observers\n"; + $saxhandler->add_observer('RaptorRecipe', $RaptorRecipe::reset_status); +} +my $parser = XML::SAX::ParserFactory->parser(Handler=>$saxhandler); +for (@logfiles) +{ + $parser->parse_uri($_); +} + diff -r c451bd0c0782 -r 51e429810aba common/tools/raptor/truclean.pl --- a/common/tools/raptor/truclean.pl Thu Jul 09 14:24:10 2009 +0100 +++ b/common/tools/raptor/truclean.pl Mon Jul 13 11:38:30 2009 +0100 @@ -15,14 +15,14 @@ use strict; use Getopt::Long; -my $DELIVERABLES_DIR = "/deliverables"; +my $RELEASEABLES_DIR = "/releaseables"; -my $deliverablesdir = ""; +my $releaseablesdir = ""; my $packageexpr = ''; my $help = 0; GetOptions(( 'packageexpr:s' => \$packageexpr, - 'deliverablesdir:s' => \$DELIVERABLES_DIR, + 'releaseablesdir:s' => \$RELEASEABLES_DIR, 'help!' => \$help )); @@ -39,16 +39,16 @@ print "\tLAYER_EXPR can be * or the name of a layer\n"; print "\tPACKAGE_EXPR can be * or the name of a package\n"; print "and OPTIONS are:\n"; - print "\t--deliverablesdir=DIR Use DIR as the root of the deliverables dir (default: $DELIVERABLES_DIR\n"; + print "\t--releaseablesdir=DIR Use DIR as the root of the releaseables dir (default: $RELEASEABLES_DIR\n"; exit(0); } -$DELIVERABLES_DIR = $deliverablesdir if ($deliverablesdir); +$RELEASEABLES_DIR = $releaseablesdir if ($releaseablesdir); my @layers = (); if ($layer_expr eq '*') { - opendir(DIR, $DELIVERABLES_DIR); + opendir(DIR, $RELEASEABLES_DIR); @layers = readdir(DIR); closedir(DIR); @layers = grep(!/^\.\.?$/, @layers); @@ -64,7 +64,7 @@ my @packages = (); if ($package_expr eq '*') { - opendir(DIR, "$DELIVERABLES_DIR/$layer"); + opendir(DIR, "$RELEASEABLES_DIR/$layer"); @packages = readdir(DIR); closedir(DIR); @packages = grep(!/^\.\.?$/, @packages); @@ -79,7 +79,7 @@ { print "Processing package $layer/$package...\n"; - open(FILE, "$DELIVERABLES_DIR/$layer/$package/info.tsv"); + open(FILE, "$RELEASEABLES_DIR/$layer/$package/info.tsv"); while () { my $line = $_; diff -r c451bd0c0782 -r 51e429810aba common/tools/raptor/unreciped_text.pl --- a/common/tools/raptor/unreciped_text.pl Thu Jul 09 14:24:10 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -# Copyright (c) 2009 Symbian Foundation Ltd -# This component and the accompanying materials are made available -# under the terms of the License "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Symbian Foundation Ltd - initial contribution. -# -# Contributors: -# -# Description: -# Extracts output text in context which doesn't belong to 's - -use strict; - -use XML::SAX; -use RaptorSAXHandler; -use Getopt::Long; - -my @logfiles; -my $basedir = ''; -my $help = 0; -GetOptions(( - 'log:s' => \@logfiles, - 'basedir:s' => \$basedir, - 'help!' => \$help -)); - -$help = 1 if (!@logfiles); - -if ($help) -{ - print "Extracts text which doesn't belong to recipes from a raptor log file\n"; - print "Usage: perl unreciped_text.pl --log=FILE1 --log=FILE2 [OPTIONS]\n"; - print "where OPTIONS are:\n"; - print "\t--basedir=DIR Generate output file under DIR\n"; - exit(0); -} - -my $reset_status = {}; -my $buildlog_status = {}; -my $buildlog_subtag_status = {}; - -$reset_status->{name} = 'reset_status'; -$reset_status->{next_status} = {buildlog=>$buildlog_status}; - -$buildlog_status->{name} = 'buildlog_status'; -$buildlog_status->{next_status} = {'?default?'=>$buildlog_subtag_status}; -$buildlog_status->{on_start} = 'main::on_start_buildlog'; -$buildlog_status->{on_end} = 'main::on_end_buildlog'; -$buildlog_status->{on_chars} = 'main::on_chars_buildlog'; - -$buildlog_subtag_status->{name} = 'buildlog_subtag_status'; -$buildlog_subtag_status->{next_status} = {}; - -my $characters = ''; - -if (!$basedir) -{ - $basedir = time; - - print "Using $basedir as basedir.\n"; -} -if (-d $basedir) -{ - print "Directory $basedir exists. Quitting.\n"; - exit(1); -} -mkdir($basedir); -#print "Created dir $basedir.\n"; - -my $saxhandler = RaptorSAXHandler->new(); -$saxhandler->set_init_status($reset_status); -my $parser = XML::SAX::ParserFactory->parser(Handler=>$saxhandler); -for (@logfiles) -{ - $parser->parse_uri($_); -} - - -sub on_start_buildlog -{ - my $filename = "$basedir/unreciped.txt"; - print "Writing unreciped file $filename\n" if (!-f$filename); - open(FILE, ">>$filename"); -} - -sub on_chars_buildlog -{ - my ($ch) = @_; - - my $characters = $ch->{Data}; - - print FILE $characters if ($characters =~ m,[^\s^\r^\n],); - - #print "characters is now -->$characters<--\n"; -} - -sub on_end_buildlog -{ - close(FILE); -} \ No newline at end of file