common/tools/generate_package_defs.pl
author Simon Howkins <simonh@symbian.org>
Tue, 10 Aug 2010 18:11:17 +0100
changeset 1206 4518bca1baf0
parent 1193 70d88996e8cd
child 1216 137bf94d93a3
permissions -rw-r--r--
Improved diagnostic output: when the build fails because a package cannot be cloned into the build drive, it says which package and the repo source and destination. Improved caching logic, so that it doesn't depend on network availability as much. Improved indentation.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1073
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
     1
use strict;
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
     2
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
     3
my $SYSDEFTOOLS_PATH = "packages\\sysdeftools";
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
     4
my $XALAN_J = "java -jar $SYSDEFTOOLS_PATH\\xalan.jar";
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
     5
my $XALAN_C = "packages\\sysmodelgen\\rsc\\installed\\Xalan\\Xalan.exe";
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
     6
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
     7
system("rmdir /S /Q tmp") if (-d "tmp");
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
     8
mkdir("tmp");
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
     9
chdir("tmp");
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    10
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    11
print "\n\n### CLONE MCL/sftools/fbf/projects/packages REPO ###\n";
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    12
system("hg clone -r default http://developer.symbian.org/oss/MCL/sftools/fbf/projects/packages");
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    13
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    14
my $timestamp = sprintf "%4d%02d%02d%02d%02d%02d",$year+1900,$mon+1,$mday,$hour,$min,$sec;
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    15
#print "\n\n### CLONE MCL/sf/os/buildtools REPO ###\n";
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    16
#system("hg clone -r RCL_3 http://developer.symbian.org/oss/MCL/sf/os/buildtools");
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    17
print "\n\n### CLONE MCL/sftools/fbf/projects/platforms REPO ###\n";
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    18
system("hg clone -r default http://developer.symbian.org/oss/MCL/sftools/fbf/projects/platforms");
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    19
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    20
# get the codelines from the packages repo
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    21
opendir(DIR, "packages");
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    22
my @codelines = grep(($_ !~ /^\.\.?$/ and $_ =~ /^symbian/), readdir(DIR));
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    23
close(DIR);
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    24
1074
15428d415dba updated commit message as no longer triggered by change in packages repo
andy simpson <andrews@symbian.org>
parents: 1073
diff changeset
    25
# get the changeset from the platform repo 
15428d415dba updated commit message as no longer triggered by change in packages repo
andy simpson <andrews@symbian.org>
parents: 1073
diff changeset
    26
my $platform_changeset = `hg -R platforms identify -i`;
15428d415dba updated commit message as no longer triggered by change in packages repo
andy simpson <andrews@symbian.org>
parents: 1073
diff changeset
    27
chomp $platform_changeset;
15428d415dba updated commit message as no longer triggered by change in packages repo
andy simpson <andrews@symbian.org>
parents: 1073
diff changeset
    28
print "-->$platform_changeset<--\n";
1073
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    29
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    30
# loop over codelines
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    31
for my $codeline (@codelines)
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    32
{
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    33
	mkdir($codeline);
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    34
	
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    35
	# Split model into package models
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    36
	print "\n\n### SPLIT MODEL INTO PACKAGE MODELS ###\n";
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    37
	my $updatedefault_cmd = "hg -R packages update -r default";
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    38
	print "$updatedefault_cmd\n";
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    39
	system($updatedefault_cmd);
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    40
	my $rmdir_cmd = "del /S packages\\$codeline\\package_definition.xml >nul";
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    41
	print "$rmdir_cmd\n";
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    42
	system($rmdir_cmd);
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    43
	my $splitmodel_cmd = "perl ..\\split_sysdef.pl -s platforms\\$codeline\\single\\sysdefs\\system_model.xml -o packages\\$codeline";
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    44
	print "$splitmodel_cmd\n";
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    45
	system($splitmodel_cmd);
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    46
	if ($codeline eq 'symbian3') # also update CompilerCompatibility
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    47
	{
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    48
		my $rmdir2_cmd = "del /S  packages\\CompilerCompatibility\\package_definition.xml >nul";
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    49
		print "$rmdir2_cmd\n";
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    50
		system($rmdir2_cmd);
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    51
		my $splitmodel2_cmd = "perl ..\\split_sysdef.pl -s platforms\\$codeline\\single\\sysdefs\\system_model.xml -o packages\\CompilerCompatibility";
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    52
		print "$splitmodel2_cmd\n";
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    53
		system($splitmodel2_cmd);
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    54
	}
1193
70d88996e8cd Update package_definition.xml generation for tip_pbc
Shabe Razvi <shaber@symbian.org>
parents: 1075
diff changeset
    55
	if ($codeline eq 'symbian4') # also update tip_pbc (package based contribution) branch
70d88996e8cd Update package_definition.xml generation for tip_pbc
Shabe Razvi <shaber@symbian.org>
parents: 1075
diff changeset
    56
	{
70d88996e8cd Update package_definition.xml generation for tip_pbc
Shabe Razvi <shaber@symbian.org>
parents: 1075
diff changeset
    57
		my $rmdir3_cmd = "del /S  packages\\tip_pbc\\package_definition.xml >nul";
70d88996e8cd Update package_definition.xml generation for tip_pbc
Shabe Razvi <shaber@symbian.org>
parents: 1075
diff changeset
    58
		print "$rmdir3_cmd\n";
70d88996e8cd Update package_definition.xml generation for tip_pbc
Shabe Razvi <shaber@symbian.org>
parents: 1075
diff changeset
    59
		system($rmdir3_cmd);
70d88996e8cd Update package_definition.xml generation for tip_pbc
Shabe Razvi <shaber@symbian.org>
parents: 1075
diff changeset
    60
		my $splitmodel3_cmd = "perl ..\\split_sysdef.pl -s platforms\\$codeline\\single\\sysdefs\\system_model.xml -o packages\\tip_pbc";
70d88996e8cd Update package_definition.xml generation for tip_pbc
Shabe Razvi <shaber@symbian.org>
parents: 1075
diff changeset
    61
		print "$splitmodel3_cmd\n";
70d88996e8cd Update package_definition.xml generation for tip_pbc
Shabe Razvi <shaber@symbian.org>
parents: 1075
diff changeset
    62
		system($splitmodel3_cmd);
70d88996e8cd Update package_definition.xml generation for tip_pbc
Shabe Razvi <shaber@symbian.org>
parents: 1075
diff changeset
    63
	}
1073
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    64
	my $addremove_cmd = "hg -R packages addremove";
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    65
	print "$addremove_cmd\n";
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    66
	system($addremove_cmd);
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    67
	my $diff_cmd = "hg -R packages diff --stat";
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    68
	print "$diff_cmd\n";
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    69
	my @diff_output = `$diff_cmd`;
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    70
	if (@diff_output)
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    71
	{
1074
15428d415dba updated commit message as no longer triggered by change in packages repo
andy simpson <andrews@symbian.org>
parents: 1073
diff changeset
    72
		my $commit_cmd = "hg -R packages commit -m \"Update package models from latest system model  (platform\@$platform_changeset)\" -u\"Dario Sestito <darios\@symbian.org>\"";
1073
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    73
		print "$commit_cmd\n";
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    74
		system($commit_cmd);
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    75
		my $push_cmd = "hg -R packages push http://darios:symbian696b\@developer.symbian.org/oss/MCL/sftools/fbf/projects/packages";
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    76
		print "$push_cmd\n";
1193
70d88996e8cd Update package_definition.xml generation for tip_pbc
Shabe Razvi <shaber@symbian.org>
parents: 1075
diff changeset
    77
		#system($push_cmd);
1073
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    78
	}
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    79
}
ac18844eb787 Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
andy simpson <andrews@symbian.org>
parents:
diff changeset
    80