common/tools/CheckBuildEnv.pl
author Simon Howkins <simonh@symbian.org>
Fri, 16 Oct 2009 15:11:28 +0100
changeset 680 81550e87fc91
parent 358 61571c10c5d0
permissions -rw-r--r--
Moved the generation of the release metadata entry for the MD5 zip outside of the parallel section, so it can't co-incide with the zipping of the binaries. Ensured that any errors generated when merging log files are not just hidden by putting them in the output file (which will render it not well-formed XML).
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
358
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
     1
## @file BuildEnvXML.pl
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
     2
# @ingroup userscripts clientscripts
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
     3
#
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
     4
# Uses information which is defined in the BuildEnvXML.xml to set up a machine
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
     5
# specific environment, such as path for compilers. 
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
     6
#
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
     7
# @todo Document this script.
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
     8
#
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
     9
# Copyright (c) 2009 Symbian Foundation  Ltd. All rights reserved.
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    10
#
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    11
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    12
package BuildEnvXML;
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    13
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    14
use Getopt::Long;
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    15
use BuildEnvXML qw(&getToolEnvironment &getLastErrorMsg);
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    16
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    17
my $toolenvxml = "";
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    18
my $dbgfile = "";
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    19
my $sbsconfig = "";
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    20
my $toolsconfig = "";
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    21
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    22
GetOptions ("xml=s" => \$toolenvxml, "dbg:s" => \$dbgfile, "sbs:s" => \$sbsconfig, "tools:s" => \$sbsconfig); 
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    23
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    24
my @contexts = @ARGV;
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    25
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    26
if ($toolenvxml eq "")
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    27
{
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    28
	print ("ERROR: XML file cannot be found!\n");
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    29
}
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    30
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    31
# Checking the SBS config to test only what's necessary for that build
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    32
if ($sbsconfig =~ /armv5/i)
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    33
{
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    34
	push @contexts, "ARMv5";
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    35
}
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    36
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    37
# Checking the tools config to test only what's necessary for that build
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    38
if ($sbsconfig =~ /tools[^2]?(,|$|_)/i)
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    39
{
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    40
	push @contexts, "tools";
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    41
}
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    42
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    43
my $sErrMsg;
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    44
my $result = 0;
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    45
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    46
if (-e $dbgfile)
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    47
{
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    48
	unlink($dbgfile);
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    49
}
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    50
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    51
&setDbgFile($dbgfile);
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    52
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    53
foreach my $context (@contexts){
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    54
	print "\n\n### Checking $context Tools ###\n";
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    55
	my $sSystemPath = &getToolEnvironment($toolenvxml, $context);
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    56
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    57
	$sErrMsg = &getLastErrorMsg;
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    58
	if ($sErrMsg eq "") { $sErrMsg = "\nAll OK.\n";}
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    59
	if($sErrMsg =~ /ERROR/)
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    60
	{
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    61
		print "\n$context Tools VERIFICATION FAILED:";
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    62
		print $sErrMsg."\n\n";
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    63
		$result = -1;
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    64
	}else{
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    65
		print "\n$context tools VERIFICATION PASSED:";
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    66
		print $sErrMsg."\n\n";
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    67
	}
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    68
}
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    69
if ($result ne 0)
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    70
{
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    71
	print "\n ==> PROGRAM STOPPED!!\n";
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    72
}
61571c10c5d0 Added Build environment check feature
ThomasE
parents:
diff changeset
    73
exit($result);