common/tools/generate_package_defs.pl
author Dario Sestito <darios@symbian.org>
Mon, 04 Oct 2010 17:13:08 +0100
changeset 1278 8400dd17b04a
parent 1218 b9a2adc3ea65
permissions -rw-r--r--
Add code to update RCL_3 package models from symbian3 system model
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);
1278
8400dd17b04a Add code to update RCL_3 package models from symbian3 system model
Dario Sestito <darios@symbian.org>
parents: 1218
diff changeset
    46
	if ($codeline eq 'symbian3') # also update CompilerCompatibility, tip_bulk_s3 and RCL_3
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);
1278
8400dd17b04a Add code to update RCL_3 package models from symbian3 system model
Dario Sestito <darios@symbian.org>
parents: 1218
diff changeset
    61
		
8400dd17b04a Add code to update RCL_3 package models from symbian3 system model
Dario Sestito <darios@symbian.org>
parents: 1218
diff changeset
    62
		my $rmdir4_cmd = "del /S  packages\\RCL_3\\package_definition.xml >nul";
8400dd17b04a Add code to update RCL_3 package models from symbian3 system model
Dario Sestito <darios@symbian.org>
parents: 1218
diff changeset
    63
		print "$rmdir4_cmd\n";
8400dd17b04a Add code to update RCL_3 package models from symbian3 system model
Dario Sestito <darios@symbian.org>
parents: 1218
diff changeset
    64
		system($rmdir4_cmd);
8400dd17b04a Add code to update RCL_3 package models from symbian3 system model
Dario Sestito <darios@symbian.org>
parents: 1218
diff changeset
    65
		my $splitmodel4_cmd = "perl ..\\split_sysdef.pl -s platforms\\$codeline\\single\\sysdefs\\system_model.xml -o packages\\RCL_3";
8400dd17b04a Add code to update RCL_3 package models from symbian3 system model
Dario Sestito <darios@symbian.org>
parents: 1218
diff changeset
    66
		print "$splitmodel4_cmd\n";
8400dd17b04a Add code to update RCL_3 package models from symbian3 system model
Dario Sestito <darios@symbian.org>
parents: 1218
diff changeset
    67
		system($splitmodel4_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
    68
	}
1193
70d88996e8cd Update package_definition.xml generation for tip_pbc
Shabe Razvi <shaber@symbian.org>
parents: 1075
diff changeset
    69
	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
    70
	{
70d88996e8cd Update package_definition.xml generation for tip_pbc
Shabe Razvi <shaber@symbian.org>
parents: 1075
diff changeset
    71
		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
    72
		print "$rmdir3_cmd\n";
70d88996e8cd Update package_definition.xml generation for tip_pbc
Shabe Razvi <shaber@symbian.org>
parents: 1075
diff changeset
    73
		system($rmdir3_cmd);
70d88996e8cd Update package_definition.xml generation for tip_pbc
Shabe Razvi <shaber@symbian.org>
parents: 1075
diff changeset
    74
		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
    75
		print "$splitmodel3_cmd\n";
70d88996e8cd Update package_definition.xml generation for tip_pbc
Shabe Razvi <shaber@symbian.org>
parents: 1075
diff changeset
    76
		system($splitmodel3_cmd);
70d88996e8cd Update package_definition.xml generation for tip_pbc
Shabe Razvi <shaber@symbian.org>
parents: 1075
diff changeset
    77
	}
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
	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
    79
	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
    80
	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
    81
	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
    82
	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
    83
	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
    84
	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
    85
	{
1074
15428d415dba updated commit message as no longer triggered by change in packages repo
andy simpson <andrews@symbian.org>
parents: 1073
diff changeset
    86
		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
    87
		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
    88
		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
    89
		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
    90
		print "$push_cmd\n";
1218
b9a2adc3ea65 Uncomment push to update package models automatically
Dario Sestito <darios@symbian.org>
parents: 1216
diff changeset
    91
		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
    92
	}
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
    93
}
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
    94