author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:34:36 +0300 | |
branch | RCL_3 |
changeset 70 | 375929f879c2 |
parent 57 | befca0ec475f |
permissions | -rw-r--r-- |
57 | 1 |
# |
2 |
# Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
# All rights reserved. |
|
4 |
# This component and the accompanying materials are made available |
|
5 |
# under the terms of "Eclipse Public License v1.0" |
|
6 |
# which accompanies this distribution, and is available |
|
7 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
# |
|
9 |
# Initial Contributors: |
|
10 |
# Nokia Corporation - initial contribution. |
|
11 |
# |
|
12 |
# Contributors: |
|
13 |
# |
|
14 |
# Description: |
|
15 |
# |
|
16 |
||
17 |
||
18 |
use warnings; |
|
19 |
use Cwd; # for cwd |
|
20 |
use File::Copy; |
|
21 |
use File::Path; |
|
22 |
||
23 |
my $debug = 0; |
|
24 |
my $allowRun = 1; |
|
25 |
my $relType = ""; |
|
26 |
my $sisPath = "videoplayer\\tsrc\\testing\\sis"; |
|
27 |
my $certFile = "Nokia_RnDCert_02\.der"; |
|
28 |
my $keyFile = "Nokia_RnDCert_02\.key"; |
|
29 |
my $comment = ";TEMPCOMMENT "; |
|
30 |
||
31 |
||
32 |
######################################## |
|
33 |
# PKG LISTS |
|
34 |
# |
|
35 |
||
36 |
my @engineTests = ( |
|
37 |
"videoplayer\\tsrc\\testing\\sis\\fusion_engine_tests.pkg", |
|
38 |
"videoplayer\\mediasettings\\mediasettingsengine\\tsrc\\mediasettingsenginetest\\group\\mpxmediasettingsenginetest.pkg", |
|
39 |
"videoplayer\\mediasettings\\videoplayersettingsengine\\tsrc\\vpsettingsenginetest\\group\\vcxnssettingsenginetest.pkg", |
|
40 |
"videoplayer\\videocollection\\mpxmyvideoscollection\\tsrc\\mpxmvcolltest\\group\\VCXMyVideosCollectionPluginTest.pkg", |
|
41 |
"videoplayer\\videoplayer_plat\\videoplayer_startup_api\\tsrc\\group\\VideoPlayerStartupApiTest.pkg", |
|
42 |
"videoplayer\\videoplayer_plat\\video_player_file_details_dialog_api\\tsrc\\group\\ui_FileDetailsDialogtest.pkg", |
|
43 |
"videoutils\\videoutils_plat\\videoscheduler_api\\tsrc\\group\\videoscheduler_apitest.pkg", |
|
44 |
"videoutils\\videoutils_plat\\videoconnutility_api\\tsrc\\group\\videoconnutility_apitest.pkg" |
|
45 |
); |
|
46 |
||
47 |
my @unitTests = ( |
|
70
375929f879c2
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
48 |
"videoplayer\\tsrc\\testing\\sis\\fusion_unit_tests.pkg", |
57 | 49 |
"videoplayer\\videoplayback\\videohelix\\tsrc\\ut_videohelixtest\\group\\videohelixtest.pkg", |
50 |
"videoplayer\\videoplayback\\videoplaybackcontrols\\tsrc\\videoplaybackcontrols_test\\group\\videoplaybackcontrolstest.pkg", |
|
51 |
"videoplayer\\videoplayback\\videoplaybackviews\\tsrc\\ut_userinputhandlertest\\group\\userinputhandlertest.pkg", |
|
52 |
"videoplayer\\videoplayerapp\\mpxvideoplayer\\tsrc\\ut_mpxvideoplayertest\\group\\mpxvideoplayertest.pkg", |
|
70
375929f879c2
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
53 |
"videoplayer\\videocollection\\hgmyvideos\\tsrc\\ut_vcxhgmyvideosmainview\\group\\VcxHgMyVideosMainViewTest.pkg", |
375929f879c2
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
54 |
"videoplayer\\videocollection\\mpxmyvideoscollection\\tsrc\\ut_collectionplugintest\\group\\ut_collectionplugintest.pkg", |
375929f879c2
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
55 |
"videoplayer\\videocollection\\mpxmyvideoscollection\\tsrc\\ut_vcxmyvideoscollectionutiltest\\group\\VcxMyVideosCollectionUtilTest.pkg", |
375929f879c2
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
56 |
"videoplayer\\videocollection\\mpxmyvideoscollection\\tsrc\\ut_vcxmyvideosmdsdb\\group\\VcxMyVideosMdsDbTest.pkg" |
57 | 57 |
); |
58 |
||
59 |
######################################## |
|
60 |
# PARSE ARGUMENTS |
|
61 |
# |
|
62 |
||
63 |
while(scalar(@ARGV) >= 1) |
|
64 |
{ |
|
65 |
my $argument = shift(@ARGV); |
|
66 |
||
67 |
if($argument eq "-sispath") |
|
68 |
{ |
|
69 |
$sisPath = shift(); |
|
70 |
} |
|
71 |
||
72 |
elsif($argument eq "-type") |
|
73 |
{ |
|
74 |
$relType = shift(); |
|
75 |
} |
|
76 |
||
77 |
elsif($argument eq "-norun") |
|
78 |
{ |
|
79 |
$allowRun = 0; |
|
80 |
} |
|
81 |
||
82 |
elsif($argument eq "-debug") |
|
83 |
{ |
|
84 |
$debug = 1; |
|
85 |
} |
|
86 |
||
87 |
elsif($argument eq "-help") |
|
88 |
{ |
|
89 |
ShowHelp(); |
|
90 |
} |
|
91 |
||
92 |
else |
|
93 |
{ |
|
94 |
ShowHelp(); |
|
95 |
} |
|
96 |
} |
|
97 |
||
98 |
######################################## |
|
99 |
# MAIN FUNCTION |
|
100 |
# |
|
101 |
||
102 |
my $basepath = FindBasePath(); |
|
103 |
die("NO VIDEOAPP_DOMAIN FOLDER FOUND") if $basepath eq ""; |
|
104 |
||
105 |
print "CREATING ${basepath}\\${sisPath}\n" if $debug; |
|
106 |
mkpath("${basepath}\\${sisPath}"); |
|
107 |
||
108 |
# if sispath doesn't contain files for signing, then search them under basepath |
|
109 |
if ( !-e "${basepath}\\${sisPath}\\${certFile}" and !-e "${basepath}\\${sisPath}\\${keyFile}" ) |
|
110 |
{ |
|
111 |
my @certfiles; |
|
112 |
FindFiles($basepath, $certFile, 1, \@certfiles); |
|
113 |
die("No $certFile found under ${basepath} !\n") if ( !$certfiles[0] ); |
|
114 |
my @keyfiles; |
|
115 |
FindFiles($basepath, $keyFile, 1, \@keyfiles); |
|
116 |
die("No $keyFile found under ${basepath} !\n") if ( !$keyfiles[0] ); |
|
117 |
||
118 |
print "COPYING $keyfiles[0] TO ${basepath}\\${sisPath}\\${keyFile}\n" if $debug; |
|
119 |
copy( $keyfiles[0], "${basepath}\\${sisPath}\\${keyFile}" ) if $allowRun; |
|
120 |
||
121 |
print "COPYING $keyfiles[0] TO ${basepath}\\${sisPath}\\${certFile}\n" if $debug; |
|
122 |
copy( $certfiles[0], "${basepath}\\${sisPath}\\${certFile}" ) if $allowRun; |
|
123 |
} |
|
124 |
||
125 |
die("No $certFile found in ${basepath}\\${sisPath}\n") if ( !-e "${basepath}\\${sisPath}\\${certFile}" ); |
|
126 |
die("No $keyFile found in ${basepath}\\${sisPath}\n") if ( !-e "${basepath}\\${sisPath}\\${keyFile}" ); |
|
127 |
||
128 |
foreach my $pkg ( @engineTests ) |
|
129 |
{ |
|
130 |
CreateSis( $basepath, $pkg, $sisPath, $relType ); |
|
131 |
} |
|
132 |
||
133 |
foreach my $pkg ( @unitTests ) |
|
134 |
{ |
|
135 |
CreateSis( $basepath, $pkg, $sisPath, $relType ); |
|
136 |
} |
|
137 |
||
138 |
######################################## |
|
139 |
# FindBasePath |
|
140 |
# |
|
141 |
||
142 |
sub FindBasePath |
|
143 |
{ |
|
144 |
print ">> FindBasePath\n" if $debug; |
|
145 |
$currpath = cwd; |
|
146 |
$basepath = ""; |
|
147 |
my $domain = "VideoApp_Domain"; |
|
148 |
||
149 |
my $pos = rindex( $currpath, $domain ); |
|
150 |
||
151 |
if( $pos != -1 ) |
|
152 |
{ |
|
153 |
$basepath = "\\" . substr( $currpath, 3, $pos + length( $domain ) - 3 ); |
|
154 |
$basepath =~ s/\//\\/g; |
|
155 |
print "BASEPATH FOUND: $basepath\n" if $debug; |
|
156 |
} |
|
157 |
||
158 |
print "<< FindBasePath (" . $basepath . ")\n" if $debug; |
|
159 |
return $basepath; |
|
160 |
} |
|
161 |
||
162 |
######################################## |
|
163 |
# CreateSis |
|
164 |
# |
|
165 |
||
166 |
sub CreateSis |
|
167 |
{ |
|
168 |
my ( $baseDir, $pkgPath, $targetDir, $relType ) = @_; |
|
169 |
print ">>> CREATESIS\n" if $debug; |
|
170 |
my $cmd = ""; |
|
171 |
print "baseDir: $baseDir\n" if $debug; |
|
172 |
print "pkgPath: $pkgPath\n" if $debug; |
|
173 |
print "targetDir: $targetDir\n" if $debug; |
|
174 |
||
175 |
my $pos = rindex( $pkgPath, '\\' ); |
|
176 |
print "rindex: $pos\n" if $debug; |
|
177 |
||
178 |
my $temppath = substr( $pkgPath, 0, $pos ); |
|
179 |
my $filename = substr( $pkgPath, $pos + 1, -4 ); |
|
180 |
||
181 |
# add type to the end of the filename |
|
182 |
my $relfilename = $filename; |
|
183 |
if( $relType ne "" ) |
|
184 |
{ |
|
185 |
$relfilename .= "_" . $relType; |
|
186 |
} |
|
187 |
||
188 |
print "path: $temppath\n" if $debug; |
|
189 |
print "file: $filename\n" if $debug; |
|
190 |
print "relfile: $relfilename\n" if $debug; |
|
191 |
||
192 |
||
193 |
chdir("${basepath}\\${temppath}"); |
|
194 |
||
195 |
AddComment( "${filename}.pkg" ) if $allowRun; |
|
196 |
if( $relType ne "" ) |
|
197 |
{ |
|
198 |
print "\nCREATE TEMPORARY PKG\n\n" if $debug; |
|
199 |
CreatePkg( $filename, $relType ); |
|
200 |
} |
|
201 |
$cmd = "call makesis ${relfilename}\.pkg ${relfilename}\.sis"; |
|
202 |
print $cmd . "\n" if $debug; |
|
203 |
system($cmd) if $allowRun; |
|
204 |
RemComment( "${filename}.pkg" ) if $allowRun; |
|
205 |
copy( "${relfilename}\.sis", "${baseDir}\\${targetDir}\\${relfilename}\.sis" ) if $allowRun; |
|
206 |
chdir("${baseDir}\\${targetDir}"); |
|
207 |
$cmd = "signsis ${relfilename}\.sis ${relfilename}\.sisx Nokia_RnDCert_02.der Nokia_RnDCert_02.key"; |
|
208 |
system($cmd) if $allowRun; |
|
209 |
unlink ( "${relfilename}\.sis" ) if $allowRun; |
|
210 |
print "<<< CREATESIS\n" if $debug; |
|
211 |
} |
|
212 |
||
213 |
||
214 |
######################################## |
|
215 |
# AddComment |
|
216 |
# |
|
217 |
||
218 |
sub AddComment |
|
219 |
{ |
|
220 |
my ($file) = @_; |
|
221 |
||
222 |
open(FILE_HANDLE, $file) or die ("Could not read file '$file'\n"); |
|
223 |
my @lines = <FILE_HANDLE>; |
|
224 |
close(FILE_HANDLE); |
|
225 |
||
226 |
open(FILE_HANDLE, ">$file") or die ("Could not write file '$file'\n"); |
|
227 |
foreach my $line ( @lines ) |
|
228 |
{ |
|
229 |
if( $line =~ /\.\.\/init\/testframework\.ini/i or $line =~ /\/cccccc00\.cre/i or |
|
230 |
$line =~ /\.\.\\init\\testframework\.ini/i or $line =~ /\\cccccc00\.cre/i ) |
|
231 |
{ |
|
232 |
if( $line !~ /$comment/ ) |
|
233 |
{ |
|
234 |
print $line . "\n" if $debug; |
|
235 |
$line = $comment . $line; |
|
236 |
print $line . "\n" if $debug; |
|
237 |
} |
|
238 |
} |
|
239 |
print FILE_HANDLE $line; |
|
240 |
} |
|
241 |
close(FILE_HANDLE); |
|
242 |
} |
|
243 |
||
244 |
######################################## |
|
245 |
# RemComment |
|
246 |
# |
|
247 |
||
248 |
sub RemComment |
|
249 |
{ |
|
250 |
my ($file) = @_; |
|
251 |
||
252 |
open(FILE_HANDLE, $file) or die ("Could not read file '$file'\n"); |
|
253 |
my @lines = <FILE_HANDLE>; |
|
254 |
close(FILE_HANDLE); |
|
255 |
||
256 |
open(FILE_HANDLE, ">$file") or die ("Could not write file '$file'\n"); |
|
257 |
foreach my $line ( @lines ) |
|
258 |
{ |
|
259 |
if( $line =~ /\.\.\/init\/testframework\.ini/i or $line =~ /\/cccccc00\.cre/i or |
|
260 |
$line =~ /\.\.\\init\\testframework\.ini/i or $line =~ /\\cccccc00\.cre/i ) |
|
261 |
{ |
|
262 |
if( $line =~ /$comment/ ) |
|
263 |
{ |
|
264 |
print $line . "\n" if $debug; |
|
265 |
$line = substr( $line, length( $comment ) ); |
|
266 |
print $line . "\n" if $debug; |
|
267 |
} |
|
268 |
} |
|
269 |
print FILE_HANDLE $line; |
|
270 |
} |
|
271 |
close(FILE_HANDLE); |
|
272 |
} |
|
273 |
||
274 |
######################################## |
|
275 |
# CreatePkg |
|
276 |
# |
|
277 |
||
278 |
sub CreatePkg |
|
279 |
{ |
|
280 |
my ($file, $type) = @_; |
|
281 |
||
282 |
open(FILE_HANDLE, "${file}\.pkg") or die ("Could not read file '${file}\.pkg'\n"); |
|
283 |
my @lines = <FILE_HANDLE>; |
|
284 |
close(FILE_HANDLE); |
|
285 |
||
286 |
my $currenttype = ""; |
|
287 |
open(FILE_HANDLE, ">${file}_${type}\.pkg") or die ("Could not write file '${file}_${type}\.pkg'\n"); |
|
288 |
foreach my $line ( @lines ) |
|
289 |
{ |
|
290 |
if( $line =~ /\/armv5\/(\w+)\//i ) |
|
291 |
{ |
|
292 |
$currenttype = $1; |
|
293 |
if( $currenttype ne $type ) |
|
294 |
{ |
|
295 |
print $line if $debug; |
|
296 |
$line =~ s/\/$currenttype\//\/$type\//; |
|
297 |
print $line if $debug; |
|
298 |
} |
|
299 |
} |
|
300 |
print FILE_HANDLE $line; |
|
301 |
} |
|
302 |
close(FILE_HANDLE); |
|
303 |
} |
|
304 |
||
305 |
#------------------------------------------------------------------------------------ |
|
306 |
# FindFiles |
|
307 |
# Parameters: |
|
308 |
# $goDir, where to start finding |
|
309 |
# $fileSearch, filename search |
|
310 |
# $searchType, 0 = fullname search, 1 = filetype search |
|
311 |
# $refIncfiles, reference to array which will hold found files |
|
312 |
#------------------------------------------------------------------------------------ |
|
313 |
sub FindFiles |
|
314 |
{ |
|
315 |
my ($godir, $fileSearch, $searchType, $refIncfiles) = @_; |
|
316 |
||
317 |
my $startDir = cwd; |
|
318 |
||
319 |
chdir($godir) or die("Could not change dir to $godir"); |
|
320 |
||
321 |
#print("Now in: " . cwd . "\n"); |
|
322 |
||
323 |
opendir(DIR, "."); |
|
324 |
my @filelist = sort(readdir(DIR)); |
|
325 |
closedir(DIR); |
|
326 |
||
327 |
foreach my $file(@filelist) |
|
328 |
{ |
|
329 |
if($file eq "." or $file eq "..") {next}; |
|
330 |
||
331 |
if (-d $file) |
|
332 |
{ |
|
333 |
FindFiles( $file, $fileSearch, $searchType, $refIncfiles); |
|
334 |
} else |
|
335 |
{ |
|
336 |
if( ($file =~ m/$fileSearch/i and $searchType == 0 ) or ($file =~ m/$fileSearch$/i and $searchType == 1 ) ) |
|
337 |
{ |
|
338 |
$file = cwd . "/" . $file; |
|
339 |
push @$refIncfiles, $file; |
|
340 |
#print("$file\n"); |
|
341 |
; |
|
342 |
} |
|
343 |
} |
|
344 |
} |
|
345 |
||
346 |
chdir ($startDir) or die("Could not change dir to $startDir"); |
|
347 |
} |
|
348 |
||
349 |
#------------------------------------------------------------------------------------ |
|
350 |
# ShowHelp |
|
351 |
#------------------------------------------------------------------------------------ |
|
352 |
sub ShowHelp { |
|
353 |
||
354 |
print <<USAGE_EOF; |
|
355 |
siscreator.pl |
|
356 |
||
357 |
This script will search the VideoApp_Domain root folder from current path. |
|
358 |
if the root folder is not found, the script will exit. In any other case, |
|
359 |
it creates sis packages for components. |
|
360 |
||
361 |
Default path for sis-files is /videoplayer/tsrc/testing/sis. |
|
362 |
||
363 |
Options: |
|
364 |
||
365 |
-sispath path under videoapp_domain to copy sis files |
|
366 |
-type wanted sisx type, urel or udeb |
|
367 |
-debug show debug message |
|
368 |
-norun do not run, for debugging purposes |
|
369 |
-help You're reading it. |
|
370 |
||
371 |
USAGE_EOF |
|
372 |
||
373 |
exit(); |
|
374 |
||
375 |
}; |