common/tools/raptor/releaseables.pl
changeset 923 5ccf9d5ab663
parent 922 996297fad800
parent 907 bab81256b297
child 924 a5ed0e6ca679
equal deleted inserted replaced
922:996297fad800 923:5ccf9d5ab663
     1 # Copyright (c) 2009 Symbian Foundation Ltd
       
     2 # This component and the accompanying materials are made available
       
     3 # under the terms of the License "Eclipse Public License v1.0"
       
     4 # which accompanies this distribution, and is available
       
     5 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     6 #
       
     7 # Initial Contributors:
       
     8 # Symbian Foundation Ltd - initial contribution.
       
     9 #
       
    10 # Contributors:
       
    11 #
       
    12 # Description:
       
    13 # Extract releaseable (whatlog) information from Raptor log files
       
    14 
       
    15 use strict;
       
    16 use releaseables;
       
    17 use FindBin;
       
    18 use lib $FindBin::Bin;
       
    19 use XML::SAX;
       
    20 use RaptorSAXHandler;
       
    21 use Getopt::Long;
       
    22 
       
    23 our $basedir = '.';
       
    24 my $help = 0;
       
    25 GetOptions((
       
    26 	'basedir=s' => \$basedir,
       
    27 	'help!' => \$help
       
    28 ));
       
    29 my @logfiles = @ARGV;
       
    30 
       
    31 $help = 1 if (!@logfiles);
       
    32 
       
    33 if ($help)
       
    34 {
       
    35 	print "Extract releaseable (whatlog) information from Raptor log files\n";
       
    36 	print "Usage: perl releaseables.pl [OPTIONS] FILE1 FILE2 ...\n";
       
    37 	print "where OPTIONS are:\n";
       
    38 	print "\t--basedir=DIR Generate output under DIR (defaults to current dir)\n";
       
    39 	exit(0);
       
    40 }
       
    41 
       
    42 my $releaseablesdir = "$::basedir/releaseables";
       
    43 $releaseablesdir =~ s,/,\\,g; # this is because rmdir doens't cope correctly with the forward slashes
       
    44 system("rmdir /S /Q $releaseablesdir") if (-d "$releaseablesdir");
       
    45 mkdir("$releaseablesdir");
       
    46 
       
    47 my $saxhandler = RaptorSAXHandler->new();
       
    48 $saxhandler->add_observer('releaseables', $releaseables::reset_status);
       
    49 
       
    50 my $parser = XML::SAX::ParserFactory->parser(Handler=>$saxhandler);
       
    51 for (@logfiles)
       
    52 {
       
    53 	$parser->parse_uri($_);
       
    54 }
       
    55