common/tools/generate_system_models.pl
changeset 1075 20205e7ab525
parent 1073 ac18844eb787
child 1253 4fbe6b3c1776
equal deleted inserted replaced
1074:15428d415dba 1075:20205e7ab525
       
     1 use strict;
       
     2 
       
     3 my $SYSDEFTOOLS_PATH = "packages\\sysdeftools";
       
     4 my $XALAN_J = "java -jar $SYSDEFTOOLS_PATH\\xalan.jar";
       
     5 my $XALAN_C = "packages\\sysmodelgen\\rsc\\installed\\Xalan\\Xalan.exe";
       
     6 
       
     7 system("rmdir /S /Q tmp") if (-d "tmp");
       
     8 mkdir("tmp");
       
     9 chdir("tmp");
       
    10 
       
    11 print "\n\n### CLONE MCL/sftools/fbf/projects/packages REPO ###\n";
       
    12 system("hg clone http://developer.symbian.org/oss/MCL/sftools/fbf/projects/packages");
       
    13 my $updatehifi_cmd = "hg -R packages update -r HighFidelityModel";
       
    14 print "$updatehifi_cmd\n";
       
    15 system($updatehifi_cmd);
       
    16 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
       
    17 my $timestamp = sprintf "%4d%02d%02d%02d%02d%02d",$year+1900,$mon+1,$mday,$hour,$min,$sec;
       
    18 #print "\n\n### CLONE MCL/sf/os/buildtools REPO ###\n";
       
    19 #system("hg clone -r RCL_3 http://developer.symbian.org/oss/MCL/sf/os/buildtools");
       
    20 print "\n\n### CLONE MCL/sftools/fbf/projects/platforms REPO ###\n";
       
    21 system("hg clone -r default http://developer.symbian.org/oss/MCL/sftools/fbf/projects/platforms");
       
    22 
       
    23 # get the codelines from the packages repo
       
    24 opendir(DIR, "packages");
       
    25 my @codelines = grep(($_ !~ /^\.\.?$/ and $_ =~ /^symbian/), readdir(DIR));
       
    26 close(DIR);
       
    27 
       
    28 my $packages_changeset = '';
       
    29 
       
    30 # loop over codelines
       
    31 for my $codeline (@codelines)
       
    32 {
       
    33 	mkdir($codeline);
       
    34 	
       
    35 	my $ROOT_SYSDEF = "packages\\$codeline\\os\\deviceplatformrelease\\foundation_system\\system_model\\system_definition.xml";
       
    36 
       
    37 	# Full model in schema 3.0.0 format, including all of the test units.
       
    38 	print "\n\n### GENERATE FULL MODEL ###\n";
       
    39 	my $updatehifi_cmd = "hg -R packages update -r HighFidelityModel -C";
       
    40 	print "$updatehifi_cmd\n";
       
    41 	system($updatehifi_cmd);
       
    42 	if (!$packages_changeset)
       
    43 	{
       
    44 		$packages_changeset = `hg -R packages identify -i`;
       
    45 		chomp $packages_changeset;
       
    46 		print "-->$packages_changeset<--\n";
       
    47 	}
       
    48 	my $full_cmd = "$XALAN_C -o $codeline\\full_system_model_3.0.xml $ROOT_SYSDEF $SYSDEFTOOLS_PATH\\joinsysdef.xsl";
       
    49 	print "$full_cmd\n";
       
    50 	system($full_cmd);
       
    51 
       
    52 	# Filter the model to remove the test and techview units
       
    53 	print "\n\n### REMOVE UNDESIRED UNITS ###\n";
       
    54 	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";
       
    55 	print "$filter_cmd\n";
       
    56 	system($filter_cmd);
       
    57 
       
    58 	# Downgrade the model to schema 2.0.1 for use with Helium and Raptor
       
    59 	print "\n\n### DOWNGRADE TO SCHEMA 2.0.1 ###\n";
       
    60 	my $downgrade_cmd = "$XALAN_C -o $codeline\\system_model.xml $codeline\\system_model_3.0.xml $SYSDEFTOOLS_PATH\\sysdefdowngrade.xsl";
       
    61 	print "$downgrade_cmd\n";
       
    62 	system($downgrade_cmd);
       
    63 
       
    64 	print "\n\n### PUSH TO PLATFORMS REPOSITORY (auto) ###\n";
       
    65 	mkdir("platforms\\$codeline") if (!-d "platforms\\$codeline");
       
    66 	mkdir("platforms\\$codeline\\single") if (!-d "platforms\\$codeline\\single");
       
    67 	mkdir("platforms\\$codeline\\single\\sysdefs") if (!-d "platforms\\$codeline\\single\\sysdefs");
       
    68 	mkdir("platforms\\$codeline\\single\\sysdefs\\auto") if (!-d "platforms\\$codeline\\single\\sysdefs\\auto");
       
    69 	my $updatesysdef_cmd = "copy /Y $codeline\\system_model.xml platforms\\$codeline\\single\\sysdefs\\auto\\system_model.xml";
       
    70 	print "$updatesysdef_cmd\n";
       
    71 	system($updatesysdef_cmd);
       
    72 	system("hg -R platforms add"); # just in case this is a new platform
       
    73 	my $diff_cmd = "hg -R platforms diff --stat";
       
    74 	print "$diff_cmd\n";
       
    75 	my @diff_output = `$diff_cmd`;
       
    76 	if (@diff_output)
       
    77 	{
       
    78 		system("hg -R platforms add");
       
    79 		system("hg -R platforms commit -m \"Add auto generated $codeline system model (packages\@$packages_changeset)\" -u\"Dario Sestito <darios\@symbian.org>\"");
       
    80 		system("hg -R platforms push http://darios:symbian696b\@developer.symbian.org/oss/MCL/sftools/fbf/projects/platforms");
       
    81 		
       
    82 	}
       
    83 }
       
    84