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