common/tools/generate_system_models.pl
author Dario Sestito <darios@symbian.org>
Thu, 30 Sep 2010 11:06:40 +0100
changeset 1239 66af865c759b
parent 1223 9a6d81b932b1
permissions -rw-r--r--
Added default property file for RCL_3 builds
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1060
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     1
use strict;
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     2
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     3
my $SYSDEFTOOLS_PATH = "packages\\sysdeftools";
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     4
my $XALAN_J = "java -jar $SYSDEFTOOLS_PATH\\xalan.jar";
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     5
my $XALAN_C = "packages\\sysmodelgen\\rsc\\installed\\Xalan\\Xalan.exe";
1221
4fbe6b3c1776 Updated script for symbian 4 system model.
Johan Groth <johang@symbian.org>
parents: 1075
diff changeset
     6
my $joinsysdef_cmd = "perl $SYSDEFTOOLS_PATH\\joinsysdef.pl ";
1060
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     7
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     8
system("rmdir /S /Q tmp") if (-d "tmp");
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     9
mkdir("tmp");
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    10
chdir("tmp");
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    11
1063
fafd97533066 Use MCL for packages repo
Dario Sestito <darios@symbian.org>
parents: 1062
diff changeset
    12
print "\n\n### CLONE MCL/sftools/fbf/projects/packages REPO ###\n";
1067
bab959d5bc37 Fix some issues
Dario Sestito <darios@symbian.org>
parents: 1066
diff changeset
    13
system("hg clone http://developer.symbian.org/oss/MCL/sftools/fbf/projects/packages");
1068
6f5db200d8d5 Auto generate system model into codeline/single/sysdef instead of auto directory. Minor fixes
Dario Sestito <darios@symbian.org>
parents: 1067
diff changeset
    14
my $updatehifi_cmd = "hg -R packages update -r HighFidelityModel";
6f5db200d8d5 Auto generate system model into codeline/single/sysdef instead of auto directory. Minor fixes
Dario Sestito <darios@symbian.org>
parents: 1067
diff changeset
    15
print "$updatehifi_cmd\n";
6f5db200d8d5 Auto generate system model into codeline/single/sysdef instead of auto directory. Minor fixes
Dario Sestito <darios@symbian.org>
parents: 1067
diff changeset
    16
system($updatehifi_cmd);
1060
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    17
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    18
my $timestamp = sprintf "%4d%02d%02d%02d%02d%02d",$year+1900,$mon+1,$mday,$hour,$min,$sec;
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    19
#print "\n\n### CLONE MCL/sf/os/buildtools REPO ###\n";
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    20
#system("hg clone -r RCL_3 http://developer.symbian.org/oss/MCL/sf/os/buildtools");
1062
242f69b8015f Use MCL for the platforms repo
Dario Sestito <darios@symbian.org>
parents: 1061
diff changeset
    21
print "\n\n### CLONE MCL/sftools/fbf/projects/platforms REPO ###\n";
242f69b8015f Use MCL for the platforms repo
Dario Sestito <darios@symbian.org>
parents: 1061
diff changeset
    22
system("hg clone -r default http://developer.symbian.org/oss/MCL/sftools/fbf/projects/platforms");
1060
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    23
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    24
# get the codelines from the packages repo
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    25
opendir(DIR, "packages");
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    26
my @codelines = grep(($_ !~ /^\.\.?$/ and $_ =~ /^symbian/), readdir(DIR));
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    27
close(DIR);
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    28
1067
bab959d5bc37 Fix some issues
Dario Sestito <darios@symbian.org>
parents: 1066
diff changeset
    29
my $packages_changeset = '';
bab959d5bc37 Fix some issues
Dario Sestito <darios@symbian.org>
parents: 1066
diff changeset
    30
1060
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    31
# loop over codelines
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    32
for my $codeline (@codelines)
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    33
{
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    34
	mkdir($codeline);
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    35
	
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    36
	my $ROOT_SYSDEF = "packages\\$codeline\\os\\deviceplatformrelease\\foundation_system\\system_model\\system_definition.xml";
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    37
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    38
	# Full model in schema 3.0.0 format, including all of the test units.
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    39
	print "\n\n### GENERATE FULL MODEL ###\n";
1070
ab041f8d7a61 Fix: update back to HighFidelityModel is not possible because there are changed files and it crosses branches
Dario Sestito <darios@symbian.org>
parents: 1069
diff changeset
    40
	my $updatehifi_cmd = "hg -R packages update -r HighFidelityModel -C";
1065
4656372c9b53 Add automatic update of package models to the packages repository (default branch)
Dario Sestito <darios@symbian.org>
parents: 1063
diff changeset
    41
	print "$updatehifi_cmd\n";
4656372c9b53 Add automatic update of package models to the packages repository (default branch)
Dario Sestito <darios@symbian.org>
parents: 1063
diff changeset
    42
	system($updatehifi_cmd);
1067
bab959d5bc37 Fix some issues
Dario Sestito <darios@symbian.org>
parents: 1066
diff changeset
    43
	if (!$packages_changeset)
bab959d5bc37 Fix some issues
Dario Sestito <darios@symbian.org>
parents: 1066
diff changeset
    44
	{
bab959d5bc37 Fix some issues
Dario Sestito <darios@symbian.org>
parents: 1066
diff changeset
    45
		$packages_changeset = `hg -R packages identify -i`;
bab959d5bc37 Fix some issues
Dario Sestito <darios@symbian.org>
parents: 1066
diff changeset
    46
		chomp $packages_changeset;
bab959d5bc37 Fix some issues
Dario Sestito <darios@symbian.org>
parents: 1066
diff changeset
    47
		print "-->$packages_changeset<--\n";
bab959d5bc37 Fix some issues
Dario Sestito <darios@symbian.org>
parents: 1066
diff changeset
    48
	}
1221
4fbe6b3c1776 Updated script for symbian 4 system model.
Johan Groth <johang@symbian.org>
parents: 1075
diff changeset
    49
	my $full_cmd = '';
4fbe6b3c1776 Updated script for symbian 4 system model.
Johan Groth <johang@symbian.org>
parents: 1075
diff changeset
    50
	if ($codeline eq "symbian3")
4fbe6b3c1776 Updated script for symbian 4 system model.
Johan Groth <johang@symbian.org>
parents: 1075
diff changeset
    51
	{
4fbe6b3c1776 Updated script for symbian 4 system model.
Johan Groth <johang@symbian.org>
parents: 1075
diff changeset
    52
		$full_cmd = "$XALAN_C -o $codeline\\full_system_model_3.0.xml $ROOT_SYSDEF $SYSDEFTOOLS_PATH\\joinsysdef.xsl";	
4fbe6b3c1776 Updated script for symbian 4 system model.
Johan Groth <johang@symbian.org>
parents: 1075
diff changeset
    53
	}
4fbe6b3c1776 Updated script for symbian 4 system model.
Johan Groth <johang@symbian.org>
parents: 1075
diff changeset
    54
	elsif ($codeline eq "symbian4")
4fbe6b3c1776 Updated script for symbian 4 system model.
Johan Groth <johang@symbian.org>
parents: 1075
diff changeset
    55
	{
4fbe6b3c1776 Updated script for symbian 4 system model.
Johan Groth <johang@symbian.org>
parents: 1075
diff changeset
    56
		my $config_dir = "packages\\$codeline\\config";
1223
9a6d81b932b1 Corrected the path option to joinsysdef.pl.
Johan Groth <johang@symbian.org>
parents: 1221
diff changeset
    57
		my $path = "os/deviceplatformrelease/foundation_system/system_model/system_definition.xml";
9a6d81b932b1 Corrected the path option to joinsysdef.pl.
Johan Groth <johang@symbian.org>
parents: 1221
diff changeset
    58
		$full_cmd = "$joinsysdef_cmd --out=$codeline\\full_system_model_3.0.xml --exclude-meta=Api --path=$path --config=$config_dir\\bldvariant.hrh -I$config_dir $ROOT_SYSDEF";
1221
4fbe6b3c1776 Updated script for symbian 4 system model.
Johan Groth <johang@symbian.org>
parents: 1075
diff changeset
    59
	}
1060
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    60
	print "$full_cmd\n";
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    61
	system($full_cmd);
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    62
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    63
	# Filter the model to remove the test and techview units
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    64
	print "\n\n### REMOVE UNDESIRED UNITS ###\n";
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    65
	my $filter_cmd = "$XALAN_C -o $codeline\\system_model_3.0.xml -p filter \"'!test,!techview'\" -p filter-type 'has' $codeline\\full_system_model_3.0.xml $SYSDEFTOOLS_PATH\\filtering.xsl";
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    66
	print "$filter_cmd\n";
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    67
	system($filter_cmd);
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    68
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    69
	# Downgrade the model to schema 2.0.1 for use with Helium and Raptor
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    70
	print "\n\n### DOWNGRADE TO SCHEMA 2.0.1 ###\n";
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    71
	my $downgrade_cmd = "$XALAN_C -o $codeline\\system_model.xml $codeline\\system_model_3.0.xml $SYSDEFTOOLS_PATH\\sysdefdowngrade.xsl";
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    72
	print "$downgrade_cmd\n";
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    73
	system($downgrade_cmd);
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    74
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    75
	print "\n\n### PUSH TO PLATFORMS REPOSITORY (auto) ###\n";
1068
6f5db200d8d5 Auto generate system model into codeline/single/sysdef instead of auto directory. Minor fixes
Dario Sestito <darios@symbian.org>
parents: 1067
diff changeset
    76
	mkdir("platforms\\$codeline") if (!-d "platforms\\$codeline");
6f5db200d8d5 Auto generate system model into codeline/single/sysdef instead of auto directory. Minor fixes
Dario Sestito <darios@symbian.org>
parents: 1067
diff changeset
    77
	mkdir("platforms\\$codeline\\single") if (!-d "platforms\\$codeline\\single");
6f5db200d8d5 Auto generate system model into codeline/single/sysdef instead of auto directory. Minor fixes
Dario Sestito <darios@symbian.org>
parents: 1067
diff changeset
    78
	mkdir("platforms\\$codeline\\single\\sysdefs") if (!-d "platforms\\$codeline\\single\\sysdefs");
1072
48e2f89df0ad change destination directory for auto generated model to sydefs\auto
Andy Simpson<andrew.simpson@symbian.com>
parents: 1071
diff changeset
    79
	mkdir("platforms\\$codeline\\single\\sysdefs\\auto") if (!-d "platforms\\$codeline\\single\\sysdefs\\auto");
48e2f89df0ad change destination directory for auto generated model to sydefs\auto
Andy Simpson<andrew.simpson@symbian.com>
parents: 1071
diff changeset
    80
	my $updatesysdef_cmd = "copy /Y $codeline\\system_model.xml platforms\\$codeline\\single\\sysdefs\\auto\\system_model.xml";
1068
6f5db200d8d5 Auto generate system model into codeline/single/sysdef instead of auto directory. Minor fixes
Dario Sestito <darios@symbian.org>
parents: 1067
diff changeset
    81
	print "$updatesysdef_cmd\n";
6f5db200d8d5 Auto generate system model into codeline/single/sysdef instead of auto directory. Minor fixes
Dario Sestito <darios@symbian.org>
parents: 1067
diff changeset
    82
	system($updatesysdef_cmd);
1069
96567d7b618a Exec hg add/addremove commands before hg diff
Dario Sestito <darios@symbian.org>
parents: 1068
diff changeset
    83
	system("hg -R platforms add"); # just in case this is a new platform
1068
6f5db200d8d5 Auto generate system model into codeline/single/sysdef instead of auto directory. Minor fixes
Dario Sestito <darios@symbian.org>
parents: 1067
diff changeset
    84
	my $diff_cmd = "hg -R platforms diff --stat";
6f5db200d8d5 Auto generate system model into codeline/single/sysdef instead of auto directory. Minor fixes
Dario Sestito <darios@symbian.org>
parents: 1067
diff changeset
    85
	print "$diff_cmd\n";
6f5db200d8d5 Auto generate system model into codeline/single/sysdef instead of auto directory. Minor fixes
Dario Sestito <darios@symbian.org>
parents: 1067
diff changeset
    86
	my @diff_output = `$diff_cmd`;
6f5db200d8d5 Auto generate system model into codeline/single/sysdef instead of auto directory. Minor fixes
Dario Sestito <darios@symbian.org>
parents: 1067
diff changeset
    87
	if (@diff_output)
1060
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    88
	{
1072
48e2f89df0ad change destination directory for auto generated model to sydefs\auto
Andy Simpson<andrew.simpson@symbian.com>
parents: 1071
diff changeset
    89
		system("hg -R platforms add");
1067
bab959d5bc37 Fix some issues
Dario Sestito <darios@symbian.org>
parents: 1066
diff changeset
    90
		system("hg -R platforms commit -m \"Add auto generated $codeline system model (packages\@$packages_changeset)\" -u\"Dario Sestito <darios\@symbian.org>\"");
1068
6f5db200d8d5 Auto generate system model into codeline/single/sysdef instead of auto directory. Minor fixes
Dario Sestito <darios@symbian.org>
parents: 1067
diff changeset
    91
		system("hg -R platforms push http://darios:symbian696b\@developer.symbian.org/oss/MCL/sftools/fbf/projects/platforms");
1065
4656372c9b53 Add automatic update of package models to the packages repository (default branch)
Dario Sestito <darios@symbian.org>
parents: 1063
diff changeset
    92
		
1060
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    93
	}
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    94
}
14f4464f36ae Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    95