common/tools/CheckBuildEnv.pl
changeset 365 95e054b2bec1
parent 358 61571c10c5d0
equal deleted inserted replaced
364:4dc3b5b1577c 365:95e054b2bec1
       
     1 ## @file BuildEnvXML.pl
       
     2 # @ingroup userscripts clientscripts
       
     3 #
       
     4 # Uses information which is defined in the BuildEnvXML.xml to set up a machine
       
     5 # specific environment, such as path for compilers. 
       
     6 #
       
     7 # @todo Document this script.
       
     8 #
       
     9 # Copyright (c) 2009 Symbian Foundation  Ltd. All rights reserved.
       
    10 #
       
    11 
       
    12 package BuildEnvXML;
       
    13 
       
    14 use Getopt::Long;
       
    15 use BuildEnvXML qw(&getToolEnvironment &getLastErrorMsg);
       
    16 
       
    17 my $toolenvxml = "";
       
    18 my $dbgfile = "";
       
    19 my $sbsconfig = "";
       
    20 my $toolsconfig = "";
       
    21 
       
    22 GetOptions ("xml=s" => \$toolenvxml, "dbg:s" => \$dbgfile, "sbs:s" => \$sbsconfig, "tools:s" => \$sbsconfig); 
       
    23 
       
    24 my @contexts = @ARGV;
       
    25 
       
    26 if ($toolenvxml eq "")
       
    27 {
       
    28 	print ("ERROR: XML file cannot be found!\n");
       
    29 }
       
    30 
       
    31 # Checking the SBS config to test only what's necessary for that build
       
    32 if ($sbsconfig =~ /armv5/i)
       
    33 {
       
    34 	push @contexts, "ARMv5";
       
    35 }
       
    36 
       
    37 # Checking the tools config to test only what's necessary for that build
       
    38 if ($sbsconfig =~ /tools[^2]?(,|$|_)/i)
       
    39 {
       
    40 	push @contexts, "tools";
       
    41 }
       
    42 
       
    43 my $sErrMsg;
       
    44 my $result = 0;
       
    45 
       
    46 if (-e $dbgfile)
       
    47 {
       
    48 	unlink($dbgfile);
       
    49 }
       
    50 
       
    51 &setDbgFile($dbgfile);
       
    52 
       
    53 foreach my $context (@contexts){
       
    54 	print "\n\n### Checking $context Tools ###\n";
       
    55 	my $sSystemPath = &getToolEnvironment($toolenvxml, $context);
       
    56 
       
    57 	$sErrMsg = &getLastErrorMsg;
       
    58 	if ($sErrMsg eq "") { $sErrMsg = "\nAll OK.\n";}
       
    59 	if($sErrMsg =~ /ERROR/)
       
    60 	{
       
    61 		print "\n$context Tools VERIFICATION FAILED:";
       
    62 		print $sErrMsg."\n\n";
       
    63 		$result = -1;
       
    64 	}else{
       
    65 		print "\n$context tools VERIFICATION PASSED:";
       
    66 		print $sErrMsg."\n\n";
       
    67 	}
       
    68 }
       
    69 if ($result ne 0)
       
    70 {
       
    71 	print "\n ==> PROGRAM STOPPED!!\n";
       
    72 }
       
    73 exit($result);