releaseAutomation/fcls4releasenotes.pl
changeset 81 63e14a36aefd
parent 80 9f8bdafe5d68
child 82 dbc58074ae06
equal deleted inserted replaced
80:9f8bdafe5d68 81:63e14a36aefd
    25 # Nb of arguments to be passed to the script to work. If that need to change, just modify nb_arg_to_pass!
    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;
    26 my $nb_arg_to_pass=2;
    27 print "nb_arg_to_pass=$nb_arg_to_pass\n";
    27 print "nb_arg_to_pass=$nb_arg_to_pass\n";
    28 
    28 
    29 # Name of the file that contains the data we need to extract for this script
    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";
    30 my $build_bom_zip_file_to_extract="build_BOM\.zip";
       
    31 my $build_logs_zip_file_to_extract="build_logs\.zip";
       
    32 
       
    33 # Name of the file we need to work on to extract the data necessary for the Release Notes from build_BOM.zip
       
    34 my $name_of_file_to_compare="build-info\.xml";
       
    35 
       
    36 # File used to extract path and component name for a package from build_logs.zip
       
    37 my $pckg_extraction_data_file_name = "PkgComponentAnalysisSummary\.csv";
       
    38 
       
    39 
       
    40 # 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
       
    41 # This is working only when using pdkloc2 only. In any other cases we are not bothered!!!!!
       
    42 my $bom_dir="BOM";
       
    43 my $analysis_dir="analysis";
    31 
    44 
    32 # Pattern used to search for PDKs
    45 # Pattern used to search for PDKs
    33 my $pdk_start_pattern="PDK_";
    46 my $pdk_start_pattern="PDK_";
    34 
    47 
    35 # Pattern used to extract info from the xml file
    48 # Pattern used to extract info from the xml file
    59 my $working_directory="temp";
    72 my $working_directory="temp";
    60 my $working_sub_directory="fcl_extraction";
    73 my $working_sub_directory="fcl_extraction";
    61 my $working_pdk1_directory="pdk1";
    74 my $working_pdk1_directory="pdk1";
    62 my $working_pdk2_directory="pdk2";
    75 my $working_pdk2_directory="pdk2";
    63 
    76 
    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
    77 # 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";
    78 my $name_of_file_to_publish="sf.releasenotes.wiki.txt";
    69 #Location for that file
    79 #Location for that file
       
    80 # This values need to be overwritten!!!
    70 my $location_of_file_to_publish="c:\\temp";
    81 my $location_of_file_to_publish="c:\\temp";
    71 my $file_path="$location_of_file_to_publish\\$name_of_file_to_publish";
    82 my $path_to_file_to_publish="$location_of_file_to_publish\\$name_of_file_to_publish";
    72 
    83 
    73 #
    84 #
    74 # End configuration data for the script
    85 # End configuration data for the script
    75 #
    86 #
    76 
    87 
    78 # Get parameters passed to the script. Save only the 2 first parameters as we need only 2 parameters for the script
    89 # Get parameters passed to the script. Save only the 2 first parameters as we need only 2 parameters for the script
    79 print "\n";
    90 print "\n";
    80 my $nb_arg_passed = scalar(@ARGV);
    91 my $nb_arg_passed = scalar(@ARGV);
    81 print "nb_arg_passed=$nb_arg_passed\n"; # Find out the number of arguement passed
    92 print "nb_arg_passed=$nb_arg_passed\n"; # Find out the number of arguement passed
    82 print "@ARGV\n\n";
    93 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?
    94 # Needs to be done here, otherwise lost if try to recover them later on. Why?
    89 my $arg1_passed = $ARGV[0];
    95 my $arg1_passed = $ARGV[0];
    90 my $arg2_passed = $ARGV[1];
    96 my $arg2_passed = $ARGV[1];
    91 print "arg1_passed= $arg1_passed \t arg2_passed=$arg2_passed\n";
    97 print "arg1_passed= $arg1_passed \t arg2_passed=$arg2_passed\n";
       
    98 
       
    99 # if enter help as unique argument, then we will launch the help becaue we only pass one argument.
       
   100 if ($nb_arg_passed != $nb_arg_to_pass)
       
   101 {
       
   102 	helpme();
       
   103 }
    92 
   104 
    93 # Modules necessary to run this script
   105 # Modules necessary to run this script
    94 use Getopt::Long;
   106 use Getopt::Long;
    95 use strict;
   107 use strict;
    96 
   108 
   110 	'pdknb2=s' => \$pdknb2,
   122 	'pdknb2=s' => \$pdknb2,
   111 	'pdkname1=s' => \$pdkname1,
   123 	'pdkname1=s' => \$pdkname1,
   112 	'pdkname2=s' => \$pdkname2,
   124 	'pdkname2=s' => \$pdkname2,
   113 	'pdkloc1=s' => \$pdkloc1,
   125 	'pdkloc1=s' => \$pdkloc1,
   114 	'pdkloc2=s' => \$pdkloc2,
   126 	'pdkloc2=s' => \$pdkloc2,
   115 	'help!' => \$help
   127 	'help!' => \$help	# Not working
   116 ));
   128 ));
   117 
   129 
   118 print "\$pdknb1=$pdknb1\n";
   130 print "\pdknb1=$pdknb1\n";
   119 print "\$pdknb2=$pdknb2\n";
   131 print "\pdknb2=$pdknb2\n";
   120 print "\$pdkname1=$pdkname1\n";
   132 print "\pdkname1=$pdkname1\n";
   121 print "\$pdkname2=$pdkname2\n";
   133 print "\pdkname2=$pdkname2\n";
   122 print "\$pdkloc1=$pdkloc1\n";
   134 print "\pdkloc1=$pdkloc1\n";
   123 print "\$pdkloc2=$pdkloc2\n";
   135 print "\pdkloc2=$pdkloc2\n";
       
   136 print "\help=$help\n";
   124 
   137 
   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)
   138 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 
   139 
   127 # First PDK to check
   140 # First PDK to check
   128 my $pdk_path1="";
   141 my $pdk_path1="";
   142 my $pdk_path2_now_in_use=0;
   155 my $pdk_path2_now_in_use=0;
   143 my $pdk_values_to_search2=""; # Not necessary
   156 my $pdk_values_to_search2=""; # Not necessary
   144 my $pdk_path2_exist=0;
   157 my $pdk_path2_exist=0;
   145 my $pdk_zip2_exist=0; # Not necessary
   158 my $pdk_zip2_exist=0; # Not necessary
   146 my $pdk2_correct_name_to_use="";
   159 my $pdk2_correct_name_to_use="";
   147 my $loc2_contains_the_zip_file_we_need=0;
   160 my $loc2_contains_the_zip_file_we_need=0;		# Used to indicate that we have found the build_BOM.zip file
   148 
   161 my $loc2_contains_the_xml_csv_files_we_need=0;	# Used to indicate that we have found the build-info.xml and PkgComponentAnalysisSummary.csv
       
   162 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.
       
   163 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.
   149 
   164 
   150 # Default directory management
   165 # Default directory management
   151 my @directories_list_default_location=();
   166 my @directories_list_default_location=();
   152 my $nb_dir_in_default_loc;
   167 my $nb_dir_in_default_loc;
   153 my @pdk_dir_list_in_default_location=();
   168 my @pdk_dir_list_in_default_location=();
   184 my @packages_removed_table;		# Table that contains the packages that have been deleted from pdk2
   199 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)
   200 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)
   201 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)
   202 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)
   203 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 
   204 my %pckg_path_name_array;		# Table containing the path for each packages
       
   205 my %pckg_name_array;			# Table containing the real meaning name for each packages, not the name of the package in the directory structure
   190 
   206 
   191 # Check that we have only 2 values for the PDKs. If not 2, then not good!
   207 # Check that we have only 2 values for the PDKs. If not 2, then not good!
   192 
   208 
   193 
   209 
   194 # Script code start here!
   210 # Script code start here!
   226 		$pdk_path1_now_in_use=1;
   242 		$pdk_path1_now_in_use=1;
   227 		$pdk_values_to_search1=$pdkname1; # Not necessary
   243 		$pdk_values_to_search1=$pdkname1; # Not necessary
   228 	}
   244 	}
   229 	else
   245 	else
   230 	{
   246 	{
   231 		if(!$pdk_path2_now_in_use)
   247 		print "You are a bad boy!!!!, you can't enter 2 parameters ending with the same number like pdknb1 and pdkname1! Start again with the right parameters!\n";
   232 		{
   248 		exit(0);
   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 	}
   249 	}
   240 }
   250 }
   241 if($pdkname2)
   251 if($pdkname2)
   242 {
   252 {
   243 	$count_arg++;
   253 	$count_arg++;
   250 		$pdk_path2_now_in_use=1;
   260 		$pdk_path2_now_in_use=1;
   251 		$pdk_values_to_search2=$pdkname2; # Not necessary
   261 		$pdk_values_to_search2=$pdkname2; # Not necessary
   252 	}
   262 	}
   253 	else
   263 	else
   254 	{
   264 	{
   255 		if(!$pdk_path1_now_in_use)
   265 		print "You are a bad boy!!!!, you can't enter 2 parameters ending with the same number like pdknb2 and pdkname2! Start again with the right parameters!\n";
   256 		{
   266 		exit(0);
   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 	}
   267 	}
   264 }
   268 }
   265 if($pdkloc1)
   269 if($pdkloc1)
   266 {
   270 {
   267 	$count_arg++;
   271 	$count_arg++;
   272 		$pdk_path1 = $pdkloc1;
   276 		$pdk_path1 = $pdkloc1;
   273 		$pdk_path1_now_in_use=1;
   277 		$pdk_path1_now_in_use=1;
   274 	}
   278 	}
   275 	else
   279 	else
   276 	{
   280 	{
   277 		if(!$pdk_path2_now_in_use)
   281 		print "You are a bad boy!!!!, you can't enter 2 parameters ending with the same number like pdknb1 and pdkloc1! Start again with the right parameters!\n";
   278 		{
   282 		exit(0);
   279 			# Get data for first pdk used for the comparison
       
   280 			$pdk_path2 = $pdkloc1;
       
   281 			$pdk_path2_now_in_use=1;
       
   282 		}
       
   283 	}
   283 	}
   284 }
   284 }
   285 
   285 
   286 if($pdkloc2)
   286 if($pdkloc2)
   287 {
   287 {
   293 		$pdk_path2 = $pdkloc2;
   293 		$pdk_path2 = $pdkloc2;
   294 		$pdk_path2_now_in_use=1;
   294 		$pdk_path2_now_in_use=1;
   295 	}
   295 	}
   296 	else
   296 	else
   297 	{
   297 	{
   298 		if(!$pdk_path1_now_in_use)
   298 		print "You are a bad boy!!!!, you can't enter 2 parameters ending with the same number like pdknb2 and pdkloc2! Start again with the right parameters!\n";
   299 		{
   299 		exit(0);
   300 			# Get data for first pdk used for the comparison
       
   301 			$pdk_path1 = $pdkloc2;
       
   302 			$pdk_path1_now_in_use=1;
       
   303 		}
       
   304 	}
   300 	}
   305 }
   301 }
   306 
   302 
   307 print "count_arg=$count_arg\n";
   303 print "count_arg=$count_arg\n";
   308 
   304 
   490 	
   486 	
   491 	#print "List of files in the directory: @read_files_in_loc\n";
   487 	#print "List of files in the directory: @read_files_in_loc\n";
   492 	
   488 	
   493 	foreach $loc_var (@read_files_in_loc)
   489 	foreach $loc_var (@read_files_in_loc)
   494 	{
   490 	{
   495 		#if($loc_var =~ /$name_zip_file_to_extract[^.\w]/)
   491 		if($loc_var =~ /$build_bom_zip_file_to_extract$/)
   496 		if($loc_var =~ /$name_zip_file_to_extract$/)
       
   497 		{
   492 		{
   498 			print "We found the file: $loc_var\n";
   493 			print "We found the file: $loc_var\n";
   499 			
   494 			
   500 			$pdk1_correct_name_to_use = "PDK1";
   495 			$pdk1_correct_name_to_use = "PDK1";
   501 			$pdk_path1 = $pdkloc1;
   496 			$pdk_path1 = $pdkloc1;
   507 			# As we have found the file, we can probably break!
   502 			# As we have found the file, we can probably break!
   508 		}
   503 		}
   509 	}
   504 	}
   510 	if(!$loc1_contains_the_zip_file_we_need)
   505 	if(!$loc1_contains_the_zip_file_we_need)
   511 	{
   506 	{
   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";
   507 		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";
   513 		exit(0);
   508 		exit(0);
   514 	}
   509 	}
   515 }
   510 }
   516 print "\n";
   511 print "\n";
   517 
   512 
   518 if($pdkloc2)
   513 if($pdkloc2)
   519 {
   514 {
   520 	# Get the list of file in the location choosen.
   515 	# Have a look at the zip files in the location choosen.
   521 	opendir(LOC2_DIR, $pdkloc2);
   516 	opendir(LOC2_DIR, $pdkloc2);
   522 	@read_files_in_loc = readdir(LOC2_DIR);
   517 	@read_files_in_loc = readdir(LOC2_DIR);	# Need to have a look at the sub directories too!!!!!!
   523 	close(LOC2_DIR);
   518 	close(LOC2_DIR);	
   524 	
   519 	print "List of files in the directory: @read_files_in_loc\n";
   525 	#print "List of files in the directory: @read_files_in_loc\n";
       
   526 	
   520 	
   527 	foreach $loc_var (@read_files_in_loc)
   521 	foreach $loc_var (@read_files_in_loc)
   528 	{
   522 	{
   529 		#if($loc_var =~ /$name_zip_file_to_extract[^.\w]/)
   523 		# Have a look for build_bom.zip and build_logs.zip
   530 		if($loc_var =~ /$name_zip_file_to_extract$/)
   524 		if( ($loc_var =~ /$build_bom_zip_file_to_extract$/) || ($loc_var =~ /$build_logs_zip_file_to_extract$/) )
   531 		{
   525 		{
   532 			print "We found the file: $loc_var\n";
   526 			print "We found the file: $loc_var\n";
   533 			
   527 			$loc2_contains_the_zip_file_we_need++;
   534 			$pdk2_correct_name_to_use = "PDK2";
   528 		}
   535 			$pdk_path2 = $pdkloc2;
   529 	}
   536 			
   530 	
   537 			print "The PDK used is: $pdk2_correct_name_to_use\n";
   531 	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!
   538 			print "pdk_path2 = $pdk_path2\n";
   532 	{
   539 			$loc2_contains_the_zip_file_we_need=1;
   533 		my $local_var_path;
   540 			
   534 		
   541 			# As we have found the file, we can probably break!
   535 		print "We are checking for xml file\n";
   542 		}
   536 		$local_var_path = "$pdkloc2\\$bom_dir";
   543 	}
   537 		print "local_var_path = $local_var_path\n";
   544 	if(!$loc2_contains_the_zip_file_we_need)
   538 		
   545 	{
   539 		opendir(LOCBOM_DIR, $local_var_path);
   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";
   540 		@read_files_in_loc = readdir(LOCBOM_DIR);
       
   541 		close(LOCBOM_DIR);
       
   542 		
       
   543 		print "List of files in the directory: @read_files_in_loc\n";
       
   544 		
       
   545 		foreach $loc_var (@read_files_in_loc)
       
   546 		{			
       
   547 			if($loc_var =~ /$name_of_file_to_compare$/)
       
   548 			{
       
   549 				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";
       
   550 				
       
   551 				print "We found the file: $loc_var\n";
       
   552 				
       
   553 				$loc2_contains_the_xml_csv_files_we_need++;
       
   554 			}
       
   555 		}
       
   556 
       
   557 		print "We are checking for csv file\n";
       
   558 		$local_var_path = "$pdkloc2\\$analysis_dir";
       
   559 		print "local_var_path = $local_var_path\n";
       
   560 		
       
   561 		opendir(LOCANALYSIS_DIR, $local_var_path);
       
   562 		@read_files_in_loc = readdir(LOCANALYSIS_DIR);
       
   563 		close(LOCANALYSIS_DIR);
       
   564 		
       
   565 		print "List of files in the directory: @read_files_in_loc\n";
       
   566 		
       
   567 		foreach $loc_var (@read_files_in_loc)
       
   568 		{
       
   569 			if($loc_var =~ /$pckg_extraction_data_file_name$/)
       
   570 			{
       
   571 				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";
       
   572 				
       
   573 				print "We found the file: $loc_var\n";
       
   574 				
       
   575 				$loc2_contains_the_xml_csv_files_we_need++;
       
   576 			}
       
   577 		}
       
   578 	}
       
   579 	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))
       
   580 	{
       
   581 		$pdk2_correct_name_to_use = "PDK2";
       
   582 		$pdk_path2 = $pdkloc2;
       
   583 		
       
   584 		print "The PDK used is: $pdk2_correct_name_to_use\n";
       
   585 		print "pdk_path2 = $pdk_path2\n";
       
   586 		
       
   587 		if($loc2_contains_the_xml_csv_files_we_need==$nb_of_xml_csv_files_we_need)
       
   588 		{
       
   589 			$location_of_file_to_publish=$pdkloc2;
       
   590 			$path_to_file_to_publish="$location_of_file_to_publish\\$name_of_file_to_publish";
       
   591 			print "location_of_file_to_publish=$location_of_file_to_publish\n";
       
   592 			print "path_to_file_to_publish=$path_to_file_to_publish\n";
       
   593 		}
       
   594 	}
       
   595 	else
       
   596 	{
       
   597 		if($loc2_contains_the_xml_csv_files_we_need<=$nb_of_xml_csv_files_we_need)
       
   598 		{
       
   599 			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";
       
   600 		}
       
   601 		else
       
   602 		{
       
   603 			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";
       
   604 		}
   547 		exit(0);
   605 		exit(0);
   548 	}
   606 	}
   549 }
   607 }
   550 
   608 
   551 print "\n";
   609 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";
   610 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";
   553 print "This is the value for the path we are looking at for pdk_path1: $pdk_path1\n";
   611 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";
   612 print "This is the value for the path we are looking at for pdk_path2: $pdk_path2\n";
   555 
   613 
   556 # When we are at this point, we know we have 2 build_BOM.zip files that we can compare them!!!!
   614 # When we are at this point, we know we have 2 build_BOM.zip files that we can compare them!!!!
   557 
   615 
   570 # Where -r is for recursive to make sure we have a look in the subdirectories
   628 # 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
   629 # Where -oOutput_Directory is the directory where we want the files to be unzipped
   572 #
   630 #
   573 # Where $working_sub_directory is the directory where we will be carry the work to be done for the script.
   631 # 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
   632 # 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)
   633 # Where $build_bom_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
   634 # 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)
   635 # 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
   636 # Example: 7z e -r -oc:\temp\fcl_extraction\pdk1 C:\temp\Task243Test\PDK_1\build_BOM.zip build-info.xml
   579 
   637 
   580 # Extract file from 1st PDK
   638 # 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";
   639 $system_cmd = "7z e -r -o$working_dir1 $pdk_path1\\$build_bom_zip_file_to_extract $name_of_file_to_compare";
   582 print "Exec: $system_cmd\n";
   640 print "Exec: $system_cmd\n";
   583 system($system_cmd);
   641 system($system_cmd);
   584 
   642 
   585 print "\n";
   643 print "\n";
   586 
   644 
   587 # Extract file from 2nd PDK
   645 # Extract the information contained in PkgComponentAnalysisSummary.csv for path a nd package name used by PDK1.
   588 $system_cmd = "7z e -r -o$working_dir2 $pdk_path2\\$name_zip_file_to_extract $name_of_file_to_compare";
   646 $system_cmd = "7z e -r -o$working_dir1 $pdk_path1\\$build_logs_zip_file_to_extract $pckg_extraction_data_file_name";
   589 print "Exec: $system_cmd\n";
   647 print "Exec: $system_cmd\n";
   590 system($system_cmd);
   648 system($system_cmd);
       
   649 
       
   650 print "\n";
       
   651 
       
   652 # Extract file from 2nd PDK
       
   653 if($loc2_contains_the_xml_csv_files_we_need==$nb_of_xml_csv_files_we_need)
       
   654 {
       
   655 	my $local_file_path;
       
   656 	print "We are copying the files $name_of_file_to_compare and $pckg_extraction_data_file_name from $pdk_path2 to $working_dir2\n";
       
   657 
       
   658 	print "Create directory $working_dir2\n";
       
   659 	$system_cmd = "mkdir $working_dir2";
       
   660 	print "Exec: $system_cmd\n";
       
   661 	system($system_cmd);
       
   662 	
       
   663 	print "We are going to copy $name_of_file_to_compare to $working_dir2\n";
       
   664 	$local_file_path = "$pdk_path2\\$bom_dir\\$name_of_file_to_compare";
       
   665 	$system_cmd = "xcopy $local_file_path $working_dir2 \/F";
       
   666 	print "Exec: $system_cmd\n";
       
   667 	system($system_cmd);
       
   668 
       
   669 	print "\n";
       
   670 	
       
   671 	# Extract the information contained in PkgComponentAnalysisSummary.csv for path and package name used by PDK1.
       
   672 	print "We are going to copy $pckg_extraction_data_file_name to $working_dir2\n";
       
   673 	$local_file_path = "$pdk_path2\\$analysis_dir\\$pckg_extraction_data_file_name";
       
   674 	$system_cmd = "xcopy $local_file_path $working_dir2 \/F";
       
   675 	print "Exec: $system_cmd\n";
       
   676 	system($system_cmd);
       
   677 }
       
   678 else
       
   679 {
       
   680 	print "We are looking for zip files, then we extract them\n";
       
   681 	$system_cmd = "7z e -r -o$working_dir2 $pdk_path2\\$build_bom_zip_file_to_extract $name_of_file_to_compare";
       
   682 	print "Exec: $system_cmd\n";
       
   683 	system($system_cmd);
       
   684 	
       
   685 	print "\n";
       
   686 	
       
   687 	# Extract the information contained in PkgComponentAnalysisSummary.csv for path and package name used by PDK1.
       
   688 	$system_cmd = "7z e -r -o$working_dir2 $pdk_path2\\$build_logs_zip_file_to_extract $pckg_extraction_data_file_name";
       
   689 	print "Exec: $system_cmd\n";
       
   690 	system($system_cmd);
       
   691 }
   591 
   692 
   592 # 2nd step is to extract the information we need from the 2 files build-info.xml
   693 # 2nd step is to extract the information we need from the 2 files build-info.xml
   593 
   694 
   594 # Create 2 hash arrays that will contain the name of the package as key and the value associated as MCL or FCL
   695 # 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;
   696 my %build_info_xml1;
   705 					#print "the package was MCL and is still MCL - VERY GOOD\n";
   806 					#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];
   807 					$very_good_mcl_table[$total_very_good_mcl++] = $pdk1_sorting_table[$tab_counter1];
   707 				}
   808 				}
   708 			}
   809 			}
   709 		}
   810 		}
   710 		
       
   711 		$tab_counter1++;
   811 		$tab_counter1++;
   712 		$tab_counter2++;
   812 		$tab_counter2++;
   713 	}
   813 	}
   714 	else
   814 	else
   715 	{
   815 	{
   726 			$packages_added_table[$total_packages_added++]=$pdk2_sorting_table[$tab_counter2++];
   826 			$packages_added_table[$total_packages_added++]=$pdk2_sorting_table[$tab_counter2++];
   727 		}
   827 		}
   728 	}
   828 	}
   729 }
   829 }
   730 
   830 
       
   831 # Build list of files path and name based on csv file generated by the build system (analysis part)
       
   832 extract_package_detail("$working_dir2\\$pckg_extraction_data_file_name");
       
   833 extract_package_detail("$working_dir1\\$pckg_extraction_data_file_name");
   731 
   834 
   732 print "\nPrint all the values related to our calculations\n";
   835 print "\nPrint all the values related to our calculations\n";
   733 print "total_packages_pdk1=$total_packages_pdk1\n";
   836 print "total_packages_pdk1=$total_packages_pdk1\n";
   734 print "total_packages_pdk2=$total_packages_pdk2\n";
   837 print "total_packages_pdk2=$total_packages_pdk2\n";
   735 print "\n";
   838 print "\n";
   736 print "total_packages_added=$total_packages_added\n";
   839 print "total_packages_added=$total_packages_added\n";
   737 print "packages_added_table=\n";
   840 print "packages_added_table=\n";
   738 display_array_one_line_at_the_time(@packages_added_table);
   841 #display_array_one_line_at_the_time(@packages_added_table);
   739 print "\n";
   842 print "\n";
   740 print "total_packages_removed=$total_packages_removed\n";
   843 print "total_packages_removed=$total_packages_removed\n";
   741 print "packages_removed_table=\n";
   844 print "packages_removed_table=\n";
   742 display_array_one_line_at_the_time(@packages_removed_table);
   845 #display_array_one_line_at_the_time(@packages_removed_table);
   743 print "\n";
   846 print "\n";
   744 print "total_new_fcl=$total_new_fcl\n";
   847 print "total_new_fcl=$total_new_fcl\n";
   745 print "new_fcl_table=\n";
   848 print "new_fcl_table=\n";
   746 display_array_one_line_at_the_time(@new_fcl_table);
   849 #display_array_one_line_at_the_time(@new_fcl_table);
   747 print "\n";
   850 print "\n";
   748 print "total_no_more_fcl=$total_no_more_fcl\n";
   851 print "total_no_more_fcl=$total_no_more_fcl\n";
   749 print "no_more_fcl_table=\n";
   852 print "no_more_fcl_table=\n";
   750 display_array_one_line_at_the_time(@no_more_fcl_table);
   853 #display_array_one_line_at_the_time(@no_more_fcl_table);
   751 print "\n";
   854 print "\n";
   752 print "total_still_fcl=$total_still_fcl\n";
   855 print "total_still_fcl=$total_still_fcl\n";
   753 print "still_fcl_table=\n";
   856 print "still_fcl_table=\n";
   754 display_array_one_line_at_the_time(@still_fcl_table);
   857 #display_array_one_line_at_the_time(@still_fcl_table);
   755 print "\n";
   858 print "\n";
   756 print "total_very_good_mcl=$total_very_good_mcl\n";
   859 print "total_very_good_mcl=$total_very_good_mcl\n";
   757 print "very_good_mcl_table=\n";
   860 print "very_good_mcl_table=\n";
   758 display_array_one_line_at_the_time(@very_good_mcl_table);
   861 #display_array_one_line_at_the_time(@very_good_mcl_table);
   759 print "\n";
   862 print "\n";
   760 # Checking that the packages have been assigned properly.
   863 # Checking that the packages have been assigned properly.
   761 # !!!! Need to verify the formula. Not sure that is correct!!!!!!
   864 # !!!! Need to verify the formula. Not sure that is correct!!!!!!
   762 print "Verification for the total packages between the 2 pdks\n";
   865 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";
   866 print "Formula used is: total_packages_pdk2 = total_packages_pdk1 + total_packages_added - total_packages_removed\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";
   872 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";
   873 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";
   874 print "\n";
   772 
   875 
   773 # 5th step is to create a txt file ready to be used for the release notes in a media wiki format.
   876 # 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!!!!!
   877 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!!!!!
   775 
   878 
   776 my $val;
   879 my $val;
   777 
   880 
   778 # Enter the beginning of the section for general information about the pdk and it's predecessor.
   881 # Enter the beginning of the section for general information about the pdk and it's predecessor.
   779 print FCLCOMPARISONFILE <<"EOT";
   882 print FCLCOMPARISONFILE <<"EOT";
   789 
   892 
   790 print FCLCOMPARISONFILE "=== Packages added ===\n\n";
   893 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";
   894 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)
   895 foreach $val (@packages_added_table)
   793 {
   896 {
   794 	print FCLCOMPARISONFILE "''' $val (sf/app/contacts) '''\n\n";
   897 	if($pckg_name_array{$val})
       
   898 	{
       
   899 		print FCLCOMPARISONFILE "''' $pckg_name_array{$val} ($pckg_path_name_array{$val}) '''\n\n\n";
       
   900 	}
       
   901 	else
       
   902 	{
       
   903 		print FCLCOMPARISONFILE "''' $val ($pckg_path_name_array{$val}) '''\n\n\n";
       
   904 	}
   795 }
   905 }
   796 
   906 
   797 print FCLCOMPARISONFILE "=== Packages removed ===\n\n\n";
   907 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";
   908 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)
   909 foreach $val (@packages_removed_table)
   800 {
   910 {
   801 	print FCLCOMPARISONFILE "''' $val (sf/app/contacts) '''\n\n\n";
   911 	if($pckg_name_array{$val})
       
   912 	{
       
   913 		print FCLCOMPARISONFILE "''' $pckg_name_array{$val} ($pckg_path_name_array{$val}) '''\n\n\n";
       
   914 	}
       
   915 	else
       
   916 	{
       
   917 		print FCLCOMPARISONFILE "''' $val ($pckg_path_name_array{$val}) '''\n\n\n";
       
   918 	}
   802 }
   919 }
   803 
   920 
   804 # Enter the beginning of the section for the FCL
   921 # Enter the beginning of the section for the FCL
   805 print FCLCOMPARISONFILE <<"EOT";
   922 print FCLCOMPARISONFILE <<"EOT";
   806 == FCLs ==
   923 == FCLs ==
   813 EOT
   930 EOT
   814 
   931 
   815 # Packages that were on MCL and that are now on FCL
   932 # Packages that were on MCL and that are now on FCL
   816 foreach $val (@new_fcl_table)
   933 foreach $val (@new_fcl_table)
   817 {
   934 {
   818 	print FCLCOMPARISONFILE "=== $val (sf/app/contacts) -- NEW ===\n\n\n";
   935 	if($pckg_name_array{$val})
   819 	# Needs to be recovered from Mercurial. How????
   936 	{
   820 	#[http://developer.symbian.org/bugs/show_bug.cgi?id=156 Bug 156]: Add a missing bld.inf, to renable compilation of the package
   937 		print FCLCOMPARISONFILE "=== $pckg_name_array{$val} ($pckg_path_name_array{$val}) -- NEW ===\n\n\n";
   821 	#[http://developer.symbian.org/bugs/show_bug.cgi?id=197 Bug 197]: PSAlgorithmInternalCRKeys.h is missing
   938 		# TO DO!!!!
   822 
   939 		# Needs to be recovered from Mercurial. How????
       
   940 		#[http://developer.symbian.org/bugs/show_bug.cgi?id=156 Bug 156]: Add a missing bld.inf, to renable compilation of the package
       
   941 		#[http://developer.symbian.org/bugs/show_bug.cgi?id=197 Bug 197]: PSAlgorithmInternalCRKeys.h is missing
       
   942 	}
       
   943 	else
       
   944 	{
       
   945 		print FCLCOMPARISONFILE "=== $val ($pckg_path_name_array{$val}) -- NEW ===\n\n\n";
       
   946 	}
   823 }
   947 }
   824 
   948 
   825 # Packages that were on FCL and that are now on FCL
   949 # Packages that were on FCL and that are now on FCL
   826 foreach $val (@still_fcl_table)
   950 foreach $val (@still_fcl_table)
   827 {
   951 {
   828 	print FCLCOMPARISONFILE "=== $val (sf/app/contacts) ===\n\n\n";
   952 	if($pckg_name_array{$val})
       
   953 	{
       
   954 		print FCLCOMPARISONFILE "=== $pckg_name_array{$val} ($pckg_path_name_array{$val}) ===\n\n\n";
       
   955 	}
       
   956 	else
       
   957 	{
       
   958 		print FCLCOMPARISONFILE "=== $val ($pckg_path_name_array{$val}) ===\n\n\n";
       
   959 	}
   829 }
   960 }
   830 
   961 
   831 print FCLCOMPARISONFILE "=== FCLs used in $pdk1_correct_name_to_use but not needed in $pdk2_correct_name_to_use ===\n";
   962 print FCLCOMPARISONFILE "=== FCLs used in $pdk1_correct_name_to_use but not needed in $pdk2_correct_name_to_use ===\n";
   832 
   963 
   833 foreach $val (@no_more_fcl_table)
   964 foreach $val (@no_more_fcl_table)
   834 {
   965 {
   835 	print FCLCOMPARISONFILE "''' $val (sf/app/contacts) '''\n\n";
   966 	if($pckg_name_array{$val})
       
   967 	{
       
   968 		print FCLCOMPARISONFILE "''' $pckg_name_array{$val} ($pckg_path_name_array{$val}) '''\n\n";
       
   969 	}
       
   970 	else
       
   971 	{
       
   972 		print FCLCOMPARISONFILE "''' $val ($pckg_path_name_array{$val}) '''\n\n";
       
   973 	}
   836 }
   974 }
   837 
   975 
   838 # Packages were on MCL and they are still on MCL.
   976 # Packages were on MCL and they are still on MCL.
   839 foreach $val (@very_good_mcl_table)
   977 foreach $val (@very_good_mcl_table)
   840 {
   978 {
   841 	#print FCLCOMPARISONFILE "=== $val (sf/app/contacts) -- VERY GOOD ===\n";
   979 	#print "Value for package $val is: $pckg_name_array{$val}\n";
   842 }
   980 	if($pckg_name_array{$val})
   843 
   981 	{
       
   982 		#print "There is a real name for the package: ($pckg_name_array{$val})\n";
       
   983 		#print FCLCOMPARISONFILE "=== $pckg_name_array{$val} ($pckg_path_name_array{$val}) -- VERY GOOD ===\n";
       
   984 	}
       
   985 	else
       
   986 	{
       
   987 		#print "There is not a real name for the package: ($pckg_name_array{$val})\n";
       
   988 		#print FCLCOMPARISONFILE "=== $val ($pckg_path_name_array{$val}) -- VERY GOOD ===\n";
       
   989 	}
       
   990 }
   844 
   991 
   845 close(FCLCOMPARISONFILE);
   992 close(FCLCOMPARISONFILE);
       
   993 
       
   994 #print "Path for each packages:\n";
       
   995 #display_hash_array_one_line_at_the_time(%pckg_path_name_array);
       
   996 #print "\n";
       
   997 #print "Real name for each packages:\n";
       
   998 #display_hash_array_one_line_at_the_time(%pckg_name_array);
       
   999 #print "\n";
       
  1000 #print "Branch type for each packages:\n";
       
  1001 #display_hash_array_one_line_at_the_time(%build_info_xml2);
       
  1002 #print "\n";
       
  1003 
       
  1004 # Used to verify the differences between build_info.xml and PkgComponentAnalysisSummary.csv because not the same number of packages.
       
  1005 #print "Packages list from build-info.xml:\n";
       
  1006 #my @local_array_key_extraction;
       
  1007 #my @local_array_key_extraction_sorted;
       
  1008 #@local_array_key_extraction = keys (%build_info_xml2);
       
  1009 #@local_array_key_extraction_sorted = sort { lc($a) cmp lc($b) } @local_array_key_extraction;
       
  1010 #display_array_one_line_at_the_time(@local_array_key_extraction_sorted);
       
  1011 #print "\n";
       
  1012 #print "Packages list from csv file:\n";
       
  1013 #my @local_array_key_extraction;
       
  1014 #my @local_array_key_extraction_sorted;
       
  1015 #@local_array_key_extraction = keys (%pckg_name_array);
       
  1016 #@local_array_key_extraction_sorted = sort { lc($a) cmp lc($b) } @local_array_key_extraction;
       
  1017 #display_array_one_line_at_the_time(@local_array_key_extraction_sorted);
   846 
  1018 
   847 
  1019 
   848 # 6th step is to export that txt file the appropriate location.
  1020 # 6th step is to export that txt file the appropriate location.
   849 # That could be the location from where we launched the script!
  1021 # 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";
  1022 print "\nYou will find the file with all the information you need for the releases note, here: $path_to_file_to_publish\n\n";
   851 
  1023 
   852 # Cleanup the mess!!!
  1024 # Cleanup the mess!!!
   853 #pause_script(); # Temporary until script is finished!!!!!!
  1025 #pause_script(); # Temporary until script is finished!!!!!!
   854 
  1026 
   855 $system_cmd = "rmdir /S /Q $working_dir";
  1027 $system_cmd = "rmdir /S /Q $working_dir";
   874 	print "Generate FCLs details between 2 PDKs to be included as part of the release notes\n";	
  1046 	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";
  1047 	print "Default location for PDKs is: $default_pdk_loc\n";
   876 	print "Usage: perl fcls4releasenotes.pl --input_data1=x --input_data2=y\n";
  1048 	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";
  1049 	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";
  1050 	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";
  1051 	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";
   880 	print "Where pdkname is the full name of the PDK, like for ex PDK_candidate_2.0.d_flat\n";
  1052 	print "Where pdkname is the full name of the PDK, like for ex PDK_candidate_2.0.d_flat\n";
       
  1053 	print "\nNotes:\n";
       
  1054 	print "\tParameter names with 1 at the end (pdknb1, pdkname1, pdkloc1) are set for the oldest PDK to use (PDK1)\n";
       
  1055 	print "\tParameter names with 2 at the end (pdknb2, pdkname2, pdkloc2) are set for the newest PDK to use (PDK2)\n";
       
  1056 	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";
       
  1057 	print "\tThe difference is done as follow PDK2 - PDK1\n";
       
  1058 	print "\n";
   881 	print "\nTypical command lines from script location:\n";
  1059 	print "\nTypical command lines from script location:\n";
   882 	print "\t<perl fcls4releasenotes.pl --pdknb1=2.0.e --pdkloc1=c:\\temp\\myPDK\\>\n";
  1060 	print "\t<perl fcls4releasenotes.pl --pdknb1=2.0.e --pdkloc2=c:\\temp\\myPDK\\>\n";
   883 	print "\t<perl fcls4releasenotes.pl --pdkname1=PDK_2.0.e --pdknb1=2.0.e>\n";
  1061 	print "\t<perl fcls4releasenotes.pl --pdkname1=PDK_2.0.e --pdknb2=2.0.e>\n";
   884 	print "\t<perl fcls4releasenotes.pl --pdknb1=2.0.d --pdknb2=2.0.e>\n";
  1062 	print "\t<perl fcls4releasenotes.pl --pdknb2=2.0.d --pdknb1=2.0.e>\n";
   885 	print "\t<perl fcls4releasenotes.pl help>\n";
  1063 	print "\t<perl fcls4releasenotes.pl help>\n";
   886 	#print "\t<perl fcls4releasenotes.pl validpdks>\n";
  1064 	#print "\t<perl fcls4releasenotes.pl validpdks>\n";
   887 	
  1065 	
   888 	list_pdks_at_default_location();
  1066 	list_pdks_at_default_location();
   889 	
  1067 	
   903 	# Extract all the PDKs that have the pattern PDK_
  1081 	# 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";
  1082 	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();
  1083 	extract_pdk_in_default_loc();
   906 	
  1084 	
   907 	# Extract all the PDKs that have the file build_BOM.zip
  1085 	# 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";
  1086 	print "All available PDKS in the default location $default_pdk_loc that contains the zip file $build_bom_zip_file_to_extract\n";
   909 	extract_pdk_with_valid_zip_in_default_loc();
  1087 	extract_pdk_with_valid_zip_in_default_loc();
   910 	
  1088 	
   911 }
  1089 }
   912 
  1090 
   913 # Generates list of directories in the default location used for the storage of the PDKs
  1091 # Generates list of directories in the default location used for the storage of the PDKs
   963 	my $path_to_find_zip = "";
  1141 	my $path_to_find_zip = "";
   964 	my @read_pdk_directory=();
  1142 	my @read_pdk_directory=();
   965 	
  1143 	
   966 	$nb_pdks_with_valid_zip_in_default_loc=0;
  1144 	$nb_pdks_with_valid_zip_in_default_loc=0;
   967 	
  1145 	
   968 	print "name_zip_file_to_extract=$name_zip_file_to_extract\n";
  1146 	print "build_bom_zip_file_to_extract=$build_bom_zip_file_to_extract\n";
   969 	
  1147 	
   970 	foreach $var1 (@pdk_dir_list_in_default_location)
  1148 	foreach $var1 (@pdk_dir_list_in_default_location)
   971 	{
  1149 	{
   972 		$path_to_find_zip=$default_pdk_loc;
  1150 		$path_to_find_zip=$default_pdk_loc;
   973 		
  1151 		
   979 		@read_pdk_directory = readdir(PDK_DIR);
  1157 		@read_pdk_directory = readdir(PDK_DIR);
   980 		close(PDK_DIR);
  1158 		close(PDK_DIR);
   981 	
  1159 	
   982 		foreach $var2 (@read_pdk_directory)
  1160 		foreach $var2 (@read_pdk_directory)
   983 		{
  1161 		{
   984 			if($var2 =~ /$name_zip_file_to_extract$/)
  1162 			if($var2 =~ /$build_bom_zip_file_to_extract$/)
   985 			{
  1163 			{
   986 				#print "$var2\n";
  1164 				#print "$var2\n";
   987 				$pdks_with_valid_zip_in_default_loc[$nb_pdks_with_valid_zip_in_default_loc++] = $var1;
  1165 				$pdks_with_valid_zip_in_default_loc[$nb_pdks_with_valid_zip_in_default_loc++] = $var1;
   988 			}
  1166 			}
   989 			#else
  1167 			#else
   990 			#{
  1168 			#{
   991 				#print "Doesn't contain $name_zip_file_to_extract!!!!\n";
  1169 				#print "Doesn't contain $build_bom_zip_file_to_extract!!!!\n";
   992 			#}
  1170 			#}
   993 		}
  1171 		}
   994 	}
  1172 	}
   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";	
  1173 	print "There is $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";	
   996 	
  1174 	
   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";
  1175 	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";
   998 	display_array_one_line_at_the_time(@pdks_with_valid_zip_in_default_loc);
  1176 	display_array_one_line_at_the_time(@pdks_with_valid_zip_in_default_loc);
   999 }
  1177 }
  1000 
  1178 
  1001 # Function created to pause the script to allow analysis and debug of the script.
  1179 # 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.
  1180 # Will require the user to press enter to carry on the execution of the script.
  1018 	print "\nfct: extract_packages_and_branch_type_from_file\n";
  1196 	print "\nfct: extract_packages_and_branch_type_from_file\n";
  1019 	
  1197 	
  1020 	print "$file_to_work_on\n";
  1198 	print "$file_to_work_on\n";
  1021 	
  1199 	
  1022 	my %local_hash_array;
  1200 	my %local_hash_array;
  1023 	#my @hash_array_to_display;
  1201 	#my @local_hash_array;
  1024 	my $local_key;
  1202 	my $local_key;
  1025 	
  1203 	
  1026 	my $package="";
  1204 	my $package="";
  1027 	my $type_of_branch="";
  1205 	my $type_of_branch="";
  1028 	
  1206 	
  1036 	my @local_array = <FILETOWORKON>;
  1214 	my @local_array = <FILETOWORKON>;
  1037 	#print "local_array= @local_array\n";
  1215 	#print "local_array= @local_array\n";
  1038 
  1216 
  1039 	# Close file
  1217 	# Close file
  1040 	close(FILETOWORKON);
  1218 	close(FILETOWORKON);
  1041 	
  1219 
       
  1220 
  1042 	my $extracted_line;
  1221 	my $extracted_line;
  1043 	
  1222 	
  1044 	# Go line by line
  1223 	# Go line by line
  1045 	foreach  $extracted_line (@local_array)
  1224 	foreach  $extracted_line (@local_array)
  1046 	{
  1225 	{
  1075 				# Decode the package because there is a branch type in the line extracted!
  1254 				# Decode the package because there is a branch type in the line extracted!
  1076 				if ($extracted_line =~ m,$package_extraction_pattern,)
  1255 				if ($extracted_line =~ m,$package_extraction_pattern,)
  1077 				{
  1256 				{
  1078 					$package=$1;					
  1257 					$package=$1;					
  1079 				}
  1258 				}
  1080 					#print "package is $package and type_of_branch is $type_of_branch\n";
  1259 				#print "package is $package and type_of_branch is $type_of_branch\n";
  1081 					$local_hash_array{$package}=$type_of_branch;
  1260 				$local_hash_array{$package}=$type_of_branch;
       
  1261 				
  1082 			}
  1262 			}
  1083 			else
  1263 			else
  1084 			{
  1264 			{
  1085 				#print "The extracted line doesn't contain $look_for_mcl or $look_for_fcl, therefore we need to skip it!\n";
  1265 				#print "The extracted line doesn't contain $look_for_mcl or $look_for_fcl, therefore we need to skip it!\n";
  1086 			}
  1266 			}
  1101 	
  1281 	
  1102 	# Return hash array containing all the packages and branch type associated
  1282 	# Return hash array containing all the packages and branch type associated
  1103 	return (%local_hash_array);
  1283 	return (%local_hash_array);
  1104 }
  1284 }
  1105 
  1285 
       
  1286 # Function used to extract all the data from the csv file about the different packages (name, path and real name)
       
  1287 sub extract_package_detail
       
  1288 {
       
  1289 	# 1 Parameters passed, the path to the file to be viewed
       
  1290 	my ($file_to_work_on) = @_;
       
  1291 	
       
  1292 	print "\nfct: extract_package_detail\n";
       
  1293 	
       
  1294 	print "$file_to_work_on\n";
       
  1295 	
       
  1296 	my @local_array;
       
  1297 	
       
  1298 	# Open file
       
  1299 	open(FILETOWORKON , $file_to_work_on);
       
  1300 
       
  1301 	# Extract data from file
       
  1302 	my @local_array = <FILETOWORKON>;
       
  1303 	#print "build_bom_local_array= @build_bom_local_array\n";
       
  1304 
       
  1305 	# Close file
       
  1306 	close(FILETOWORKON);
       
  1307 
       
  1308 	my $extracted_line;
       
  1309 
       
  1310 	# Create a table with the path for each package using a hash array
       
  1311 	my $pckg_name_extraction_pattern = "^sf\/[\\w]*\/([\\w]*)";
       
  1312 	my $pckg_path_extraction_pattern = "^(sf[\W\w]*[^,]+),";
       
  1313 	my $pckg_real_name_extraction_pattern = ",[\\s]+([\\w\\s]*),[\\s]+[\\w\\s]*\$";
       
  1314 	my $pckg_name="";
       
  1315 	my $pckg_path="";
       
  1316 	my $pckg_real_name="";
       
  1317 	
       
  1318 	#Typical lines to decode
       
  1319 	#sf/app/helps,SFL,sf/app/helps/symhelp/helpmodel/group/bld.inf,OK, Help Apps, Help
       
  1320 	#sf/app/java,SFL,sf/app/java/java_plat/group/bld.inf,OK, , 
       
  1321 	#sf/app/helps,SFL,sf/app/helps/symhelp/helpmodel/group/bld.inf,OK, Help Apps, Help
       
  1322 	#sf/app/helps,
       
  1323 	#SFL,
       
  1324 	#sf/app/helps/symhelp/helpmodel/group/bld.inf,
       
  1325 	#OK,
       
  1326 	# Help Apps,
       
  1327 	# Help
       
  1328 	
       
  1329 	#sf/app/java,SFL,sf/app/java/java_plat/group/bld.inf,OK, , 
       
  1330 	#sf/app/java,
       
  1331 	#SFL,
       
  1332 	#sf/app/java/java_plat/group/bld.inf,
       
  1333 	#OK,
       
  1334 	# ,
       
  1335 	#
       
  1336 	
       
  1337 	# Go line by line
       
  1338 		
       
  1339 	foreach  $extracted_line (@local_array)
       
  1340 	{
       
  1341 		#print "\nextracted_line is: $extracted_line"; # no need to add \\n as it's part of the line displayed.
       
  1342 		
       
  1343 		if($extracted_line =~ m;$pckg_name_extraction_pattern;)
       
  1344 		{
       
  1345 			$pckg_name = $1;
       
  1346 			#print "Pckg name is: $pckg_name\n";
       
  1347 			
       
  1348 			#print "Is $pckg_name already exist in the hash array?: $pckg_path_name_array{$pckg_name}\n";
       
  1349 
       
  1350 			if(!$pckg_path_name_array{$pckg_name})	# Check if package is not already in the table to avoid duplicates
       
  1351 			{
       
  1352 				#print "$pckg_name is not in the hash array, we need to add it\n";
       
  1353 				if($extracted_line =~ m;$pckg_path_extraction_pattern;)
       
  1354 				{
       
  1355 					$pckg_path = $1;
       
  1356 					#print "Pckg path is: $pckg_path\n";
       
  1357 				}
       
  1358 				if($extracted_line =~ m;$pckg_real_name_extraction_pattern;)
       
  1359 				{
       
  1360 					$pckg_real_name = $1;
       
  1361 					#print "Pckg real name is: $pckg_real_name\n";
       
  1362 				}
       
  1363 				# fill the tables
       
  1364 				$pckg_path_name_array{$pckg_name} = $pckg_path;
       
  1365 				$pckg_name_array{$pckg_name} = $pckg_real_name;
       
  1366 			}
       
  1367 		}
       
  1368 	}
       
  1369 	
       
  1370 	my $local_value="";
       
  1371 	my @local_array_sorted;
       
  1372 	
       
  1373 	@local_array=keys (%pckg_path_name_array);
       
  1374 	@local_array_sorted = sort { lc($a) cmp lc($b) } @local_array;
       
  1375 
       
  1376 #	print "\n";
       
  1377 #	my $counter_to_remove=0;
       
  1378 #	foreach $local_value (@local_array_sorted)
       
  1379 #	{
       
  1380 		#print "$counter_to_remove: The path for package $local_value is: $pckg_path_name_array{$local_value}\n";
       
  1381 		#print "$counter_to_remove:The real name for package $local_value is: $pckg_name_array{$local_value}\n";
       
  1382 		#print "$counter_to_remove: local_array_sorted[$counter_to_remove]:$local_array_sorted[$counter_to_remove]\n";
       
  1383 		#print "$local_array_sorted[$counter_to_remove]\n";
       
  1384 		#$counter_to_remove++;		
       
  1385 #	}	
       
  1386 }
       
  1387 
       
  1388 # Function used to display one line at the time for an array				
  1106 sub display_array_one_line_at_the_time
  1389 sub display_array_one_line_at_the_time
  1107 {
  1390 {
  1108 	my (@table_to_display_one_line_at_the_time) = @_;
  1391 	my (@table_to_display_one_line_at_the_time) = @_;
  1109 	
  1392 	
  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.
  1393 	#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.
  1112 	my $line_to_display;	
  1395 	my $line_to_display;	
  1113 	
  1396 	
  1114 	foreach $line_to_display (@table_to_display_one_line_at_the_time)
  1397 	foreach $line_to_display (@table_to_display_one_line_at_the_time)
  1115 	{
  1398 	{
  1116 		print "$line_to_display\n";
  1399 		print "$line_to_display\n";
       
  1400 	}
       
  1401 }
       
  1402 
       
  1403 # Function used to display one line at the time for an hash array
       
  1404 sub display_hash_array_one_line_at_the_time
       
  1405 {
       
  1406 	my (%hash_array_to_display_one_line_at_the_time) = @_;
       
  1407 	
       
  1408 	my @local_keys_array;
       
  1409 	my @local_keys_array_sorted;
       
  1410 	
       
  1411 	#print "\nfct: display_hash_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.
       
  1412 	
       
  1413 	my $line_to_display;
       
  1414 	
       
  1415 	@local_keys_array = keys (%hash_array_to_display_one_line_at_the_time);
       
  1416 	@local_keys_array_sorted = sort { lc($a) cmp lc($b) } @local_keys_array;
       
  1417 	
       
  1418 	foreach $line_to_display (@local_keys_array_sorted)
       
  1419 	{
       
  1420 		print "$line_to_display = $hash_array_to_display_one_line_at_the_time{$line_to_display}\n";
  1117 	}
  1421 	}
  1118 }
  1422 }
  1119 
  1423 
  1120 # PDKs with build_bom.zip file in the default PDKs location 14-09-2009
  1424 # PDKs with build_bom.zip file in the default PDKs location 14-09-2009
  1121 #Z:\Releases\PDK_2.0.e
  1425 #Z:\Releases\PDK_2.0.e