diff -r 27826401fee5 -r 4f54ca96b7e8 common/tools/analysis/parsewhatlog.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/analysis/parsewhatlog.pl Mon May 18 11:37:55 2009 +0100 @@ -0,0 +1,146 @@ +#!/usr/bin/perl +#parsewhatlog - parses a whatlog, gives csv output. +use strict; + +# +# +# +# +#t:/epoc32/release/winscw/udeb/3gpmp4lib.lib +#t:/epoc32/release/winscw/udeb/3gpmp4lib.lib +#t:/epoc32/release/winscw/udeb/3gpmp4lib.dll +# +# +#t:/epoc32/data/z/resource/messaging/bif/vclp.mbm +#t:/epoc32/release/winscw/udeb/z/resource/messaging/bif/vclp.mbm +#t:/epoc32/release/winscw/urel/z/resource/messaging/bif/vclp.mbm +#t:/epoc32/localisation/vclp/mbm/vclp0.bmp +#t:/epoc32/localisation/group/vclp.info +# +# +#t:/epoc32/data/z/resource/plugins/aacdecoderconfigci.rsc +#t:/epoc32/release/winscw/udeb/z/resource/plugins/aacdecoderconfigci.rsc +#t:/epoc32/release/winscw/urel/z/resource/plugins/aacdecoderconfigci.rsc +#t:/epoc32/localisation/aacdecoderconfigci/rsc/aacdecoderconfigci.rpp +#t:/epoc32/localisation/group/aacdecoderconfigci.info +# + + +my $keepgoing = 1; +main(); + +sub cleanpath($) +{ + my $str = lc(shift); #drop the case. + $str =~ s/^\S://; #remove drive letter + $str =~ s/^\///; # some custom makefiles report aboslute path + $str =~ s/\\/\//g; #switch the path + $str =~ s/\/\//\//g;#we have some double slashes in some resources... + return $str; +} +sub ext($) +{ + my $str = shift; + $str =~ s/\S+\.//; #may fail... + return $str; +} + +sub main() +{ + my $path = shift @ARGV; + my @files = glob($path."/*whatlog*WHAT_*compile.log"); + foreach my $filename (@files) + { +# print $filename."\n"; + parsefile($filename); + } +} +sub parsefile($filename) +{ + my $filename = shift; + open(FILE,"<$filename") or die "Couldn't open filename\n"; + + #I'm using previous formatting stypes from the flm parsing...ie location, bld.inf, makefile, type, target,extension + print "location,bldinf,makefile,type,target,extension\n"; + my $bldinf = ""; + my $makefile = ""; + my $inrecipe = 0; + + my $linecount = 0; + while(my $line = ) + { + ++$linecount; + if($line =~ m/^/) #brittle + { + $bldinf = $1; + $makefile = $2; + } + elsif($line =~ m/^<\/whatlog>/) + { + $bldinf = ""; + $makefile = ""; + } + elsif($line =~ m/^(\S+)<\/bitmap>/) + { + if($bldinf eq "" || $makefile eq "" && !$keepgoing) + { + die "$filename($linecount) bldinf=$bldinf makefile=$makefile: $line\n"; + } + print "$filename($linecount),".cleanpath($bldinf).",".cleanpath($makefile).",bitmap,".cleanpath($1).",".ext($1)."\n"; + } + elsif($line =~ m/^(\S+)<\/build>/) + { + if($bldinf eq "" || $makefile eq "" && !$keepgoing) + { + die "$filename($linecount) bldinf=$bldinf makefile=$makefile : $line\n"; + } + print "$filename($linecount),".cleanpath($bldinf).",".cleanpath($makefile).",binary,".cleanpath($1).",".ext($1)."\n"; + } + elsif($line =~ m/^(\S+)<\/resource>/) + { + if($bldinf eq "" || $makefile eq "" && !$keepgoing) + { + die "$filename($linecount) bldinf=$bldinf makefile=$makefile : $line\n"; + } + print "$filename($linecount),".cleanpath($bldinf).",".cleanpath($makefile).",resource,".cleanpath($1).",".ext($1)."\n"; + } + + # + elsif($line =~ m/^/) + { + if($bldinf eq "" ) + { + die "$filename($linecount) bldinf=$bldinf: $line\n"; + } + print "$filename($linecount),".cleanpath($bldinf).",".cleanpath($2).",export,".cleanpath($1).",".ext($1)."\n"; + } + # + + elsif($line =~ m//) + { + $bldinf = $1; + $makefile = $2; + $inrecipe = 1; + } + elsif($inrecipe && $line =~ m/^(\S:\S+)/) + { + if($bldinf eq "" || $makefile eq "" && !$keepgoing) + { + die "$filename($linecount) bldinf=$bldinf makefile=$makefile : $line\n"; + } + my $str = cleanpath($1); + + print "$filename($linecount),".cleanpath($bldinf).",".cleanpath($makefile).",custom,".cleanpath($str).",".ext($str)."\n"; + } + + elsif($line =~ m/<\/recipe>/) + { + $bldinf = ""; + $makefile = ""; + $inrecipe = 0; + } + + + } + close FILE; +} \ No newline at end of file