|
1 # Copyright (c) 2009 Symbian Foundation Ltd |
|
2 # This component and the accompanying materials are made available |
|
3 # under the terms of the License "Eclipse Public License v1.0" |
|
4 # which accompanies this distribution, and is available |
|
5 # at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
6 # |
|
7 # Initial Contributors: |
|
8 # Symbian Foundation Ltd - initial contribution. |
|
9 # |
|
10 # Contributors: |
|
11 # Arnaud Lenoir |
|
12 # |
|
13 # Description: |
|
14 # Task 243 - Generate FCLs details between 2 PDKs to be included as part of the release notes |
|
15 |
|
16 # Here is the location for the naming convention for the PDKs: http://developer.symbian.org/wiki/index.php/Build_and_Integration |
|
17 |
|
18 # |
|
19 # Configuration data and constants for the script |
|
20 # |
|
21 print "\n"; |
|
22 my $default_pdk_loc='\\\\bishare\\releases\\'; |
|
23 print "default_pdk_loc=$default_pdk_loc\n"; |
|
24 |
|
25 # Nb of arguments to be passed to the script to work. If that need to change, just modify nb_arg_to_pass! |
|
26 my $nb_arg_to_pass=2; |
|
27 print "nb_arg_to_pass=$nb_arg_to_pass\n"; |
|
28 |
|
29 # Name of the file that contains the data we need to extract for this script |
|
30 my $name_zip_file_to_extract="build_BOM\.zip"; |
|
31 |
|
32 # Pattern used to search for PDKs |
|
33 my $pdk_start_pattern="PDK_"; |
|
34 |
|
35 # Pattern used to extract info from the xml file |
|
36 my $starting_pattern_for_xml_extraction="<name>Sources</name>"; |
|
37 my $ending_pattern_for_xml_extraction="</project>"; |
|
38 # Pattern to extract data from the line in the file |
|
39 # Branch type. If not a branch type, we are not interested |
|
40 my $branch_type_extraction_pattern="(MCL|FCL)"; |
|
41 |
|
42 my $mcl_cste="MCL"; |
|
43 my $fcl_cste="FCL"; |
|
44 |
|
45 # package name |
|
46 #/imgeditor/#:86a88f39b644</baseline> |
|
47 # # is used to define the changeset number for mercurial. |
|
48 # Therefore if we have a look what is before "/#", we should always find the package name!! |
|
49 my $package_extraction_pattern = "([^/]+)/?#"; |
|
50 |
|
51 # When that "boolean value is set to 1 or true, then the line we read in the file can be search for the information we want to extract |
|
52 # If $starting_pattern_for_xml_extraction true, then set extraction_from_xml_is_allowed to true/1 |
|
53 # If $ending_pattern_for_xml_extraction false, then reset extraction_from_xml_is_allowed to false/0 |
|
54 # $ending_pattern_for_xml_extraction is called several times in the program, but this is not a problem as we don't set it to false/0 and therefore do nothing! |
|
55 my $extraction_from_xml_is_allowed=0; |
|
56 |
|
57 # Temporary location used to do the work |
|
58 my $working_drive="c:"; |
|
59 my $working_directory="temp"; |
|
60 my $working_sub_directory="fcl_extraction"; |
|
61 my $working_pdk1_directory="pdk1"; |
|
62 my $working_pdk2_directory="pdk2"; |
|
63 |
|
64 # Name of the file we need to work on to extract the data necessary for the Release Notes |
|
65 my $name_of_file_to_compare="build-info.xml"; |
|
66 |
|
67 # Name of the file that we are creating to hold the information necessary for the Release Notes |
|
68 my $name_of_file_to_publish="fcl_info.txt"; |
|
69 #Location for that file |
|
70 my $location_of_file_to_publish="c:\\temp"; |
|
71 my $file_path="$location_of_file_to_publish\\$name_of_file_to_publish"; |
|
72 |
|
73 # |
|
74 # End configuration data for the script |
|
75 # |
|
76 |
|
77 |
|
78 # Get parameters passed to the script. Save only the 2 first parameters as we need only 2 parameters for the script |
|
79 print "\n"; |
|
80 my $nb_arg_passed = scalar(@ARGV); |
|
81 print "nb_arg_passed=$nb_arg_passed\n"; # Find out the number of arguement passed |
|
82 print "@ARGV\n\n"; |
|
83 if ($nb_arg_passed != $nb_arg_to_pass) |
|
84 { |
|
85 helpme(); |
|
86 } |
|
87 |
|
88 # Needs to be done here, otherwise lost if try to recover them later on. Why? |
|
89 my $arg1_passed = $ARGV[0]; |
|
90 my $arg2_passed = $ARGV[1]; |
|
91 print "arg1_passed= $arg1_passed \t arg2_passed=$arg2_passed\n"; |
|
92 |
|
93 # Modules necessary to run this script |
|
94 use Getopt::Long; |
|
95 use strict; |
|
96 |
|
97 |
|
98 # Arguments / Data used for the script |
|
99 my $pdknb1 = ''; |
|
100 my $pdknb2 = ''; |
|
101 my $pdkloc1 = ''; |
|
102 my $pdkloc2 = ''; |
|
103 my $pdkname1 = ''; |
|
104 my $pdkname2 = ''; |
|
105 |
|
106 my $help = 0; |
|
107 |
|
108 GetOptions(( |
|
109 'pdknb1=s' => \$pdknb1, |
|
110 'pdknb2=s' => \$pdknb2, |
|
111 'pdkname1=s' => \$pdkname1, |
|
112 'pdkname2=s' => \$pdkname2, |
|
113 'pdkloc1=s' => \$pdkloc1, |
|
114 'pdkloc2=s' => \$pdkloc2, |
|
115 'help!' => \$help |
|
116 )); |
|
117 |
|
118 print "\$pdknb1=$pdknb1\n"; |
|
119 print "\$pdknb2=$pdknb2\n"; |
|
120 print "\$pdkname1=$pdkname1\n"; |
|
121 print "\$pdkname2=$pdkname2\n"; |
|
122 print "\$pdkloc1=$pdkloc1\n"; |
|
123 print "\$pdkloc2=$pdkloc2\n"; |
|
124 |
|
125 my $count_arg=0; # Caculate the number of arguments we need for the script to work and that we know are correct (help doesn't count) |
|
126 |
|
127 # First PDK to check |
|
128 my $pdk_path1=""; |
|
129 my $pdk_complete_name1=0; |
|
130 my $pdk_complete_path1=0; |
|
131 my $pdk_path1_now_in_use=0; |
|
132 my $pdk_values_to_search1=""; # Not necessary |
|
133 my $pdk_path1_exist=0; |
|
134 my $pdk_zip1_exit=0; # Not necessary |
|
135 my $pdk1_correct_name_to_use=""; |
|
136 my $loc1_contains_the_zip_file_we_need=0; |
|
137 |
|
138 # Second PDK to check |
|
139 my $pdk_path2=""; |
|
140 my $pdk_complete_name2=0; |
|
141 my $pdk_complete_path2=0; |
|
142 my $pdk_path2_now_in_use=0; |
|
143 my $pdk_values_to_search2=""; # Not necessary |
|
144 my $pdk_path2_exist=0; |
|
145 my $pdk_zip2_exist=0; # Not necessary |
|
146 my $pdk2_correct_name_to_use=""; |
|
147 my $loc2_contains_the_zip_file_we_need=0; |
|
148 |
|
149 |
|
150 # Default directory management |
|
151 my @directories_list_default_location=(); |
|
152 my $nb_dir_in_default_loc; |
|
153 my @pdk_dir_list_in_default_location=(); |
|
154 my $nb_pdks_in_default_loc=0; |
|
155 my @pdks_with_valid_zip_in_default_loc=(); |
|
156 my $nb_pdks_with_valid_zip_in_default_loc=0; |
|
157 my @find_pdk_for_corresponding_nb1=(); |
|
158 my $nb_of_pdk_for_corresponding_nb1=0; |
|
159 my @find_pdk_for_corresponding_nb2=(); |
|
160 my $nb_of_pdk_for_corresponding_nb2=0; |
|
161 my @find_pdk_for_corresponding_name1=(); |
|
162 my $nb_of_pdk_for_corresponding_name1=0; |
|
163 my @find_pdk_for_corresponding_name2=(); |
|
164 my $nb_of_pdk_for_corresponding_name2=0; |
|
165 my @read_files_in_loc=(); |
|
166 |
|
167 # Data / statistics to be displayed in the release notes |
|
168 # We consider that pdk1 is the old version and pdk2 is the new version. |
|
169 # Note that for the moment, the scripts is not able to make sure that the old version of the pdk is set as pdk1 and the new version of the pdk is set as pdk2!!!!! |
|
170 # Can be done for pdknb and pdkname but not for pdkloc as for the moment, no way to find out the pdk version from the build-info.xmL!!!! |
|
171 # Totals |
|
172 my $total_packages_pdk1=0; # Nb of packages included in the pdk1 |
|
173 my $total_packages_pdk2=0; # Nb of packages included in the pdk2 |
|
174 my $total_packages_added=0; # Nb of packages added in the pdk2 |
|
175 my $total_packages_removed=0; # Nb of packages removed from the pdk2 |
|
176 my $total_new_fcl=0; # Nb of packages that are now on fcl in pdk2 (means were mcl in pdk1 and are now fcl in pdk2) |
|
177 my $total_no_more_fcl=0; # Nb of packages that are no more on fcl in pdk2 (means were fcl in pdk1 and are now mcl in pdk2) |
|
178 my $total_still_fcl=0; # Nb of packages that are still on fcl in pdk2 (means were fcl in pdk1 and are still fcl in pdk2) |
|
179 my $total_very_good_mcl=0; # Nb of packages that are very good on mcl in pdk1 and pdk2 (means were on mcl in pdk1 and are still mcl in pdk2) |
|
180 # Tables |
|
181 my @pdk1_sorting_table; # Table for pdk1 that is used to sort out and compare the 2 pdks |
|
182 my @pdk2_sorting_table; # Table for pdk2 that is used to sort out and compare the 2 pdks |
|
183 my @packages_added_table; # Table that contains the packages that have been added to pdk2 |
|
184 my @packages_removed_table; # Table that contains the packages that have been deleted from pdk2 |
|
185 my @new_fcl_table; # Table containing the packages that are now on fcl in pdk2 (means were mcl in pdk1 and are now fcl in pdk2) |
|
186 my @no_more_fcl_table; # Table containing the packages that are no more on fcl in pdk2 (means were fcl in pdk1 and are now mcl in pdk2) |
|
187 my @still_fcl_table; # Table containing the packages that are still on fcl in pdk2 (means were fcl in pdk1 and are still fcl in pdk2) |
|
188 my @very_good_mcl_table; # Table containing the packages that are very good on mcl in pdk1 and pdk2 (means were on mcl in pdk1 and are still mcl in pdk2) |
|
189 |
|
190 |
|
191 # Check that we have only 2 values for the PDKs. If not 2, then not good! |
|
192 |
|
193 |
|
194 # Script code start here! |
|
195 if($pdknb1) |
|
196 { |
|
197 $count_arg++; |
|
198 |
|
199 # Get data for first pdk used for the comparison |
|
200 $pdk_path1 = $default_pdk_loc; |
|
201 $pdk_complete_name1=1; |
|
202 $pdk_complete_path1=1; |
|
203 $pdk_path1_now_in_use=1; |
|
204 $pdk_values_to_search1=$pdknb1; # Not necessary |
|
205 } |
|
206 if($pdknb2) |
|
207 { |
|
208 $count_arg++; |
|
209 |
|
210 # Get data for first pdk used for the comparison |
|
211 $pdk_path2 = $default_pdk_loc; |
|
212 $pdk_complete_name2=1; |
|
213 $pdk_complete_path2=1; |
|
214 $pdk_path2_now_in_use=1; |
|
215 $pdk_values_to_search2=$pdknb2; # Not necessary |
|
216 } |
|
217 if($pdkname1) |
|
218 { |
|
219 $count_arg++; |
|
220 |
|
221 if(!$pdk_path1_now_in_use) |
|
222 { |
|
223 # Get data for first pdk used for the comparison |
|
224 $pdk_path1 = $default_pdk_loc; |
|
225 $pdk_complete_path1=1; |
|
226 $pdk_path1_now_in_use=1; |
|
227 $pdk_values_to_search1=$pdkname1; # Not necessary |
|
228 } |
|
229 else |
|
230 { |
|
231 if(!$pdk_path2_now_in_use) |
|
232 { |
|
233 # Get data for first pdk used for the comparison |
|
234 $pdk_path2 = $default_pdk_loc; |
|
235 $pdk_complete_path2=1; |
|
236 $pdk_path2_now_in_use=1; |
|
237 $pdk_values_to_search2=$pdkname1; # Not necessary |
|
238 } |
|
239 } |
|
240 } |
|
241 if($pdkname2) |
|
242 { |
|
243 $count_arg++; |
|
244 |
|
245 if(!$pdk_path2_now_in_use) |
|
246 { |
|
247 # Get data for first pdk used for the comparison |
|
248 $pdk_path2 = $default_pdk_loc; |
|
249 $pdk_complete_path2=1; |
|
250 $pdk_path2_now_in_use=1; |
|
251 $pdk_values_to_search2=$pdkname2; # Not necessary |
|
252 } |
|
253 else |
|
254 { |
|
255 if(!$pdk_path1_now_in_use) |
|
256 { |
|
257 # Get data for first pdk used for the comparison |
|
258 $pdk_path1 = $default_pdk_loc; |
|
259 $pdk_complete_path1=1; |
|
260 $pdk_path1_now_in_use=1; |
|
261 $pdk_values_to_search1=$pdkname2; # Not necessary |
|
262 } |
|
263 } |
|
264 } |
|
265 if($pdkloc1) |
|
266 { |
|
267 $count_arg++; |
|
268 |
|
269 if(!$pdk_path1_now_in_use) |
|
270 { |
|
271 # Get data for first pdk used for the comparison |
|
272 $pdk_path1 = $pdkloc1; |
|
273 $pdk_path1_now_in_use=1; |
|
274 } |
|
275 else |
|
276 { |
|
277 if(!$pdk_path2_now_in_use) |
|
278 { |
|
279 # Get data for first pdk used for the comparison |
|
280 $pdk_path2 = $pdkloc1; |
|
281 $pdk_path2_now_in_use=1; |
|
282 } |
|
283 } |
|
284 } |
|
285 |
|
286 if($pdkloc2) |
|
287 { |
|
288 $count_arg++; |
|
289 |
|
290 if(!$pdk_path2_now_in_use) |
|
291 { |
|
292 # Get data for first pdk used for the comparison |
|
293 $pdk_path2 = $pdkloc2; |
|
294 $pdk_path2_now_in_use=1; |
|
295 } |
|
296 else |
|
297 { |
|
298 if(!$pdk_path1_now_in_use) |
|
299 { |
|
300 # Get data for first pdk used for the comparison |
|
301 $pdk_path1 = $pdkloc2; |
|
302 $pdk_path1_now_in_use=1; |
|
303 } |
|
304 } |
|
305 } |
|
306 |
|
307 print "count_arg=$count_arg\n"; |
|
308 |
|
309 |
|
310 # If no parameters entered or help selected, display help |
|
311 if ($count_arg != $nb_arg_to_pass) |
|
312 { |
|
313 #$help = 1; |
|
314 helpme(); |
|
315 print"\nThe script accepts $nb_arg_to_pass parameters only!\n\n"; |
|
316 } |
|
317 |
|
318 |
|
319 # |
|
320 # If we reach this point, this means that we have the right numbers of arguments passed to the script. |
|
321 # |
|
322 print "\nWe are on the right path!!!!\n"; |
|
323 |
|
324 print "pdk_path1=$pdk_path1\n"; |
|
325 print "pdk_complete_name1=$pdk_complete_name1\n"; |
|
326 print "pdk_complete_path1=$pdk_complete_path1\n"; |
|
327 print "pdk_values_to_search1=$pdk_values_to_search1\n"; # Not necessary |
|
328 print "\n"; |
|
329 print "pdk_path2=$pdk_path2\n"; |
|
330 print "pdk_complete_name2=$pdk_complete_name2\n"; |
|
331 print "pdk_complete_path2=$pdk_complete_path2\n"; |
|
332 print "pdk_values_to_search2=$pdk_values_to_search2\n"; # Not necessary |
|
333 print "\n\n"; |
|
334 |
|
335 # Get directory listing of all directories in the default location $default_pdk_loc |
|
336 extract_dir_default_loc(); |
|
337 extract_pdk_in_default_loc(); |
|
338 extract_pdk_with_valid_zip_in_default_loc(); |
|
339 |
|
340 # Compose path if necessary. |
|
341 print "\n"; |
|
342 |
|
343 my $find_val=0; |
|
344 |
|
345 if ($pdk_complete_path1) |
|
346 { |
|
347 if ($pdk_complete_name1) |
|
348 { |
|
349 print "We have the PDK number, we need to define if possible the PDK name and therefore the path to the PDK\n"; |
|
350 # Have a look in the default directory if there is a PDK with that number. If none or more than one with the same id, returns the list of PDKs with that same number |
|
351 foreach $find_val (@pdks_with_valid_zip_in_default_loc) |
|
352 { |
|
353 #print $find_val, "\n"; |
|
354 if($find_val =~ /$pdknb1/i) |
|
355 { |
|
356 $find_pdk_for_corresponding_nb1[$nb_of_pdk_for_corresponding_nb1++]=$find_val; |
|
357 } |
|
358 } |
|
359 print "Table find_pdk_for_corresponding_nb1 is:\n"; |
|
360 display_array_one_line_at_the_time(@find_pdk_for_corresponding_nb1); |
|
361 |
|
362 if($nb_of_pdk_for_corresponding_nb1==1) |
|
363 { |
|
364 print "There is only $nb_of_pdk_for_corresponding_nb1 PDK with the name corresponding to the PDK number given, we can keep going!\n"; |
|
365 } |
|
366 else |
|
367 { |
|
368 print "There is $nb_of_pdk_for_corresponding_nb1 PDKs with the same name, please select one in the list above and run the perl script again with the right PDK name\n"; |
|
369 exit(0); |
|
370 } |
|
371 |
|
372 #extract PDK name if only one |
|
373 $pdk1_correct_name_to_use = $find_pdk_for_corresponding_nb1[0]; |
|
374 $pdk_path1 .= $find_pdk_for_corresponding_nb1[0]; |
|
375 print "pdknb1 = $pdknb1\n"; |
|
376 } |
|
377 else |
|
378 { |
|
379 print "We have the PDK Name therefore we can define the path to the PDK\n"; |
|
380 |
|
381 # Have a look in the default directory if there is a PDK with that number. If none or more than one with the same id, returns the list of PDKs with that same number |
|
382 foreach $find_val (@pdks_with_valid_zip_in_default_loc) |
|
383 { |
|
384 #print $find_val, "\n"; |
|
385 if($find_val =~ /$pdkname1/i) |
|
386 { |
|
387 $find_pdk_for_corresponding_name1[$nb_of_pdk_for_corresponding_name1++]=$find_val; |
|
388 } |
|
389 } |
|
390 print "Table find_pdk_for_corresponding_name1 is: \n"; |
|
391 display_array_one_line_at_the_time(@find_pdk_for_corresponding_name1); |
|
392 |
|
393 if($nb_of_pdk_for_corresponding_name1==1) |
|
394 { |
|
395 print "There is only $nb_of_pdk_for_corresponding_name1 PDK with the name corresponding to the PDK name given, we can keep going!\n"; |
|
396 } |
|
397 else |
|
398 { |
|
399 print "There is $nb_of_pdk_for_corresponding_name1 PDKs with the same name, please select one in the list above and run the perl script again with the right PDK name\n"; |
|
400 exit(0); |
|
401 } |
|
402 |
|
403 #extract PDK name if only one |
|
404 $pdk1_correct_name_to_use = $find_pdk_for_corresponding_name1[0]; |
|
405 $pdk_path1 .= @find_pdk_for_corresponding_name1[0]; |
|
406 print "pdkname1 = $pdkname1\n"; |
|
407 } |
|
408 print "The PDK used is: $pdk1_correct_name_to_use\n"; |
|
409 print "pdk_path1 = $pdk_path1\n"; |
|
410 } |
|
411 |
|
412 $find_val=0; |
|
413 |
|
414 if ($pdk_complete_path2) |
|
415 { |
|
416 if ($pdk_complete_name2) |
|
417 { |
|
418 print "We have the PDK number, we need to define if possible the PDK name and therefore the path to the PDK\n"; |
|
419 # Have a look in the default directory if there is a PDK with that number. If none or more than one with the same id, returns the list of PDKs with that same number |
|
420 foreach $find_val (@pdks_with_valid_zip_in_default_loc) |
|
421 { |
|
422 #print $find_val, "\n"; |
|
423 if($find_val =~ /$pdknb2/i) |
|
424 { |
|
425 $find_pdk_for_corresponding_nb2[$nb_of_pdk_for_corresponding_nb2++]=$find_val; |
|
426 } |
|
427 } |
|
428 print "Table find_pdk_for_corresponding_nb is:\n"; |
|
429 display_array_one_line_at_the_time(@find_pdk_for_corresponding_nb2); |
|
430 |
|
431 if($nb_of_pdk_for_corresponding_nb2==1) |
|
432 { |
|
433 print "There is only $nb_of_pdk_for_corresponding_nb2 PDK with the name corresponding to the PDK number given, we can keep going!\n"; |
|
434 } |
|
435 else |
|
436 { |
|
437 print "There is $nb_of_pdk_for_corresponding_nb2 PDKs with the same name, please select one in the list above and run the perl script again with the right PDK name\n"; |
|
438 exit(0); |
|
439 } |
|
440 |
|
441 #extract PDK name if only one |
|
442 $pdk2_correct_name_to_use = $find_pdk_for_corresponding_nb2[0]; |
|
443 $pdk_path2 .= $find_pdk_for_corresponding_nb2[0]; |
|
444 print "pdknb2 = $pdknb2\n"; |
|
445 } |
|
446 else |
|
447 { |
|
448 print "We have the PDK Name therefore we can define the path to the PDK\n"; |
|
449 |
|
450 # Have a look in the default directory if there is a PDK with that number. If none or more than one with the same id, returns the list of PDKs with that same number |
|
451 foreach $find_val (@pdks_with_valid_zip_in_default_loc) |
|
452 { |
|
453 #print $find_val, "\n"; |
|
454 if($find_val =~ /$pdkname2/i) |
|
455 { |
|
456 $find_pdk_for_corresponding_name2[$nb_of_pdk_for_corresponding_name2++]=$find_val; |
|
457 } |
|
458 } |
|
459 print "Table find_pdk_for_corresponding_name2 is:\n"; |
|
460 display_array_one_line_at_the_time(@find_pdk_for_corresponding_name2); |
|
461 |
|
462 if($nb_of_pdk_for_corresponding_name2==1) |
|
463 { |
|
464 print "There is only $nb_of_pdk_for_corresponding_name2 PDK with the name corresponding to the PDK name given, we can keep going!\n"; |
|
465 } |
|
466 else |
|
467 { |
|
468 print "There is $nb_of_pdk_for_corresponding_name2 PDKs with the same name, please select one in the list above and run the perl script again with the right PDK name\n"; |
|
469 exit(0); |
|
470 } |
|
471 |
|
472 #extract PDK name if only one |
|
473 $pdk2_correct_name_to_use = $find_pdk_for_corresponding_name2[0]; |
|
474 $pdk_path2 .= @find_pdk_for_corresponding_name2[0]; |
|
475 print "pdkname2 = $pdkname2\n"; |
|
476 } |
|
477 print "The PDK used is: $pdk2_correct_name_to_use\n"; |
|
478 print "pdk_path2 = $pdk_path2\n"; |
|
479 } |
|
480 |
|
481 # Find out if the locations are correct or not. We just need to make sure that the location contains the build_BOM.zip, if it's the case, then bingo! If not, exit the program. |
|
482 my $loc_var; |
|
483 |
|
484 if($pdkloc1) |
|
485 { |
|
486 # Get the list of file in the location choosen. |
|
487 opendir(LOC1_DIR, $pdkloc1); |
|
488 @read_files_in_loc = readdir(LOC1_DIR); |
|
489 close(LOC1_DIR); |
|
490 |
|
491 #print "List of files in the directory: @read_files_in_loc\n"; |
|
492 |
|
493 foreach $loc_var (@read_files_in_loc) |
|
494 { |
|
495 #if($loc_var =~ /$name_zip_file_to_extract[^.\w]/) |
|
496 if($loc_var =~ /$name_zip_file_to_extract$/) |
|
497 { |
|
498 print "We found the file: $loc_var\n"; |
|
499 |
|
500 $pdk1_correct_name_to_use = "PDK1"; |
|
501 $pdk_path1 = $pdkloc1; |
|
502 |
|
503 print "The PDK used is: $pdk1_correct_name_to_use\n"; |
|
504 print "pdk_path1 = $pdk_path1\n"; |
|
505 $loc1_contains_the_zip_file_we_need=1; |
|
506 |
|
507 # As we have found the file, we can probably break! |
|
508 } |
|
509 } |
|
510 if(!$loc1_contains_the_zip_file_we_need) |
|
511 { |
|
512 print "We can't find the file $name_zip_file_to_extract in the location $pdkloc2 and therefore we can't go any further!!\n"; |
|
513 exit(0); |
|
514 } |
|
515 } |
|
516 print "\n"; |
|
517 |
|
518 if($pdkloc2) |
|
519 { |
|
520 # Get the list of file in the location choosen. |
|
521 opendir(LOC2_DIR, $pdkloc2); |
|
522 @read_files_in_loc = readdir(LOC2_DIR); |
|
523 close(LOC2_DIR); |
|
524 |
|
525 #print "List of files in the directory: @read_files_in_loc\n"; |
|
526 |
|
527 foreach $loc_var (@read_files_in_loc) |
|
528 { |
|
529 #if($loc_var =~ /$name_zip_file_to_extract[^.\w]/) |
|
530 if($loc_var =~ /$name_zip_file_to_extract$/) |
|
531 { |
|
532 print "We found the file: $loc_var\n"; |
|
533 |
|
534 $pdk2_correct_name_to_use = "PDK2"; |
|
535 $pdk_path2 = $pdkloc2; |
|
536 |
|
537 print "The PDK used is: $pdk2_correct_name_to_use\n"; |
|
538 print "pdk_path2 = $pdk_path2\n"; |
|
539 $loc2_contains_the_zip_file_we_need=1; |
|
540 |
|
541 # As we have found the file, we can probably break! |
|
542 } |
|
543 } |
|
544 if(!$loc2_contains_the_zip_file_we_need) |
|
545 { |
|
546 print "We can't find the file $name_zip_file_to_extract in the location $pdkloc2 and therefore we can't go any further!!\n"; |
|
547 exit(0); |
|
548 } |
|
549 } |
|
550 |
|
551 print "\n"; |
|
552 print "If we are here, this means that both $name_zip_file_to_extract have been found and we can start the real work to compare the 2 files to extract what we need!\n"; |
|
553 print "This is the value for the path we are looking at for pdk_path1: $pdk_path1\n"; |
|
554 print "This is the value for the path we are looking at for pdk_path2: $pdk_path2\n"; |
|
555 |
|
556 # When we are at this point, we know we have 2 build_BOM.zip files that we can compare them!!!! |
|
557 |
|
558 my $system_cmd = ""; |
|
559 |
|
560 my $working_dir="$working_drive\\$working_directory\\$working_sub_directory"; |
|
561 my $working_dir1="$working_drive\\$working_directory\\$working_sub_directory\\$working_pdk1_directory"; |
|
562 my $working_dir2="$working_drive\\$working_directory\\$working_sub_directory\\$working_pdk2_directory"; |
|
563 |
|
564 # 1st step is to extract the 2 zip files to allow us to have access to build-info.xml |
|
565 |
|
566 # Extract just one file from the zip file using "7z e -r -oOutput_Directory" |
|
567 #7z e -r build_BOM.zip build-info.xml |
|
568 # Where 7z is the unzip program |
|
569 # Where e is for extraction of a file |
|
570 # Where -r is for recursive to make sure we have a look in the subdirectories |
|
571 # Where -oOutput_Directory is the directory where we want the files to be unzipped |
|
572 # |
|
573 # Where $working_sub_directory is the directory where we will be carry the work to be done for the script. |
|
574 # Where $working_pdk1_directory is the subdirectory destination for the PDK1 |
|
575 # Where $name_zip_file_to_extract is the name of the zip file (in our case: build_BOM.zip) |
|
576 # Where $pdk_path1 is the place where the zip file to unzip is |
|
577 # where $name_of_file_to_compare is the name of the file we want to extract from the zip file (in our case: build-info.xml) |
|
578 # Example: 7z e -r -oc:\temp\fcl_extraction\pdk1 C:\temp\Task243Test\PDK_1\build_BOM.zip build-info.xml |
|
579 |
|
580 # Extract file from 1st PDK |
|
581 $system_cmd = "7z e -r -o$working_dir1 $pdk_path1\\$name_zip_file_to_extract $name_of_file_to_compare"; |
|
582 print "Exec: $system_cmd\n"; |
|
583 system($system_cmd); |
|
584 |
|
585 print "\n"; |
|
586 |
|
587 # Extract file from 2nd PDK |
|
588 $system_cmd = "7z e -r -o$working_dir2 $pdk_path2\\$name_zip_file_to_extract $name_of_file_to_compare"; |
|
589 print "Exec: $system_cmd\n"; |
|
590 system($system_cmd); |
|
591 |
|
592 # 2nd step is to extract the information we need from the 2 files build-info.xml |
|
593 |
|
594 # Create 2 hash arrays that will contain the name of the package as key and the value associated as MCL or FCL |
|
595 my %build_info_xml1; |
|
596 my %build_info_xml2; |
|
597 my @sorting_build_info_xml1; |
|
598 my @sorting_build_info_xml2; |
|
599 |
|
600 #my @display_hash_array; |
|
601 my $key; |
|
602 # Define the path for the files to work on |
|
603 my $path_to_pdk1_file_to_work_on="$working_dir1\\$name_of_file_to_compare"; |
|
604 my $path_to_pdk2_file_to_work_on="$working_dir2\\$name_of_file_to_compare"; |
|
605 |
|
606 print "\n"; |
|
607 |
|
608 my $count_packages=0; |
|
609 my @not_sorted_table; |
|
610 |
|
611 # Keep only what we need and keep it safe somewhere. |
|
612 # pdk1 |
|
613 %build_info_xml1 = extract_packages_and_branch_type_from_file($path_to_pdk1_file_to_work_on); |
|
614 |
|
615 print "%build_info_xml1:\n"; |
|
616 # Define the number of packages for pdk1 |
|
617 $total_packages_pdk1 = keys %build_info_xml1; |
|
618 print "\nThere is $total_packages_pdk1 packages for $pdk1_correct_name_to_use\n"; |
|
619 |
|
620 # 3rd a) step is to sort out the 2 files / table |
|
621 # Sort out the tables to facilitate the checking of the different packages |
|
622 @not_sorted_table = keys %build_info_xml1; |
|
623 |
|
624 #print "\nnot_sorted_table:\n @not_sorted_table\n"; |
|
625 |
|
626 # ascendant alphabetical sort |
|
627 @pdk1_sorting_table = sort { lc($a) cmp lc($b) } @not_sorted_table; |
|
628 |
|
629 #print "\npdk1_sorting_table :\n @pdk1_sorting_table\n"; |
|
630 |
|
631 print "\n"; |
|
632 |
|
633 # pdk2 |
|
634 %build_info_xml2 = extract_packages_and_branch_type_from_file($path_to_pdk2_file_to_work_on); |
|
635 print "%build_info_xml2:\n"; |
|
636 # Define the number of packages for pdk2 |
|
637 $total_packages_pdk2 = keys %build_info_xml2; |
|
638 print "\nThere is $total_packages_pdk2 packages for $pdk2_correct_name_to_use\n"; |
|
639 |
|
640 # 3rd b) step is to sort out the 2 files / table |
|
641 # Sort out the tables to facilitate the checking of the different packages |
|
642 @not_sorted_table = keys %build_info_xml2; |
|
643 |
|
644 #print "\nnot_sorted_table:\n @not_sorted_table\n"; |
|
645 |
|
646 # ascendant alphabetical sort |
|
647 @pdk2_sorting_table = sort { lc($a) cmp lc($b) } @not_sorted_table; |
|
648 |
|
649 #print "\npdk2_sorting_table :\n @pdk2_sorting_table\n"; |
|
650 |
|
651 print "\n"; |
|
652 |
|
653 # 4th step is to compare both data and export it to a file or something similar that is good for media wiki. |
|
654 # Compare both files to find out the difference between each packages FCL, MCL, added or deleted packages |
|
655 |
|
656 my $tab_counter1=0; |
|
657 my $tab_counter2=0; |
|
658 my $compare_2_tables; |
|
659 my $value_package_pdk1; |
|
660 my $value_package_pdk2; |
|
661 |
|
662 while (($tab_counter1 < $total_packages_pdk1) && ($tab_counter2 < $total_packages_pdk2)) # or should it be || |
|
663 { |
|
664 #print "tab_counter1=$tab_counter1, total_packages_pdk1=$total_packages_pdk1\ntab_counter2=$tab_counter2, total_packages_pdk2=$total_packages_pdk2\n"; |
|
665 #print "packages in pdk1 is $pdk1_sorting_table[$tab_counter1] and in pdk2 is $pdk2_sorting_table[$tab_counter2]\n"; |
|
666 |
|
667 # $a cmp $b |
|
668 # if $a > $b value returned is 1 |
|
669 # if $a = $b value returned is 0 |
|
670 # if $a < $b value returned is -1 |
|
671 |
|
672 $compare_2_tables = ( $pdk1_sorting_table[$tab_counter1] cmp $pdk2_sorting_table[$tab_counter2] ); |
|
673 #print "compare_2_tables=$compare_2_tables\n"; |
|
674 |
|
675 if(!$compare_2_tables) # Compare if the the packages in the tables(index) are the same or not, if $compare_2_tables=0, then equal |
|
676 { |
|
677 #print "the package is the same in pdk1_sorting_table and pdk2_sorting_table\n"; |
|
678 |
|
679 $value_package_pdk1 = $build_info_xml1{$pdk1_sorting_table[$tab_counter1]}; |
|
680 $value_package_pdk2 = $build_info_xml2{$pdk2_sorting_table[$tab_counter2]}; |
|
681 #print "value_package_pdk1=$value_package_pdk1\n"; |
|
682 #print "value_package_pdk2=$value_package_pdk2\n"; |
|
683 |
|
684 if(($value_package_pdk1 eq $mcl_cste) && ($value_package_pdk2 eq $fcl_cste)) |
|
685 { |
|
686 #print "the package was MCL and is now FCL - NEW\n"; |
|
687 $new_fcl_table[$total_new_fcl++] = $pdk1_sorting_table[$tab_counter1]; |
|
688 } |
|
689 else |
|
690 { |
|
691 if(($value_package_pdk1 eq $fcl_cste) && ($value_package_pdk2 eq $mcl_cste)) |
|
692 { |
|
693 #print "the package was FCL and is now MCL - NO MORE\n"; |
|
694 $no_more_fcl_table[$total_no_more_fcl++] = $pdk1_sorting_table[$tab_counter1]; |
|
695 } |
|
696 else |
|
697 { |
|
698 if(($value_package_pdk1 eq $fcl_cste) && ($value_package_pdk2 eq $fcl_cste)) |
|
699 { |
|
700 #print "the package was FCL and is still FCL - STILL\n"; |
|
701 $still_fcl_table[$total_still_fcl++] = $pdk1_sorting_table[$tab_counter1]; |
|
702 } |
|
703 else |
|
704 { |
|
705 #print "the package was MCL and is still MCL - VERY GOOD\n"; |
|
706 $very_good_mcl_table[$total_very_good_mcl++] = $pdk1_sorting_table[$tab_counter1]; |
|
707 } |
|
708 } |
|
709 } |
|
710 |
|
711 $tab_counter1++; |
|
712 $tab_counter2++; |
|
713 } |
|
714 else |
|
715 { |
|
716 # The values are not the same, therefore it must be an added or deleted package |
|
717 if($compare_2_tables<0) # If $compare_2_tables=-1, then pdk1 is smaller than pdk2, which means that it has been deleted from pdk2 |
|
718 { |
|
719 #print "the package $pdk1_sorting_table[$tab_counter1] has been deleted from pdk2\n"; |
|
720 $packages_removed_table[$total_packages_removed++]=$pdk1_sorting_table[$tab_counter1++]; |
|
721 } |
|
722 else |
|
723 { |
|
724 # If $compare_2_tables=1, then pdk1 is bigger than pdk2, which means that it has been added to pdk2 |
|
725 #print "the package $pdk2_sorting_table[$tab_counter2] has been added to pdk2\n"; |
|
726 $packages_added_table[$total_packages_added++]=$pdk2_sorting_table[$tab_counter2++]; |
|
727 } |
|
728 } |
|
729 } |
|
730 |
|
731 |
|
732 print "\nPrint all the values related to our calculations\n"; |
|
733 print "total_packages_pdk1=$total_packages_pdk1\n"; |
|
734 print "total_packages_pdk2=$total_packages_pdk2\n"; |
|
735 print "\n"; |
|
736 print "total_packages_added=$total_packages_added\n"; |
|
737 print "packages_added_table=\n"; |
|
738 display_array_one_line_at_the_time(@packages_added_table); |
|
739 print "\n"; |
|
740 print "total_packages_removed=$total_packages_removed\n"; |
|
741 print "packages_removed_table=\n"; |
|
742 display_array_one_line_at_the_time(@packages_removed_table); |
|
743 print "\n"; |
|
744 print "total_new_fcl=$total_new_fcl\n"; |
|
745 print "new_fcl_table=\n"; |
|
746 display_array_one_line_at_the_time(@new_fcl_table); |
|
747 print "\n"; |
|
748 print "total_no_more_fcl=$total_no_more_fcl\n"; |
|
749 print "no_more_fcl_table=\n"; |
|
750 display_array_one_line_at_the_time(@no_more_fcl_table); |
|
751 print "\n"; |
|
752 print "total_still_fcl=$total_still_fcl\n"; |
|
753 print "still_fcl_table=\n"; |
|
754 display_array_one_line_at_the_time(@still_fcl_table); |
|
755 print "\n"; |
|
756 print "total_very_good_mcl=$total_very_good_mcl\n"; |
|
757 print "very_good_mcl_table=\n"; |
|
758 display_array_one_line_at_the_time(@very_good_mcl_table); |
|
759 print "\n"; |
|
760 # Checking that the packages have been assigned properly. |
|
761 # !!!! Need to verify the formula. Not sure that is correct!!!!!! |
|
762 print "Verification for the total packages between the 2 pdks\n"; |
|
763 print "Formula used is: total_packages_pdk2 = total_packages_pdk1 + total_packages_added - total_packages_removed\n"; |
|
764 print "$total_packages_pdk2 = $total_packages_pdk1 + $total_packages_added - $total_packages_removed\n"; |
|
765 print "\n"; |
|
766 print "Formula used is: total_packages_pdk1 = total_very_good_mcl + total_new_fcl + total_no_more_fcl + total_still_fcl= total\n"; |
|
767 print "$total_packages_pdk1 = $total_very_good_mcl + $total_new_fcl + $total_no_more_fcl + $total_still_fcl = ", ($total_very_good_mcl + $total_new_fcl + $total_no_more_fcl + $total_still_fcl), "\n"; |
|
768 print "\n"; |
|
769 print "Formula used is: total_packages_pdk2 = total_very_good_mcl + total_new_fcl + total_no_more_fcl + total_still_fcl + total_packages_added = total\n"; |
|
770 print "$total_packages_pdk2 = $total_very_good_mcl + $total_new_fcl + $total_no_more_fcl + $total_still_fcl + $total_packages_added - $total_packages_removed= ", ($total_very_good_mcl + $total_new_fcl + $total_no_more_fcl + $total_still_fcl + $total_packages_added - $total_packages_removed), "\n"; |
|
771 print "\n"; |
|
772 |
|
773 # 5th step is to create a txt file ready to be used for the release notes in a media wiki format. |
|
774 open(FCLCOMPARISONFILE, ">$file_path"); # !!!!! First time we are accessing the file, therefore create it or replace it, AFTR THAT WE NEED TO APPEND IT ONLY!!!!! |
|
775 |
|
776 my $val; |
|
777 |
|
778 # Enter the beginning of the section for general information about the pdk and it's predecessor. |
|
779 print FCLCOMPARISONFILE <<"EOT"; |
|
780 == Packages == |
|
781 |
|
782 This sectin is about general information on the packages included in the platfrom.\n |
|
783 This is an analysis between '''$pdk2_correct_name_to_use''' and '''$pdk1_correct_name_to_use''' |
|
784 EOT |
|
785 |
|
786 |
|
787 print FCLCOMPARISONFILE "\n Number total of packages in $pdk1_correct_name_to_use is: '''$total_packages_pdk1'''\n"; |
|
788 print FCLCOMPARISONFILE "\n Number total of packages in $pdk2_correct_name_to_use is: '''$total_packages_pdk2'''\n"; |
|
789 |
|
790 print FCLCOMPARISONFILE "=== Packages added ===\n\n"; |
|
791 print FCLCOMPARISONFILE "\n Number total of packages added in $pdk2_correct_name_to_use is: '''$total_packages_added'''\n\n"; |
|
792 foreach $val (@packages_added_table) |
|
793 { |
|
794 print FCLCOMPARISONFILE "''' $val (sf/app/contacts) '''\n\n"; |
|
795 } |
|
796 |
|
797 print FCLCOMPARISONFILE "=== Packages removed ===\n\n\n"; |
|
798 print FCLCOMPARISONFILE "''' Number total of packages removed in $pdk2_correct_name_to_use is: $total_packages_removed'''\n\n"; |
|
799 foreach $val (@packages_removed_table) |
|
800 { |
|
801 print FCLCOMPARISONFILE "''' $val (sf/app/contacts) '''\n\n\n"; |
|
802 } |
|
803 |
|
804 # Enter the beginning of the section for the FCL |
|
805 print FCLCOMPARISONFILE <<"EOT"; |
|
806 == FCLs == |
|
807 |
|
808 '''$pdk2_correct_name_to_use''' was built using the FCL versions of the packages listed below: for each one we list the changes in the FCL which are not in the MCL. |
|
809 The previous PDK also involved some FCLs, so we indicate which problems are now fixed in the MCL, and which FCLs are new to this build |
|
810 |
|
811 Cloning the source from Mercurial is made more awkward by using a mixture of MCLs and FCLs, but we provide a tool to help - see [[How_to_build_the_Platform#Automatic_Mercurial_Clone]] for details. |
|
812 |
|
813 EOT |
|
814 |
|
815 # Packages that were on MCL and that are now on FCL |
|
816 foreach $val (@new_fcl_table) |
|
817 { |
|
818 print FCLCOMPARISONFILE "=== $val (sf/app/contacts) -- NEW ===\n\n\n"; |
|
819 # Needs to be recovered from Mercurial. How???? |
|
820 #[http://developer.symbian.org/bugs/show_bug.cgi?id=156 Bug 156]: Add a missing bld.inf, to renable compilation of the package |
|
821 #[http://developer.symbian.org/bugs/show_bug.cgi?id=197 Bug 197]: PSAlgorithmInternalCRKeys.h is missing |
|
822 |
|
823 } |
|
824 |
|
825 # Packages that were on FCL and that are now on FCL |
|
826 foreach $val (@still_fcl_table) |
|
827 { |
|
828 print FCLCOMPARISONFILE "=== $val (sf/app/contacts) ===\n\n\n"; |
|
829 } |
|
830 |
|
831 print FCLCOMPARISONFILE "=== FCLs used in $pdk1_correct_name_to_use but not needed in $pdk2_correct_name_to_use ===\n"; |
|
832 |
|
833 foreach $val (@no_more_fcl_table) |
|
834 { |
|
835 print FCLCOMPARISONFILE "''' $val (sf/app/contacts) '''\n\n"; |
|
836 } |
|
837 |
|
838 # Packages were on MCL and they are still on MCL. |
|
839 foreach $val (@very_good_mcl_table) |
|
840 { |
|
841 #print FCLCOMPARISONFILE "=== $val (sf/app/contacts) -- VERY GOOD ===\n"; |
|
842 } |
|
843 |
|
844 |
|
845 close(FCLCOMPARISONFILE); |
|
846 |
|
847 |
|
848 # 6th step is to export that txt file the appropriate location. |
|
849 # That could be the location from where we launched the script! |
|
850 print "\nYou will find the file with all the informatin you need for the releases note, here: $file_path\n\n"; |
|
851 |
|
852 # Cleanup the mess!!! |
|
853 #pause_script(); # Temporary until script is finished!!!!!! |
|
854 |
|
855 $system_cmd = "rmdir /S /Q $working_dir"; |
|
856 print "Exec: $system_cmd\n"; |
|
857 system($system_cmd); |
|
858 |
|
859 ## |
|
860 ### End of the program!!! |
|
861 ## |
|
862 |
|
863 |
|
864 # |
|
865 # Functions section!!!!! |
|
866 # |
|
867 |
|
868 |
|
869 # If no parameters entered or help selected, display help |
|
870 sub helpme |
|
871 { |
|
872 print "\nfct: helpme\n"; |
|
873 |
|
874 print "Generate FCLs details between 2 PDKs to be included as part of the release notes\n"; |
|
875 print "Default location for PDKs is: $default_pdk_loc\n"; |
|
876 print "Usage: perl fcls4releasenotes.pl --input_data1=x --input_data2=y\n"; |
|
877 print "Where input_data1 and input_data2 could be pdknb1 or pdknb2 or pdkloc1 or pdkloc2 or pdkname1 or pdkname2\n"; |
|
878 print "Where pdknb is the PDK number, for example 2.0.e\n"; |
|
879 print "Where pdkloc is the root location where your file $name_zip_file_to_extract is. For ex: \\\\bishare\\releases\\PDK_2.0.e\\ or c:\\temp\\myPDK\\\n"; |
|
880 print "Where pdkname is the full name of the PDK, like for ex PDK_candidate_2.0.d_flat\n"; |
|
881 print "\nTypical command lines from script location:\n"; |
|
882 print "\t<perl fcls4releasenotes.pl --pdknb1=2.0.e --pdkloc1=c:\\temp\\myPDK\\>\n"; |
|
883 print "\t<perl fcls4releasenotes.pl --pdkname1=PDK_2.0.e --pdknb1=2.0.e>\n"; |
|
884 print "\t<perl fcls4releasenotes.pl --pdknb1=2.0.d --pdknb2=2.0.e>\n"; |
|
885 print "\t<perl fcls4releasenotes.pl help>\n"; |
|
886 #print "\t<perl fcls4releasenotes.pl validpdks>\n"; |
|
887 |
|
888 list_pdks_at_default_location(); |
|
889 |
|
890 exit(0); |
|
891 } |
|
892 # End section related to help |
|
893 |
|
894 # Extract list of PDKs that are in the default location. |
|
895 sub list_pdks_at_default_location |
|
896 { |
|
897 print "\nfct: list_pdks_at_default_location\n"; |
|
898 |
|
899 # Do a dir of the default location |
|
900 print "List of directories in the default location $default_pdk_loc\n"; |
|
901 extract_dir_default_loc(); |
|
902 |
|
903 # Extract all the PDKs that have the pattern PDK_ |
|
904 print "All available PDKS in the default location $default_pdk_loc that have the pattern $pdk_start_pattern\n"; |
|
905 extract_pdk_in_default_loc(); |
|
906 |
|
907 # Extract all the PDKs that have the file build_BOM.zip |
|
908 print "All available PDKS in the default location $default_pdk_loc that contains the zip file $name_zip_file_to_extract\n"; |
|
909 extract_pdk_with_valid_zip_in_default_loc(); |
|
910 |
|
911 } |
|
912 |
|
913 # Generates list of directories in the default location used for the storage of the PDKs |
|
914 sub extract_dir_default_loc |
|
915 { |
|
916 print "\nfct: extract_dir_default_loc\n"; |
|
917 |
|
918 # Get the list of directories in the default location |
|
919 opendir(DEFAULT_DIR, $default_pdk_loc); |
|
920 @directories_list_default_location = readdir(DEFAULT_DIR); |
|
921 close(DEFAULT_DIR); |
|
922 |
|
923 $nb_dir_in_default_loc = scalar(@directories_list_default_location); |
|
924 |
|
925 print "nb_dir_in_default_loc=$nb_dir_in_default_loc\n"; |
|
926 #display_array_one_line_at_the_time(@directories_list_default_location); |
|
927 } |
|
928 |
|
929 # Establish the list of directories that are an actual PDK |
|
930 sub extract_pdk_in_default_loc |
|
931 { |
|
932 print "\nfct: extract_pdk_in_default_loc\n"; |
|
933 |
|
934 my $var; |
|
935 $nb_pdks_in_default_loc=0; |
|
936 print "pdk_start_pattern = $pdk_start_pattern\n"; |
|
937 |
|
938 foreach $var (@directories_list_default_location) |
|
939 { |
|
940 if($var =~ /^$pdk_start_pattern+/) |
|
941 { |
|
942 #print "$var\n"; |
|
943 $pdk_dir_list_in_default_location[$nb_pdks_in_default_loc++] = $var; |
|
944 } |
|
945 #else |
|
946 #{ |
|
947 #print "Not a PDK!!!!\n"; |
|
948 #} |
|
949 } |
|
950 print "There is $nb_pdks_in_default_loc PDKs in the default location $default_pdk_loc\n"; |
|
951 |
|
952 print "This is the list of PDKs that are in the default location $default_pdk_loc\n"; |
|
953 #display_array_one_line_at_the_time(@pdk_dir_list_in_default_location); |
|
954 } |
|
955 |
|
956 # Establish the list of PDK directories with a valid zip file to do the test |
|
957 sub extract_pdk_with_valid_zip_in_default_loc |
|
958 { |
|
959 print "\nfct: extract_pdk_with_valid_zip_in_default_loc\n"; |
|
960 |
|
961 my $var1; |
|
962 my $var2; |
|
963 my $path_to_find_zip = ""; |
|
964 my @read_pdk_directory=(); |
|
965 |
|
966 $nb_pdks_with_valid_zip_in_default_loc=0; |
|
967 |
|
968 print "name_zip_file_to_extract=$name_zip_file_to_extract\n"; |
|
969 |
|
970 foreach $var1 (@pdk_dir_list_in_default_location) |
|
971 { |
|
972 $path_to_find_zip=$default_pdk_loc; |
|
973 |
|
974 $path_to_find_zip .= $var1; |
|
975 #print "path_to_find_zip=$path_to_find_zip\n"; |
|
976 |
|
977 # Get the list of directories in the default location |
|
978 opendir(PDK_DIR, $path_to_find_zip); |
|
979 @read_pdk_directory = readdir(PDK_DIR); |
|
980 close(PDK_DIR); |
|
981 |
|
982 foreach $var2 (@read_pdk_directory) |
|
983 { |
|
984 if($var2 =~ /$name_zip_file_to_extract$/) |
|
985 { |
|
986 #print "$var2\n"; |
|
987 $pdks_with_valid_zip_in_default_loc[$nb_pdks_with_valid_zip_in_default_loc++] = $var1; |
|
988 } |
|
989 #else |
|
990 #{ |
|
991 #print "Doesn't contain $name_zip_file_to_extract!!!!\n"; |
|
992 #} |
|
993 } |
|
994 } |
|
995 print "There is $nb_pdks_with_valid_zip_in_default_loc PDKs with a valid $name_zip_file_to_extract zip in the default location $default_pdk_loc\n"; |
|
996 |
|
997 print "This is the list of PDKs that have a zip file called $name_zip_file_to_extract in the default location $default_pdk_loc\n"; |
|
998 display_array_one_line_at_the_time(@pdks_with_valid_zip_in_default_loc); |
|
999 } |
|
1000 |
|
1001 # Function created to pause the script to allow analysis and debug of the script. |
|
1002 # Will require the user to press enter to carry on the execution of the script. |
|
1003 sub pause_script |
|
1004 { |
|
1005 print "\nfct: pause_script\n"; |
|
1006 my $local_system_cmd = "pause"; |
|
1007 print "Exec: $local_system_cmd\n"; |
|
1008 system($local_system_cmd); |
|
1009 } |
|
1010 |
|
1011 |
|
1012 # This function is used to extract the name of the package and the type |
|
1013 sub extract_packages_and_branch_type_from_file |
|
1014 { |
|
1015 # 1 Parameters passed, the path to the file to be viewed |
|
1016 my ($file_to_work_on) = @_; |
|
1017 |
|
1018 print "\nfct: extract_packages_and_branch_type_from_file\n"; |
|
1019 |
|
1020 print "$file_to_work_on\n"; |
|
1021 |
|
1022 my %local_hash_array; |
|
1023 #my @hash_array_to_display; |
|
1024 my $local_key; |
|
1025 |
|
1026 my $package=""; |
|
1027 my $type_of_branch=""; |
|
1028 |
|
1029 #@hash_array_to_display = %local_hash_array; |
|
1030 #print "%local_hash_array before starting = @hash_array_to_display\n"; |
|
1031 |
|
1032 # Open file |
|
1033 open(FILETOWORKON , $file_to_work_on); |
|
1034 |
|
1035 # Extract data from file |
|
1036 my @local_array = <FILETOWORKON>; |
|
1037 #print "local_array= @local_array\n"; |
|
1038 |
|
1039 # Close file |
|
1040 close(FILETOWORKON); |
|
1041 |
|
1042 my $extracted_line; |
|
1043 |
|
1044 # Go line by line |
|
1045 foreach $extracted_line (@local_array) |
|
1046 { |
|
1047 #print "\nextracted_line is: $extracted_line"; # no need to add \\n as it's part of the line displayed. |
|
1048 |
|
1049 if ($extracted_line =~ /$starting_pattern_for_xml_extraction/) |
|
1050 { |
|
1051 #print "The line extracted is our starting pattern $starting_pattern_for_xml_extraction\n"; |
|
1052 $extraction_from_xml_is_allowed=1; |
|
1053 } |
|
1054 else |
|
1055 { |
|
1056 if ($extracted_line =~ /$ending_pattern_for_xml_extraction/) |
|
1057 { |
|
1058 #print "The line extracted is our ending pattern $ending_pattern_for_xml_extraction\n"; |
|
1059 $extraction_from_xml_is_allowed=0; |
|
1060 } |
|
1061 } |
|
1062 #print "extraction_from_xml_is_allowed=$extraction_from_xml_is_allowed\n"; |
|
1063 |
|
1064 if($extraction_from_xml_is_allowed) |
|
1065 { |
|
1066 #print "We are looking to extract the package and branch type from the line extracted\n"; |
|
1067 |
|
1068 # Decode the line |
|
1069 |
|
1070 # Decode the branch type |
|
1071 if($extracted_line =~ /$branch_type_extraction_pattern/) |
|
1072 { |
|
1073 $type_of_branch=$1; |
|
1074 |
|
1075 # Decode the package because there is a branch type in the line extracted! |
|
1076 if ($extracted_line =~ m,$package_extraction_pattern,) |
|
1077 { |
|
1078 $package=$1; |
|
1079 } |
|
1080 #print "package is $package and type_of_branch is $type_of_branch\n"; |
|
1081 $local_hash_array{$package}=$type_of_branch; |
|
1082 } |
|
1083 else |
|
1084 { |
|
1085 #print "The extracted line doesn't contain $look_for_mcl or $look_for_fcl, therefore we need to skip it!\n"; |
|
1086 } |
|
1087 } |
|
1088 } |
|
1089 |
|
1090 # Check the contain of the hash array to make sure that we have extracted the data as expected. To check against the actual file. |
|
1091 |
|
1092 # Option 1: Display all in one line |
|
1093 #@hash_array_to_display = %local_hash_array; |
|
1094 # Print "%local_hash_array when extraction is finished = @hash_array_to_display\n"; |
|
1095 |
|
1096 # Option 2: Print 1 key with 1 value by line |
|
1097 #foreach $local_key (keys(%local_hash_array)) |
|
1098 #{ |
|
1099 # print "$local_key = $local_hash_array{$local_key}\n"; |
|
1100 #} |
|
1101 |
|
1102 # Return hash array containing all the packages and branch type associated |
|
1103 return (%local_hash_array); |
|
1104 } |
|
1105 |
|
1106 sub display_array_one_line_at_the_time |
|
1107 { |
|
1108 my (@table_to_display_one_line_at_the_time) = @_; |
|
1109 |
|
1110 #print "\nfct: display_array_one_line_at_the_time\n"; # Not displayed because you could think that is part of the table. As well it's easier to copy the name of the table and the contain wihtout the need to remove something. |
|
1111 |
|
1112 my $line_to_display; |
|
1113 |
|
1114 foreach $line_to_display (@table_to_display_one_line_at_the_time) |
|
1115 { |
|
1116 print "$line_to_display\n"; |
|
1117 } |
|
1118 } |
|
1119 |
|
1120 # PDKs with build_bom.zip file in the default PDKs location 14-09-2009 |
|
1121 #Z:\Releases\PDK_2.0.e |
|
1122 #Z:\Releases\PDK_candidate_2.0.d_flat |
|
1123 #Z:\Releases\PDK_candidate_2.0e_FCL_27.78 |