common/tools/generate_package_defs.pl
author Maciej Seroka <maciejs@symbian.org>
Thu, 26 Aug 2010 12:39:14 +0100
changeset 1228 32ae1f6f1c35
parent 1218 b9a2adc3ea65
child 1278 8400dd17b04a
permissions -rw-r--r--
Added central_repository_notification_handler to SystemSW BC test suite
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);
1216
137bf94d93a3 Add package model generation for tip_bulk_s3
Dario Sestito <darios@symbian.org>
parents: 1193
diff changeset
    46
	if ($codeline eq 'symbian3') # also update CompilerCompatibility and tip_bulk_s3
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
    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);
1216
137bf94d93a3 Add package model generation for tip_bulk_s3
Dario Sestito <darios@symbian.org>
parents: 1193
diff changeset
    54
		
137bf94d93a3 Add package model generation for tip_bulk_s3
Dario Sestito <darios@symbian.org>
parents: 1193
diff changeset
    55
		my $rmdir3_cmd = "del /S  packages\\tip_bulk_s3\\package_definition.xml >nul";
137bf94d93a3 Add package model generation for tip_bulk_s3
Dario Sestito <darios@symbian.org>
parents: 1193
diff changeset
    56
		print "$rmdir3_cmd\n";
137bf94d93a3 Add package model generation for tip_bulk_s3
Dario Sestito <darios@symbian.org>
parents: 1193
diff changeset
    57
		system($rmdir3_cmd);
137bf94d93a3 Add package model generation for tip_bulk_s3
Dario Sestito <darios@symbian.org>
parents: 1193
diff changeset
    58
		my $splitmodel3_cmd = "perl ..\\split_sysdef.pl -s platforms\\$codeline\\single\\sysdefs\\system_model.xml -o packages\\tip_bulk_s3";
137bf94d93a3 Add package model generation for tip_bulk_s3
Dario Sestito <darios@symbian.org>
parents: 1193
diff changeset
    59
		print "$splitmodel3_cmd\n";
137bf94d93a3 Add package model generation for tip_bulk_s3
Dario Sestito <darios@symbian.org>
parents: 1193
diff changeset
    60
		system($splitmodel3_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
    61
	}
1193
70d88996e8cd Update package_definition.xml generation for tip_pbc
Shabe Razvi <shaber@symbian.org>
parents: 1075
diff changeset
    62
	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
    63
	{
70d88996e8cd Update package_definition.xml generation for tip_pbc
Shabe Razvi <shaber@symbian.org>
parents: 1075
diff changeset
    64
		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
    65
		print "$rmdir3_cmd\n";
70d88996e8cd Update package_definition.xml generation for tip_pbc
Shabe Razvi <shaber@symbian.org>
parents: 1075
diff changeset
    66
		system($rmdir3_cmd);
70d88996e8cd Update package_definition.xml generation for tip_pbc
Shabe Razvi <shaber@symbian.org>
parents: 1075
diff changeset
    67
		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
    68
		print "$splitmodel3_cmd\n";
70d88996e8cd Update package_definition.xml generation for tip_pbc
Shabe Razvi <shaber@symbian.org>
parents: 1075
diff changeset
    69
		system($splitmodel3_cmd);
70d88996e8cd Update package_definition.xml generation for tip_pbc
Shabe Razvi <shaber@symbian.org>
parents: 1075
diff changeset
    70
	}
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
    71
	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
    72
	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
    73
	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
    74
	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
    75
	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
    76
	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
    77
	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
    78
	{
1074
15428d415dba updated commit message as no longer triggered by change in packages repo
andy simpson <andrews@symbian.org>
parents: 1073
diff changeset
    79
		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
    80
		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
    81
		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
    82
		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
    83
		print "$push_cmd\n";
1218
b9a2adc3ea65 Uncomment push to update package models automatically
Dario Sestito <darios@symbian.org>
parents: 1216
diff changeset
    84
		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
    85
	}
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
    86
}
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
    87