common/tools/generate_package_defs.pl
author Simon Howkins <simonh@symbian.org>
Mon, 07 Jun 2010 15:17:50 +0100
changeset 1077 f16ac94c147c
parent 1075 20205e7ab525
child 1179 70d88996e8cd
permissions -rw-r--r--
Added a few strategically placed spaces, to improve the indentation of the output.
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
1074
15428d415dba updated commit message as no longer triggered by change in packages repo
andy simpson <andrews@symbian.org>
parents: 1073
diff changeset
    25
# get the changeset from the platform repo 
15428d415dba updated commit message as no longer triggered by change in packages repo
andy simpson <andrews@symbian.org>
parents: 1073
diff changeset
    26
my $platform_changeset = `hg -R platforms identify -i`;
15428d415dba updated commit message as no longer triggered by change in packages repo
andy simpson <andrews@symbian.org>
parents: 1073
diff changeset
    27
chomp $platform_changeset;
15428d415dba updated commit message as no longer triggered by change in packages repo
andy simpson <andrews@symbian.org>
parents: 1073
diff changeset
    28
print "-->$platform_changeset<--\n";
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
    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
# 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
    31
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
    32
{
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
	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
    34
	
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
	# 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
    36
	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
    37
	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
    38
	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
    39
	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
    40
	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
    41
	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
    42
	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
    43
	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
    44
	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
    45
	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
    46
	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
    47
	{
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 $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
    49
		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
    50
		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
    51
		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
    52
		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
    53
		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
    54
	}
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 $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
    56
	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
    57
	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
    58
	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
    59
	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
    60
	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
    61
	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
    62
	{
1074
15428d415dba updated commit message as no longer triggered by change in packages repo
andy simpson <andrews@symbian.org>
parents: 1073
diff changeset
    63
		my $commit_cmd = "hg -R packages commit -m \"Update package models from latest system model  (platform\@$platform_changeset)\" -u\"Dario Sestito <darios\@symbian.org>\"";
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
    64
		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
    65
		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
    66
		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
    67
		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
    68
		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
    69
	}
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
    70
}
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
    71