generate_system_models.pl
changeset 1067 bab959d5bc37
parent 1066 e8cf0ceec61a
child 1068 6f5db200d8d5
equal deleted inserted replaced
1066:e8cf0ceec61a 1067:bab959d5bc37
     7 system("rmdir /S /Q tmp") if (-d "tmp");
     7 system("rmdir /S /Q tmp") if (-d "tmp");
     8 mkdir("tmp");
     8 mkdir("tmp");
     9 chdir("tmp");
     9 chdir("tmp");
    10 
    10 
    11 print "\n\n### CLONE MCL/sftools/fbf/projects/packages REPO ###\n";
    11 print "\n\n### CLONE MCL/sftools/fbf/projects/packages REPO ###\n";
    12 system("hg clone -r HighFidelityModel http://developer.symbian.org/oss/MCL/sftools/fbf/projects/packages");
    12 system("hg clone http://developer.symbian.org/oss/MCL/sftools/fbf/projects/packages");
    13 my $changeset = `hg -R packages identify -i`;
       
    14 chomp $changeset;
       
    15 print "-->$changeset<--\n";
       
    16 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
    13 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;
    14 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";
    15 #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");
    16 #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";
    17 print "\n\n### CLONE MCL/sftools/fbf/projects/platforms REPO ###\n";
    22 
    19 
    23 # get the codelines from the packages repo
    20 # get the codelines from the packages repo
    24 opendir(DIR, "packages");
    21 opendir(DIR, "packages");
    25 my @codelines = grep(($_ !~ /^\.\.?$/ and $_ =~ /^symbian/), readdir(DIR));
    22 my @codelines = grep(($_ !~ /^\.\.?$/ and $_ =~ /^symbian/), readdir(DIR));
    26 close(DIR);
    23 close(DIR);
       
    24 
       
    25 my $packages_changeset = '';
    27 
    26 
    28 # loop over codelines
    27 # loop over codelines
    29 for my $codeline (@codelines)
    28 for my $codeline (@codelines)
    30 {
    29 {
    31 	mkdir($codeline);
    30 	mkdir($codeline);
    35 	# Full model in schema 3.0.0 format, including all of the test units.
    34 	# Full model in schema 3.0.0 format, including all of the test units.
    36 	print "\n\n### GENERATE FULL MODEL ###\n";
    35 	print "\n\n### GENERATE FULL MODEL ###\n";
    37 	my $updatehifi_cmd = "hg -R packages update -r HighFidelityModel";
    36 	my $updatehifi_cmd = "hg -R packages update -r HighFidelityModel";
    38 	print "$updatehifi_cmd\n";
    37 	print "$updatehifi_cmd\n";
    39 	system($updatehifi_cmd);
    38 	system($updatehifi_cmd);
       
    39 	if (!$packages_changeset)
       
    40 	{
       
    41 		$packages_changeset = `hg -R packages identify -i`;
       
    42 		chomp $packages_changeset;
       
    43 		print "-->$packages_changeset<--\n";
       
    44 	}
    40 	my $full_cmd = "$XALAN_C -o $codeline\\full_system_model_3.0.xml $ROOT_SYSDEF $SYSDEFTOOLS_PATH\\joinsysdef.xsl";
    45 	my $full_cmd = "$XALAN_C -o $codeline\\full_system_model_3.0.xml $ROOT_SYSDEF $SYSDEFTOOLS_PATH\\joinsysdef.xsl";
    41 	print "$full_cmd\n";
    46 	print "$full_cmd\n";
    42 	system($full_cmd);
    47 	system($full_cmd);
    43 
    48 
    44 	# Filter the model to remove the test and techview units
    49 	# Filter the model to remove the test and techview units
    88 	{
    93 	{
    89 		mkdir("platforms\\$codeline") if (!-d "platforms\\$codeline");
    94 		mkdir("platforms\\$codeline") if (!-d "platforms\\$codeline");
    90 		mkdir("platforms\\$codeline\\single") if (!-d "platforms\\$codeline\\single");
    95 		mkdir("platforms\\$codeline\\single") if (!-d "platforms\\$codeline\\single");
    91 		mkdir("platforms\\$codeline\\single\\sysdefs") if (!-d "platforms\\$codeline\\single\\sysdefs");
    96 		mkdir("platforms\\$codeline\\single\\sysdefs") if (!-d "platforms\\$codeline\\single\\sysdefs");
    92 		mkdir("platforms\\$codeline\\single\\sysdefs\\auto") if (!-d "platforms\\$codeline\\single\\sysdefs\\auto");
    97 		mkdir("platforms\\$codeline\\single\\sysdefs\\auto") if (!-d "platforms\\$codeline\\single\\sysdefs\\auto");
    93 		system("copy $codeline\\system_model.xml platforms\\$codeline\\single\\sysdefs\\auto\\model_$timestamp\_$changeset.xml");
    98 		system("copy $codeline\\system_model.xml platforms\\$codeline\\single\\sysdefs\\auto\\model_$timestamp\_$packages_changeset.xml");
    94 		system("hg -R platforms add");
    99 		system("hg -R platforms add");
    95 		system("hg -R platforms commit -m \"Add auto generated $codeline system model (packages\@$changeset)\" -u\"Dario Sestito <darios\@symbian.org>\"");
   100 		system("hg -R platforms commit -m \"Add auto generated $codeline system model (packages\@$packages_changeset)\" -u\"Dario Sestito <darios\@symbian.org>\"");
    96 		system("hg -R platforms push http://darios:symbian696b\@developer.symbian.org/oss/MCL/sftools/fbf/projects/platforms");
   101 		#system("hg -R platforms push http://darios:symbian696b\@developer.symbian.org/oss/MCL/sftools/fbf/projects/platforms");
    97 		
   102 		
    98 		# Split model into package models
   103 		# Split model into package models
    99 		print "\n\n### SPLIT MODEL INTO PACKAGE MODELS ###\n";
   104 		print "\n\n### SPLIT MODEL INTO PACKAGE MODELS ###\n";
   100 		my $updatedefault_cmd = "hg -R packages update -r default";
   105 		my $updatedefault_cmd = "hg -R packages update -r default";
   101 		print "$updatedefault_cmd\n";
   106 		print "$updatedefault_cmd\n";
   102 		system($updatedefault_cmd);
   107 		system($updatedefault_cmd);
       
   108 		my $rmdir_cmd = "del /S packages\\symbian3\\package_definition.xml";
       
   109 		print "$rmdir_cmd\n";
       
   110 		system($rmdir_cmd);
   103 		my $splitmodel_cmd = "perl ..\\split_sysdef.pl -s $codeline\\system_model.xml -o packages\\$codeline";
   111 		my $splitmodel_cmd = "perl ..\\split_sysdef.pl -s $codeline\\system_model.xml -o packages\\$codeline";
   104 		print "$splitmodel_cmd\n";
   112 		print "$splitmodel_cmd\n";
   105 		system($splitmodel_cmd);
   113 		system($splitmodel_cmd);
   106 		if ($codeline eq 'symbian3') # also update CompilerCompatibility
   114 		if ($codeline eq 'symbian3') # also update CompilerCompatibility
   107 		{
   115 		{
       
   116 			my $rmdir2_cmd = "del /S  packages\\CompilerCompatibility\\package_definition.xml";
       
   117 			print "$rmdir2_cmd\n";
       
   118 			system($rmdir2_cmd);
   108 			my $splitmodel2_cmd = "perl ..\\split_sysdef.pl -s $codeline\\system_model.xml -o packages\\CompilerCompatibility";
   119 			my $splitmodel2_cmd = "perl ..\\split_sysdef.pl -s $codeline\\system_model.xml -o packages\\CompilerCompatibility";
   109 			print "$splitmodel2_cmd\n";
   120 			print "$splitmodel2_cmd\n";
   110 			system($splitmodel2_cmd);
   121 			system($splitmodel2_cmd);
   111 		}
   122 		}
   112 		my $diff_cmd = "hg -R packages diff --stat";
   123 		my $diff_cmd = "hg -R packages diff --stat";
   113 		print "$diff_cmd\n";
   124 		print "$diff_cmd\n";
   114 		my @diff_output = `$diff_cmd`;
   125 		my @diff_output = `$diff_cmd`;
   115 		if (@diff_output)
   126 		if (@diff_output)
   116 		{
   127 		{
   117 			my $add_cmd = "hg -R packages add";
   128 			my $addremove_cmd = "hg -R packages addremove";
   118 			print "$add_cmd\n";
   129 			print "$addremove_cmd\n";
   119 			system($add_cmd);
   130 			system($addremove_cmd);
   120 			my $commit_cmd = "hg -R packages commit -m \"Update package models from auto generated system model (packages\@$changeset)\" -u\"Dario Sestito <darios\@symbian.org>\"";
   131 			my $commit_cmd = "hg -R packages commit -m \"Update package models from auto generated system model (packages\@$packages_changeset)\" -u\"Dario Sestito <darios\@symbian.org>\"";
   121 			print "$commit_cmd\n";
   132 			print "$commit_cmd\n";
   122 			system($commit_cmd);
   133 			system($commit_cmd);
   123 			my $push_cmd = "hg -R packages push http://darios:symbian696b\@developer.symbian.org/oss/MCL/sftools/fbf/projects/packages";
   134 			my $push_cmd = "hg -R packages push http://darios:symbian696b\@developer.symbian.org/oss/MCL/sftools/fbf/projects/packages";
   124 			print "$push_cmd\n";
   135 			print "$push_cmd\n";
   125 			system($push_cmd);
   136 			#system($push_cmd);
   126 		}
   137 		}
   127 	}
   138 	}
   128 }
   139 }
   129 
   140