generate_package_defs.pl
author andy simpson <andrews@symbian.org>
Tue, 25 May 2010 17:13:38 +0100
changeset 1073 ac18844eb787
child 1074 15428d415dba
permissions -rw-r--r--
Separate the generation of the system model and the generation of the derived package definition into 2 script so can be run separately
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
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
    25
my $packages_changeset = '';
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
    26
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
    27
# 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
    28
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
    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
	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
    31
	
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
	# 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
    33
	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
    34
	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
    35
	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
    36
	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
    37
	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
    38
	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
    39
	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
    40
	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
    41
	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
    42
	system($splitmodel_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
	if ($codeline eq 'symbian3') # also update 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
    44
	{
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
		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
    46
		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
    47
		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
    48
		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
    49
		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
    50
		system($splitmodel2_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
	}
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
	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
    53
	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
    54
	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
    55
	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
    56
	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
    57
	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
    58
	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
    59
	{
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
    60
		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>\"";
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
    61
		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
    62
		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
    63
		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
    64
		print "$push_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
    65
		system($push_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
    66
	}
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
    67
}
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