|
1 # |
|
2 # Copyright (c) 2009 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 package Remote_utils; |
|
18 use SDK_vars; |
|
19 use SDK_utils; |
|
20 use ApiRef; |
|
21 use File::Path; |
|
22 |
|
23 use XML::Writer; |
|
24 use IO::File; |
|
25 use XML::Simple; |
|
26 |
|
27 use HTTP::Response; |
|
28 use HTTP::Request::Common qw(POST); |
|
29 use LWP::UserAgent; |
|
30 use Mail::Sendmail qw(sendmail %mailcfg); |
|
31 use Cwd; |
|
32 |
|
33 our ($VERSION, @ISA, @EXPORT); |
|
34 |
|
35 $VERSION = 1.00; |
|
36 @ISA = qw(Exporter); |
|
37 @EXPORT = qw(copy_platform reconfigure fetch_IF_sheets create_api_and_black_lists Notify_plain_mail Notify_mail beatnik fetch_capas Notify_sms); |
|
38 |
|
39 sub copy_platform { |
|
40 my ($href) = @_; |
|
41 enter_sub(); |
|
42 |
|
43 my $curr_dir = cwd; |
|
44 system ("subst"); |
|
45 chdir "$$href{S60_Root}\\"; |
|
46 my $cmd = "xcopy $iniH{Getenv_server}\\Builds\\Tools\\getenv\\getenv.pl $$href{S60_Root} /F /R /Y"; |
|
47 system ($cmd)==0 or die "$cmd failed!\n"; |
|
48 foreach my $pl_src_path ( split (/ /, $iniH{Platform_Build}) ){ |
|
49 $cmd = "perl getenv.pl -start -k -path $pl_src_path -grace -verbose"; |
|
50 print "$cmd\n"; system ($cmd); |
|
51 } |
|
52 chdir $curr_dir or die "Couldn't chdir to $curr_dir: $!"; |
|
53 }; |
|
54 |
|
55 sub reconfigure { |
|
56 my ($href) = @_; |
|
57 my $four_part_name; |
|
58 enter_sub($$href{SCM_Project}); |
|
59 |
|
60 $|=1; |
|
61 |
|
62 my $pwd = `getPwd Synergy` or print "\n ERROR: Can not Execute getPwd Synergy"; |
|
63 my $addr = `ccm start -r build_mgr -q -nogui -m -pw $pwd`; |
|
64 print "\n CCM ADDRESS: $addr \n "; |
|
65 $ENV{CCM_ADDR} = $addr if $addr; |
|
66 die "Logon failed!!!" if (!$addr and $$href{'Reconfigure'} =~ /(TRUE|YES)/i); |
|
67 warn "Logon failed", return unless $addr; |
|
68 #Print project info |
|
69 my ($proj_name, $proj_version) = split "-", $$href{SCM_Project}; |
|
70 warn "Project not found", return unless $proj_version; |
|
71 chomp(my $project_object = `ccm query -type project -name $proj_name -version $proj_version -u -f \"%objectname\"`); |
|
72 |
|
73 system "ccm query -type project -name $proj_name -version $proj_version -u -f \"%objectname %release\""; |
|
74 print "Reconfigure $$href{'Reconfigure'}\n"; |
|
75 if ($$href{'Reconfigure'} =~ /(TRUE|YES)/i) { |
|
76 #Print the reconf time to the log |
|
77 print "Reconf_time : "; |
|
78 system "ccm attr -s reconf_time \"$project_object\""; |
|
79 #Force Maintain workarea on |
|
80 my $cmd = "ccm wa -wa -relative -recurse -p \"$project_object\" -path \"$iniH{SCM_WA_Path}\""; |
|
81 print ("\n$cmd\n\n"); system ($cmd); |
|
82 #First Reconcile |
|
83 system "ccm reconc -ignore_uncontrolled -recurse -update_wa $project_object"; |
|
84 #Print rp |
|
85 system "ccm rp /sh i $project_object"; |
|
86 #and tasks |
|
87 #then reconfigure |
|
88 system "ccm reconfigure /recurse /project $project_object"; |
|
89 #Print rp |
|
90 system "ccm rp /sh i $project_object"; |
|
91 #Print the baseline |
|
92 $cmd = "ccm rp -sh b \"$project_object\" -u"; |
|
93 print "$cmd\n"; |
|
94 system($cmd); |
|
95 $four_part_name="$project_object"; |
|
96 print "Fout Part Project Name: $four_part_name\n"; |
|
97 print "\n\nConflicts Start\n"; |
|
98 $cmd = "ccm conflicts -recurse -nowrap -tasks $four_part_name"; |
|
99 print "$cmd\n"; |
|
100 system($cmd); |
|
101 $cmd = "ccm conflicts -recurse -nowrap $four_part_name"; |
|
102 print "$cmd\n"; |
|
103 system($cmd); |
|
104 print "\n\nConflicts End\n"; |
|
105 #and tasks |
|
106 $cmd = "ccm rp -sh all_tasks \"$project_object\" -f \"%displayname %release %completion_date %owner %task_synopsis\""; |
|
107 print "$cmd\n"; |
|
108 system ($cmd); |
|
109 |
|
110 #Print the task according to Print_tasks_since specification in sdk.ini, or print yesterday anyway |
|
111 my @tasks_since = split " ", $iniH{Print_tasks_since} || ("-1:0:0:0"); |
|
112 for (my $i=0; $i < @tasks_since -1; ++$i){ |
|
113 $cmd = "ccm query \"(is_task_in_rp_of('$project_object') or is_task_in_folder_of(is_folder_in_rp_of('$project_object'))) and completion_date >= time('$tasks_since[$i]') and completion_date < time('$tasks_since[$i+1]')\" -f \"%displayname %task_synopsis\""; |
|
114 print "\n$cmd\n\nTasks completed between [$tasks_since[$i] - $tasks_since[$i+1]):\n"; |
|
115 system ($cmd); |
|
116 print "\nEnd of recent tasks.\n"; |
|
117 } |
|
118 $cmd = "ccm query \"(is_task_in_rp_of('$project_object') or is_task_in_folder_of(is_folder_in_rp_of('$project_object'))) and completion_date > time('$tasks_since[@tasks_since-1]')\" -f \"%displayname %task_synopsis\""; |
|
119 print "\n$cmd\n\nRecently completed tasks (since $tasks_since[@tasks_since-1]):\n"; |
|
120 system ($cmd); |
|
121 print "\nEnd of recent tasks.\n"; |
|
122 |
|
123 #Print the reconf time to the log |
|
124 print "Reconf_time : "; |
|
125 system "ccm attr -s reconf_time \"$project_object\""; |
|
126 } |
|
127 #Grab the work area path |
|
128 chomp($wa_path = `ccm attr /s wa_path \"$project_object\"`); |
|
129 $$href{SCM_Workarea} = $wa_path if ($wa_path and !$$href{SCM_Workarea}); |
|
130 print "\nSCM WorkArea: $$href{SCM_Workarea}\n"; |
|
131 system "ccm stop"; |
|
132 exit_sub(); |
|
133 }; |
|
134 |
|
135 sub fetch_IF_sheets |
|
136 { |
|
137 |
|
138 my ($sheet_source_dir, $IFs_dir, $iniH) = @_; |
|
139 |
|
140 #Check if repository directory is ready to be used, ie. it exists and is not empty, otherwise use document browser |
|
141 ($sheet_source_dir, my $doc_browser_url) = check_sheet_repository( $sheet_source_dir, $href ); |
|
142 |
|
143 enter_sub($sheet_source_dir || $doc_browser_url); |
|
144 my $curr_dir = cwd; |
|
145 |
|
146 |
|
147 |
|
148 mkpath($IFs_dir) unless (-e $IFs_dir); #Make it |
|
149 #All_If_sheets_S60.zip will be downloaded to this location and then copied to $IFs_dir. |
|
150 mkpath($iniH{'Sheets_Local_Repo'}) unless (-d $iniH{'Sheets_Local_Repo'}); |
|
151 |
|
152 |
|
153 chdir $iniH{'Sheets_Local_Repo'} or print "\n ERROR: Can not chdir to $iniH{'Sheets_Local_Repo'}, $!"; |
|
154 |
|
155 unless ( $sheet_source_dir ) |
|
156 {#If source directory does not exists, get the stuff from server |
|
157 print "\n Download IFs to $iniH{'Sheets_Local_Repo'}, URL: $doc_browser_url"; |
|
158 #Get password from registry, not from user! |
|
159 open( PWD, "getPwd Sheets |") or die "Cannot open getPwd: $!"; |
|
160 chomp(my $pwd = <PWD>); |
|
161 close( PWD ); |
|
162 |
|
163 $ua = LWP::UserAgent->new; |
|
164 $ua->cookie_jar( {} ); |
|
165 my $uid = getlogin || getpwuid($<); |
|
166 my $req = HTTP::Request->new(GET => "$doc_browser_url/All_If_sheets_S60.zip"); |
|
167 $req->authorization_basic($uid, $pwd); |
|
168 $res = $ua->request($req); |
|
169 print "\n WARNING: Fetching $doc_browser_url All_If_sheets_S60.zip FAILED!!!\n Local copy from $iniH{'Sheets_Local_Repo'} will be used." unless ($res->is_success); |
|
170 |
|
171 if ($res->title =~ /Web Single Sign-On Login/) |
|
172 { |
|
173 $res = $ua->post($res->request->uri->as_string, |
|
174 [ |
|
175 SMENC => 'Base64', |
|
176 USER => $uid, |
|
177 PASSWORD => $pwd, |
|
178 submit => "Authenticate", |
|
179 ]); |
|
180 # We need to follow the redirect from the login page |
|
181 $res = $ua->request($req, "All_If_sheets_S60.zip"); #The name for the output file needs to be specified somehow. Next line works also. |
|
182 |
|
183 print "\n WARNING: *** WebSSO post failed: ,Local copy from $iniH{'Sheets_Local_Repo'} will be used. ", $res->status_line if $res->is_error; |
|
184 print "\n WARNING: WebSSO Login failed (bad password?), Local copy from $iniH{'Sheets_Local_Repo'} will be used." if $res->as_string =~ /authenticate via WebSSO/; |
|
185 } |
|
186 |
|
187 my $req2 = HTTP::Request->new(GET => "$doc_browser_url/Other/tools_if_sheets_compare.zip"); |
|
188 |
|
189 $res2 = $ua->request($req2, "tools_if_sheets_compare.zip"); |
|
190 print "\n WARNING: Fetching tools_if_sheets_compare.zip failed, Local copy from $iniH{'Sheets_Local_Repo'} will be used." unless ($res2->is_success); |
|
191 } |
|
192 elsif(-d $sheet_source_dir) |
|
193 { |
|
194 my $cmd = "xcopy $sheet_source_dir\\*.zip /F /R /Y"; #Copy All_If_sheets_S60.zip and tools |
|
195 system ($cmd)==0 or print ($cmd."\n"); |
|
196 $cmd = "xcopy $sheet_source_dir\\*.xls /F /R /Y"; #(First) sheet patches |
|
197 system ($cmd)==0 or print ($cmd."\n"); |
|
198 } |
|
199 else |
|
200 { |
|
201 print "Nothing to fetch!\n"; |
|
202 } |
|
203 |
|
204 #Now copy from local $iniH{'Sheets_Local_Repo'} to $IFs_dir, So if IFSHEETS site is down, it will pick from local copy |
|
205 chdir $IFs_dir or print "\n ERROR: Can not chdir to $iniH{'Sheets_Local_Repo'}, $!"; |
|
206 |
|
207 print "\n\n Copy IFs from $iniH{'Sheets_Local_Repo'} to $IFs_dir\n"; |
|
208 $cmd = "xcopy $iniH{'Sheets_Local_Repo'}\\*.zip /F /R /Y"; |
|
209 system ($cmd)==0 or print ($cmd."\n"); |
|
210 |
|
211 # Copy (own) patch sheets |
|
212 print "\n\n Copy IFs patches from $iniH{ Sheet_Patches } to $IFs_dir\n"; |
|
213 $cmd = "xcopy $iniH{ Sheet_Patches }\\*.xls /F /R /Y"; |
|
214 system ($cmd)==0 or print ($cmd."\n"); |
|
215 |
|
216 chdir $curr_dir or die "Couldn't chdir to $curr_dir: $!"; |
|
217 exit_sub(); |
|
218 } |
|
219 |
|
220 sub check_sheet_repository { |
|
221 my ($zip_dir, $iniH) = @_; |
|
222 my $doc_browser_url = "$iniH{Doc_Browser_Url}"; |
|
223 |
|
224 (-e $zip_dir) || return ("", $doc_browser_url); |
|
225 opendir(my $DIR, $zip_dir) || do {print "can't opendir $zip_dir: $!\n"; return ("", $doc_browser_url)}; |
|
226 my @zips = grep { /\.(zip|xls)$/i } readdir($DIR); |
|
227 closedir $DIR; |
|
228 |
|
229 if (@zips){ #We found some zips or xls files -> use that directory |
|
230 return ($zip_dir, ""); |
|
231 } |
|
232 return ("", $doc_browser_url); |
|
233 } |
|
234 |
|
235 sub create_api_and_black_lists { |
|
236 |
|
237 # @_ = qw( 3.0 IFs sheets result \\Repository_area\\CPP_API \\Repository_area\\Common_Blacklist) unless @_; |
|
238 my ($rel, $IFs_dir, $sheets_sub_dir, $result_dir, $cpp_api_dir, $black_list_dir, $org_dir) = @_; |
|
239 |
|
240 enter_sub(); |
|
241 my $curr_dir = cwd; |
|
242 return unless (chdir $IFs_dir); |
|
243 |
|
244 my $all_zip = "All_If_sheets_S60.zip"; |
|
245 $all_zip = "All_If_sheets_S60_2.zip" unless (-e $all_zip); #Try the produced one if we are not supposed to use the server |
|
246 |
|
247 my $cmd = "unzip -o $all_zip -d $sheets_sub_dir"; |
|
248 print ($cmd."\n"); system ($cmd); |
|
249 |
|
250 $cmd = "xcopy *.xls $sheets_sub_dir\\ /F /R /Y"; |
|
251 system ($cmd)==0 or print ($cmd."\n"); |
|
252 |
|
253 |
|
254 $cmd = "unzip -o tools_if_sheets_compare.zip"; |
|
255 print ($cmd."\n"); system ($cmd); |
|
256 |
|
257 # print "result dir: $result_dir\n"; |
|
258 mkpath $result_dir unless (-e $result_dir); |
|
259 $cmd = "perl gather_sdk_info.pl -p S60 -r $rel -d $sheets_sub_dir -t $result_dir"; |
|
260 print ($cmd."\n"); system ($cmd); |
|
261 |
|
262 #Put them into one file if sheets were specified for S60, sdk_apis.txt |
|
263 if ($iniH{S60_API} eq 'sheets'){ |
|
264 $cmd = "type $result_dir\\_sdk_*.txt > $result_dir\\sdk_apis.txt"; |
|
265 print ($cmd."\n"); system ($cmd); |
|
266 } else { #or if metaxmls are used |
|
267 $cmd = "type $result_dir\\_sdk_*symbian*.txt > $result_dir\\sdk_apis_symbian.txt"; |
|
268 print ($cmd."\n"); system ($cmd); |
|
269 $cmd = "type $result_dir\\_sdk_*nokia*.txt > $result_dir\\sdk_apis_nokia.txt"; |
|
270 print ($cmd."\n"); system ($cmd); |
|
271 } |
|
272 |
|
273 $cmd = "move /y $result_dir\\_black_list.txt $result_dir\\black_list.txt"; #Renaming! |
|
274 print ($cmd."\n"); system ($cmd); |
|
275 $cmd = "xcopy $result_dir\\black_list.txt $black_list_dir\\ /F /R /Y"; |
|
276 system ($cmd)==0 or print ($cmd."\n"); |
|
277 |
|
278 $cmd = "zip -j All_If_sheets_S60_2.zip $sheets_sub_dir\\*.*"; |
|
279 print ($cmd."\n"); system ($cmd); |
|
280 system ("del All_If_sheets_S60.zip") if (-e "All_If_sheets_S60.zip"); |
|
281 |
|
282 |
|
283 $cmd = "xcopy $result_dir\\sdk_*.txt $cpp_api_dir\\ /F /R /Y"; |
|
284 system ($cmd)==0 or print ($cmd."\n"); |
|
285 |
|
286 chdir $curr_dir or die "Couldn't chdir to $curr_dir: $!"; |
|
287 print "create_api_and_black_lists finished === ", scalar localtime(), "\n"; |
|
288 } |
|
289 |
|
290 |
|
291 |
|
292 sub Notify_mail { |
|
293 |
|
294 my ($msg) = @_; |
|
295 |
|
296 print "Notifying $msg\n\n"; |
|
297 $mailcfg{smtp} = [qw(mgw.nokia.com)]; |
|
298 $mailcfg{from} = "$iniH{Mail_From}"; |
|
299 |
|
300 %mail = ( To => "$iniH{Mail_To}", |
|
301 Cc => "$iniH{Mail_Cc}", |
|
302 Subject => "$msg", |
|
303 'content-type' => 'text/html; charset="iso-8859-1"', |
|
304 ); |
|
305 |
|
306 $mail{body} = <<END_OF_HEADER; |
|
307 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" |
|
308 "http://www.w3.org/TR/html4/loose.dtd"> |
|
309 <html> |
|
310 <head> |
|
311 <title> $msg </title> |
|
312 <style type="text/css"> |
|
313 #container |
|
314 { |
|
315 padding: 1em; |
|
316 width: 90%; |
|
317 margin: 10px auto; |
|
318 line-height: 110%; |
|
319 } |
|
320 |
|
321 body { |
|
322 color: blue; |
|
323 background: white; |
|
324 margin-left: 1em; |
|
325 margin-right: 1em; |
|
326 font-family: arial, helvetica, sans-serif; |
|
327 } |
|
328 pre { |
|
329 font-family: monospace; |
|
330 } |
|
331 .tasks { |
|
332 border: none; |
|
333 font-family: monospace; |
|
334 font-size: 70%; |
|
335 color: green; |
|
336 } |
|
337 .components { |
|
338 border: none; |
|
339 font-family: monospace; |
|
340 font-size: 80%; |
|
341 } |
|
342 .errors { |
|
343 border: none; |
|
344 font-family: monospace; |
|
345 font-size: 70%; |
|
346 color: red; |
|
347 } |
|
348 .platform_patches { |
|
349 border: none; |
|
350 font-family: monospace; |
|
351 font-size: 70%; |
|
352 color: maroon; |
|
353 } |
|
354 .error_reports { |
|
355 border: none; |
|
356 font-family: monospace; |
|
357 font-size: 70%; |
|
358 color: magenta; |
|
359 } |
|
360 .navbar { |
|
361 position: relative; |
|
362 margin: 0; |
|
363 padding: 1em; |
|
364 font-size: 70%; |
|
365 } |
|
366 A:link, A:visited { text-decoration: none; } |
|
367 A:hover { background: cyan; } |
|
368 </style> |
|
369 </head> |
|
370 END_OF_HEADER |
|
371 |
|
372 $mail{body} .= <<END_OF_BODY; |
|
373 <div id="container"> |
|
374 $body |
|
375 </div> |
|
376 </body> |
|
377 </html> |
|
378 END_OF_BODY |
|
379 |
|
380 # Create the mail report in build output directory |
|
381 my $report_fn="$iniH{Output_Base}\\$iniH{Release}\\$iniH{Platform_Version_Major}.$iniH{Platform_Version_Minor}\\$iniH{Start_time}\\SDK_team_only\\Build_Log\\Build_Report.html"; |
|
382 open (BR, ">$report_fn") or print "\n ERROR: Can not create $report_fn"; |
|
383 print BR $mail{body}; |
|
384 close(BR); |
|
385 |
|
386 #Send out mail. |
|
387 sendmail(%mail) or die $Mail::Sendmail::error; |
|
388 |
|
389 print "$msg. Log says:\n", $Mail::Sendmail::log; |
|
390 } |
|
391 #This Sub will take sub, meg as input and send a plain mail. |
|
392 |
|
393 sub Notify_plain_mail { |
|
394 |
|
395 enter_sub(); |
|
396 my ($sub, $msg) = @_; |
|
397 |
|
398 print "\n\n Notifying $sub\n\n"; |
|
399 $mailcfg{smtp} = [qw(mgw.nokia.com)]; |
|
400 $mailcfg{from} = "$iniH{Mail_From}"; |
|
401 |
|
402 %mail = ( To => "$iniH{Mail_To}", |
|
403 Cc => "$iniH{Mail_Cc}", |
|
404 Subject => "$sub", |
|
405 Message=>"$msg" |
|
406 ); |
|
407 print "\n Sending Mail to $iniH{Mail_To}, $iniH{Mail_Cc}"; |
|
408 sendmail(%mail) or die $Mail::Sendmail::error; |
|
409 print "\n Mail Log: $Mail::Sendmail::log" if ($!); |
|
410 print "\n Mail has been sent."; |
|
411 exit_sub(); |
|
412 } |
|
413 |
|
414 sub Notify_sms { |
|
415 my ($sms_receivers, $body) = @_; |
|
416 my $ua = LWP::UserAgent->new(); |
|
417 my $res = $ua->request(POST 'http://smsgw.nokia.com/smsgw/systemSender', |
|
418 [ APPLICATION_ID => 'SDK_Creation', |
|
419 gsmnum => $sms_receivers, |
|
420 message=> $body, |
|
421 ]); |
|
422 |
|
423 print "$msg.\n"; |
|
424 # Check the outcome of the response |
|
425 if ($res->is_success) { |
|
426 print "Success: $res->content"; |
|
427 } |
|
428 else { |
|
429 print $res->status_line, "\n"; |
|
430 } |
|
431 } |
|
432 |
|
433 sub beatnik { |
|
434 |
|
435 my ($source) = @_; |
|
436 |
|
437 enter_sub($source); |
|
438 |
|
439 #Delete the possible old directory |
|
440 |
|
441 unless (-d $source ) { #Try to find the package in GRACE |
|
442 #We need to extract the files from a big rosetta/ariane zip, may change in the future |
|
443 my $pl_version = "$iniH{Platform_Version_Major}_$iniH{Platform_Version_Minor}"; |
|
444 # my $zip_file = "$iniH{Grace_server}\\S60RnD\\S60_$pl_version\\S60_${pl_version}_$iniH{Platform_Year}$iniH{Platform_Week}_RnD_rosetta\\S60_${pl_version}_$iniH{Platform_Year}$iniH{Platform_Week}_RnD_rosetta_epoc32.zip"; |
|
445 my $zip_file = "$iniH{Grace_server}\\S60RnD\\S60_$pl_version\\S60_${pl_version}_$iniH{Platform_Year}$iniH{Platform_Week}_RnD_ariane\\S60_${pl_version}_$iniH{Platform_Year}$iniH{Platform_Week}_RnD_ariane_epoc32.zip"; |
|
446 my @dlls = qw( |
|
447 BAEMmfAudioController.dll |
|
448 BAEMmfCodec.dll |
|
449 BAEMmfMidiController.dll |
|
450 BAEMmfStructuredFormat.dll |
|
451 mobilebae.dll |
|
452 ); |
|
453 my @rsc_files = qw( |
|
454 BAEMmfAudioController.rsc |
|
455 BAEMmfCodec.rsc |
|
456 BAEMmfMidiController.rsc |
|
457 BAEMmfStructuredFormat.rsc |
|
458 ); |
|
459 my |
|
460 $beatnik_files = join " ", map {"epoc32\\release\\winscw\\udeb\\$_"} @dlls; |
|
461 $beatnik_files .= " "; |
|
462 $beatnik_files .= join " ", map {"epoc32\\release\\winscw\\udeb\\z\\resource\\plugins\\$_"} @rsc_files; |
|
463 $beatnik_files .= " epoc32\\release\\winscw\\udeb\\z\\resource\\ensb.dat"; |
|
464 |
|
465 #Unzip the files onto repository |
|
466 #NOTE: unzip can create only one directory level! |
|
467 my $cmd = "unzip -o -C $zip_file $beatnik_files -d $source"; |
|
468 print "$cmd\n"; |
|
469 system("$cmd"); |
|
470 } |
|
471 |
|
472 #Finally copy the files onto repository area |
|
473 } |
|
474 sub fetch_capas { |
|
475 |
|
476 my ($source) = @_; |
|
477 |
|
478 enter_sub($source); |
|
479 |
|
480 #Delete the possible old repository_area directory |
|
481 |
|
482 unless (-d $source ) { #Try to find the package in GRACE |
|
483 #We need to extract the files from a big rosetta zip, may change in the future |
|
484 $SOS = get_Symbian_OS_info(); |
|
485 die "No Symbian info found" unless ($SOS =~ /[\d_]/); #Should contain only digits or underscore |
|
486 |
|
487 my ($sos, $symb_year_week) = split "_", $SOS; |
|
488 my ($symb_major, $symb_minor) = split "", $sos; |
|
489 my $capa_file_trunk = "GT_${symb_major}.${symb_minor}"; |
|
490 my $zip_file = "$iniH{Grace_server}\\SymbianOS\\__SymbianOS_${sos}\\SymbianOS_${sos}_$symb_year_week\\MCL_${sos}_${symb_year_week}_src_common_other_sources_part1.zip"; |
|
491 |
|
492 #Unzip the files onto repository |
|
493 #NOTE: unzip can create only one directory level! |
|
494 my $cmd = "unzip -o -j -C $zip_file src\\common\\developerlibrary\\doc_source\\reference\\capability\\$capa_file_trunk\\${capa_file_trunk}.xml.txt -d $source"; |
|
495 print "$cmd\n"; |
|
496 system("$cmd"); |
|
497 |
|
498 mkpath("$source\\epoc32\\data\\capabilities") unless (-e "$source\\epoc32\\data\\capabilities"); #Make the directory for move |
|
499 $cmd = "move /y $source\\${capa_file_trunk}.xml.txt $source\\epoc32\\data\\capabilities\\${capa_file_trunk}.xml"; #Renaming! |
|
500 print ($cmd."\n"); system ($cmd); |
|
501 |
|
502 } |
|
503 |
|
504 #Finally copy the files onto repository area. We create the proper directory (epoc32\data\capabilities) only here; perhaps should be in unzip already |
|
505 |
|
506 } |
|
507 __END__ |
|
508 package SubHandlers; |
|
509 sub api { |
|
510 } |
|
511 sub header { |
|
512 print $Remote_utils::OUT_PUT "@_[3]\n"; #The tag name (=header name) is under index 3 |
|
513 } |
|
514 sub lib { |
|
515 print $Remote_utils::OUT_PUT "@_[3]\n"; #The tag name (=lib name) is under index 3 |
|
516 } |
|
517 sub api_ { |
|
518 } |