generate_system_models.pl
changeset 1068 6f5db200d8d5
parent 1067 bab959d5bc37
child 1069 96567d7b618a
equal deleted inserted replaced
1067:bab959d5bc37 1068:6f5db200d8d5
     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 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 $updatehifi_cmd = "hg -R packages update -r HighFidelityModel";
       
    14 print "$updatehifi_cmd\n";
       
    15 system($updatehifi_cmd);
    13 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
    16 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
    14 my $timestamp = sprintf "%4d%02d%02d%02d%02d%02d",$year+1900,$mon+1,$mday,$hour,$min,$sec;
    17 my $timestamp = sprintf "%4d%02d%02d%02d%02d%02d",$year+1900,$mon+1,$mday,$hour,$min,$sec;
    15 #print "\n\n### CLONE MCL/sf/os/buildtools REPO ###\n";
    18 #print "\n\n### CLONE MCL/sf/os/buildtools REPO ###\n";
    16 #system("hg clone -r RCL_3 http://developer.symbian.org/oss/MCL/sf/os/buildtools");
    19 #system("hg clone -r RCL_3 http://developer.symbian.org/oss/MCL/sf/os/buildtools");
    17 print "\n\n### CLONE MCL/sftools/fbf/projects/platforms REPO ###\n";
    20 print "\n\n### CLONE MCL/sftools/fbf/projects/platforms REPO ###\n";
    57 	my $downgrade_cmd = "$XALAN_C -o $codeline\\system_model.xml $codeline\\system_model_3.0.xml $SYSDEFTOOLS_PATH\\sysdefdowngrade.xsl";
    60 	my $downgrade_cmd = "$XALAN_C -o $codeline\\system_model.xml $codeline\\system_model_3.0.xml $SYSDEFTOOLS_PATH\\sysdefdowngrade.xsl";
    58 	print "$downgrade_cmd\n";
    61 	print "$downgrade_cmd\n";
    59 	system($downgrade_cmd);
    62 	system($downgrade_cmd);
    60 
    63 
    61 	print "\n\n### PUSH TO PLATFORMS REPOSITORY (auto) ###\n";
    64 	print "\n\n### PUSH TO PLATFORMS REPOSITORY (auto) ###\n";
    62 	my $isdifferent = 1;
    65 	mkdir("platforms\\$codeline") if (!-d "platforms\\$codeline");
    63 	#compare to latest
    66 	mkdir("platforms\\$codeline\\single") if (!-d "platforms\\$codeline\\single");
    64 	if (-d "platforms\\$codeline\\single\\sysdefs\\auto")
    67 	mkdir("platforms\\$codeline\\single\\sysdefs") if (!-d "platforms\\$codeline\\single\\sysdefs");
       
    68 	my $updatesysdef_cmd = "copy /Y $codeline\\system_model.xml platforms\\$codeline\\single\\sysdefs\\system_model.xml";
       
    69 	print "$updatesysdef_cmd\n";
       
    70 	system($updatesysdef_cmd);
       
    71 	my $diff_cmd = "hg -R platforms diff --stat";
       
    72 	print "$diff_cmd\n";
       
    73 	my @diff_output = `$diff_cmd`;
       
    74 	if (@diff_output)
    65 	{
    75 	{
    66 		opendir(DIR, "platforms\\$codeline\\single\\sysdefs\\auto");
    76 		system("hg -R platforms add"); # just in case this is a new platform
    67 		my @files = grep(($_ !~ /^\.\.?$/ and $_ =~ /^model_/), readdir(DIR));
       
    68 		@files = sort { $b cmp $a } @files;
       
    69 		close(DIR);
       
    70 		
       
    71 		my $mostrecent = shift @files;
       
    72 		print "mostrecent $mostrecent\n";
       
    73 		
       
    74 		#compare
       
    75 		my $file1 = '';
       
    76 		my $file2 = '';
       
    77 		{
       
    78 			local $/ = undef;
       
    79 			open(FILE1, "platforms\\$codeline\\single\\sysdefs\\auto\\$mostrecent");
       
    80 			{
       
    81 				$file1 = <FILE1>;
       
    82 			}
       
    83 			close(FILE1);
       
    84 			open(FILE2, "$codeline\\system_model.xml");
       
    85 			{
       
    86 				$file2 = <FILE2>;
       
    87 			}
       
    88 			close(FILE2);
       
    89 		}
       
    90 		$isdifferent = 0 if ($file1 eq $file2);
       
    91 	}
       
    92 	if ($isdifferent)
       
    93 	{
       
    94 		mkdir("platforms\\$codeline") if (!-d "platforms\\$codeline");
       
    95 		mkdir("platforms\\$codeline\\single") if (!-d "platforms\\$codeline\\single");
       
    96 		mkdir("platforms\\$codeline\\single\\sysdefs") if (!-d "platforms\\$codeline\\single\\sysdefs");
       
    97 		mkdir("platforms\\$codeline\\single\\sysdefs\\auto") if (!-d "platforms\\$codeline\\single\\sysdefs\\auto");
       
    98 		system("copy $codeline\\system_model.xml platforms\\$codeline\\single\\sysdefs\\auto\\model_$timestamp\_$packages_changeset.xml");
       
    99 		system("hg -R platforms add");
       
   100 		system("hg -R platforms commit -m \"Add auto generated $codeline system model (packages\@$packages_changeset)\" -u\"Dario Sestito <darios\@symbian.org>\"");
    77 		system("hg -R platforms commit -m \"Add auto generated $codeline system model (packages\@$packages_changeset)\" -u\"Dario Sestito <darios\@symbian.org>\"");
   101 		#system("hg -R platforms push http://darios:symbian696b\@developer.symbian.org/oss/MCL/sftools/fbf/projects/platforms");
    78 		system("hg -R platforms push http://darios:symbian696b\@developer.symbian.org/oss/MCL/sftools/fbf/projects/platforms");
   102 		
    79 		
   103 		# Split model into package models
    80 		# Split model into package models
   104 		print "\n\n### SPLIT MODEL INTO PACKAGE MODELS ###\n";
    81 		print "\n\n### SPLIT MODEL INTO PACKAGE MODELS ###\n";
   105 		my $updatedefault_cmd = "hg -R packages update -r default";
    82 		my $updatedefault_cmd = "hg -R packages update -r default";
   106 		print "$updatedefault_cmd\n";
    83 		print "$updatedefault_cmd\n";
   107 		system($updatedefault_cmd);
    84 		system($updatedefault_cmd);
   108 		my $rmdir_cmd = "del /S packages\\symbian3\\package_definition.xml";
    85 		my $rmdir_cmd = "del /S packages\\symbian3\\package_definition.xml >nul";
   109 		print "$rmdir_cmd\n";
    86 		print "$rmdir_cmd\n";
   110 		system($rmdir_cmd);
    87 		system($rmdir_cmd);
   111 		my $splitmodel_cmd = "perl ..\\split_sysdef.pl -s $codeline\\system_model.xml -o packages\\$codeline";
    88 		my $splitmodel_cmd = "perl ..\\split_sysdef.pl -s $codeline\\system_model.xml -o packages\\$codeline";
   112 		print "$splitmodel_cmd\n";
    89 		print "$splitmodel_cmd\n";
   113 		system($splitmodel_cmd);
    90 		system($splitmodel_cmd);
   114 		if ($codeline eq 'symbian3') # also update CompilerCompatibility
    91 		if ($codeline eq 'symbian3') # also update CompilerCompatibility
   115 		{
    92 		{
   116 			my $rmdir2_cmd = "del /S  packages\\CompilerCompatibility\\package_definition.xml";
    93 			my $rmdir2_cmd = "del /S  packages\\CompilerCompatibility\\package_definition.xml >nul";
   117 			print "$rmdir2_cmd\n";
    94 			print "$rmdir2_cmd\n";
   118 			system($rmdir2_cmd);
    95 			system($rmdir2_cmd);
   119 			my $splitmodel2_cmd = "perl ..\\split_sysdef.pl -s $codeline\\system_model.xml -o packages\\CompilerCompatibility";
    96 			my $splitmodel2_cmd = "perl ..\\split_sysdef.pl -s $codeline\\system_model.xml -o packages\\CompilerCompatibility";
   120 			print "$splitmodel2_cmd\n";
    97 			print "$splitmodel2_cmd\n";
   121 			system($splitmodel2_cmd);
    98 			system($splitmodel2_cmd);
   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>\"";
   108 			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>\"";
   132 			print "$commit_cmd\n";
   109 			print "$commit_cmd\n";
   133 			system($commit_cmd);
   110 			system($commit_cmd);
   134 			my $push_cmd = "hg -R packages push http://darios:symbian696b\@developer.symbian.org/oss/MCL/sftools/fbf/projects/packages";
   111 			my $push_cmd = "hg -R packages push http://darios:symbian696b\@developer.symbian.org/oss/MCL/sftools/fbf/projects/packages";
   135 			print "$push_cmd\n";
   112 			print "$push_cmd\n";
   136 			#system($push_cmd);
   113 			system($push_cmd);
   137 		}
   114 		}
   138 	}
   115 	}
   139 }
   116 }
   140 
   117