author | Dario Sestito <darios@symbian.org> |
Wed, 07 Apr 2010 13:38:21 +0100 | |
changeset 1062 | 242f69b8015f |
parent 1061 | 3088608c1558 |
child 1063 | fafd97533066 |
permissions | -rw-r--r-- |
1060
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
1 |
use strict; |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
2 |
|
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
3 |
my $SYSDEFTOOLS_PATH = "packages\\sysdeftools"; |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
4 |
my $XALAN_J = "java -jar $SYSDEFTOOLS_PATH\\xalan.jar"; |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
5 |
my $XALAN_C = "packages\\sysmodelgen\\rsc\\installed\\Xalan\\Xalan.exe"; |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
6 |
|
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
7 |
system("rmdir /S /Q tmp") if (-d "tmp"); |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
8 |
mkdir("tmp"); |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
9 |
chdir("tmp"); |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
10 |
|
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
11 |
print "\n\n### CLONE FCL/sftools/fbf/projects/packages REPO ###\n"; |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
12 |
system("hg clone -r HighFidelityModel http://developer.symbian.org/oss/FCL/sftools/fbf/projects/packages"); |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
13 |
my $changeset = `hg -R packages identify -i`; |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
14 |
chomp $changeset; |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
15 |
print "-->$changeset<--\n"; |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
16 |
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time); |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
17 |
my $timestamp = sprintf "%4d%02d%02d%02d%02d%02d",$year+1900,$mon+1,$mday,$hour,$min,$sec; |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
18 |
#print "\n\n### CLONE MCL/sf/os/buildtools REPO ###\n"; |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
19 |
#system("hg clone -r RCL_3 http://developer.symbian.org/oss/MCL/sf/os/buildtools"); |
1062
242f69b8015f
Use MCL for the platforms repo
Dario Sestito <darios@symbian.org>
parents:
1061
diff
changeset
|
20 |
print "\n\n### CLONE MCL/sftools/fbf/projects/platforms REPO ###\n"; |
242f69b8015f
Use MCL for the platforms repo
Dario Sestito <darios@symbian.org>
parents:
1061
diff
changeset
|
21 |
system("hg clone -r default http://developer.symbian.org/oss/MCL/sftools/fbf/projects/platforms"); |
1060
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
22 |
|
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
23 |
# get the codelines from the packages repo |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
24 |
opendir(DIR, "packages"); |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
25 |
my @codelines = grep(($_ !~ /^\.\.?$/ and $_ =~ /^symbian/), readdir(DIR)); |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
26 |
close(DIR); |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
27 |
|
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
28 |
# loop over codelines |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
29 |
for my $codeline (@codelines) |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
30 |
{ |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
31 |
mkdir($codeline); |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
32 |
|
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
33 |
my $ROOT_SYSDEF = "packages\\$codeline\\os\\deviceplatformrelease\\foundation_system\\system_model\\system_definition.xml"; |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
34 |
|
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
35 |
# Full model in schema 3.0.0 format, including all of the test units. |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
36 |
print "\n\n### GENERATE FULL MODEL ###\n"; |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
37 |
my $full_cmd = "$XALAN_C -o $codeline\\full_system_model_3.0.xml $ROOT_SYSDEF $SYSDEFTOOLS_PATH\\joinsysdef.xsl"; |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
38 |
print "$full_cmd\n"; |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
39 |
system($full_cmd); |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
40 |
|
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
41 |
# Filter the model to remove the test and techview units |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
42 |
print "\n\n### REMOVE UNDESIRED UNITS ###\n"; |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
43 |
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"; |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
44 |
print "$filter_cmd\n"; |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
45 |
system($filter_cmd); |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
46 |
|
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
47 |
# Downgrade the model to schema 2.0.1 for use with Helium and Raptor |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
48 |
print "\n\n### DOWNGRADE TO SCHEMA 2.0.1 ###\n"; |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
49 |
my $downgrade_cmd = "$XALAN_C -o $codeline\\system_model.xml $codeline\\system_model_3.0.xml $SYSDEFTOOLS_PATH\\sysdefdowngrade.xsl"; |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
50 |
print "$downgrade_cmd\n"; |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
51 |
system($downgrade_cmd); |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
52 |
|
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
53 |
print "\n\n### PUSH TO PLATFORMS REPOSITORY (auto) ###\n"; |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
54 |
my $isdifferent = 1; |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
55 |
#compare to latest |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
56 |
if (-d "platforms\\$codeline\\single\\sysdefs\\auto") |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
57 |
{ |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
58 |
opendir(DIR, "platforms\\$codeline\\single\\sysdefs\\auto"); |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
59 |
my @files = grep(($_ !~ /^\.\.?$/ and $_ =~ /^model_/), readdir(DIR)); |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
60 |
@files = sort { $b cmp $a } @files; |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
61 |
close(DIR); |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
62 |
|
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
63 |
my $mostrecent = shift @files; |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
64 |
print "mostrecent $mostrecent\n"; |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
65 |
|
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
66 |
#compare |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
67 |
my $file1 = ''; |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
68 |
my $file2 = ''; |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
69 |
{ |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
70 |
local $/ = undef; |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
71 |
open(FILE1, "platforms\\$codeline\\single\\sysdefs\\auto\\$mostrecent"); |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
72 |
{ |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
73 |
$file1 = <FILE1>; |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
74 |
} |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
75 |
close(FILE1); |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
76 |
open(FILE2, "$codeline\\system_model.xml"); |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
77 |
{ |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
78 |
$file2 = <FILE2>; |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
79 |
} |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
80 |
close(FILE2); |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
81 |
} |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
82 |
$isdifferent = 0 if ($file1 eq $file2); |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
83 |
} |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
84 |
if ($isdifferent) |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
85 |
{ |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
86 |
mkdir("platforms\\$codeline") if (!-d "platforms\\$codeline"); |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
87 |
mkdir("platforms\\$codeline\\single") if (!-d "platforms\\$codeline\\single"); |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
88 |
mkdir("platforms\\$codeline\\single\\sysdefs") if (!-d "platforms\\$codeline\\single\\sysdefs"); |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
89 |
mkdir("platforms\\$codeline\\single\\sysdefs\\auto") if (!-d "platforms\\$codeline\\single\\sysdefs\\auto"); |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
90 |
system("copy $codeline\\system_model.xml platforms\\$codeline\\single\\sysdefs\\auto\\model_$timestamp\_$changeset.xml"); |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
91 |
system("hg -R platforms add"); |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
92 |
system("hg -R platforms commit -m \"Add auto generated $codeline system model (packages\@$changeset)\" -u\"Dario Sestito <darios\@symbian.org>\""); |
1062
242f69b8015f
Use MCL for the platforms repo
Dario Sestito <darios@symbian.org>
parents:
1061
diff
changeset
|
93 |
system("hg -R platforms push http://darios:symbian696b\@developer.symbian.org/oss/MCL/sftools/fbf/projects/platforms"); |
1060
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
94 |
} |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
95 |
} |
14f4464f36ae
Add generate_system_models.pl
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
96 |