scripts/gettd.pl
changeset 25 48be12a54405
parent 22 d2ecfdaf0f31
child 28 ab800b3e45ab
equal deleted inserted replaced
24:9f3ba8091f46 25:48be12a54405
    10 my $tdomain; #tag for the domain to be use in csv file
    10 my $tdomain; #tag for the domain to be use in csv file
    11 my $csvfile; #output csv file name
    11 my $csvfile; #output csv file name
    12 my $authon= '';	 #does it require authorisation? default is false
    12 my $authon= '';	 #does it require authorisation? default is false
    13 
    13 
    14 
    14 
    15 
    15 my $count_target; #this value is used to pass a string to match and count on each package backlog
    16 my $ispackage;
    16 my $ispackage;
    17 my $splitbklogs;
    17 my $splitbklogs;
    18 my $summaryheader="ID\tPackage\tFeatures\tFormat\tHttp\n" ;
    18 my $summaryheader="ID\tPackage\tFeatures\tFormat\tHttp\n" ;
    19 my $newtdformat = 0;
    19 my $newtdformat = 0;
    20 my @blist = ("Tracking_Package_features","Kernel_EPLization_Backlog",
    20 my @blist = ("Tracking_Package_features","Kernel_EPLization_Backlog",
   255 	#arguments
   255 	#arguments
   256 	($infile,$outfile,$id)=@_;
   256 	($infile,$outfile,$id)=@_;
   257 	$mypkg=loadfile $infile;
   257 	$mypkg=loadfile $infile;
   258 	#list if the bklog has been ported to the new bugzilla based format
   258 	#list if the bklog has been ported to the new bugzilla based format
   259   $headerformat= "wiki_format";
   259   $headerformat= "wiki_format";
       
   260   
   260 	
   261 	
   261 	open ( outputfile, ">>".$outfile);
   262 	open ( outputfile, ">>".$outfile);
   262 	open ( soutputfile, ">>"."summary_".$outfile);
   263 	open ( soutputfile, ">>"."summary_".$outfile);
   263 	
   264 	
   264 	if ($mypkg =~ m/index\.php\/(.*?) HTTP/sg) {
   265 	if ($mypkg =~ m/index\.php\/(.*?) HTTP/sg) {
   280 	      if ($splitbklogs) { close (tdoutputfile);}
   281 	      if ($splitbklogs) { close (tdoutputfile);}
   281         return 0;
   282         return 0;
   282     }
   283     }
   283 		print "INFO -Processing Package $pagename \n";
   284 		print "INFO -Processing Package $pagename \n";
   284 		$i=0;
   285 		$i=0;
       
   286 		$found_counter =0;
       
   287 		
   285 		if ($mypkg =~m/class\=\"bugzilla sortable\"/sg ) { $headerformat="autobug_format"; }
   288 		if ($mypkg =~m/class\=\"bugzilla sortable\"/sg ) { $headerformat="autobug_format"; }
   286 		
   289 		
   287 		while ($mypkg =~ m/\<tr.*?\>(.*?)\<\/tr/sg) { 
   290 		while ($mypkg =~ m/\<tr.*?\>(.*?)\<\/tr/sg) { 
   288 			$myheader= $&;
   291 			$myheader= $&;
   289       if ($myheader =~ m/style=\"background-color\:/sg) {
   292       if ($myheader =~ m/style=\"background-color\:/sg) {
   301 			if ($myfeat =~ m/[A-z]/sg and not $myfeat =~ m/\&lt\;etc/sg and 
   304 			if ($myfeat =~ m/[A-z]/sg and not $myfeat =~ m/\&lt\;etc/sg and 
   302 			not $myfeat =~ m/\&lt\;Feature/sg and not $myfeat =~ m/Item not available/sg) {
   305 			not $myfeat =~ m/\&lt\;Feature/sg and not $myfeat =~ m/Item not available/sg) {
   303 				print outputfile "$pagename\t$myfeat\n";
   306 				print outputfile "$pagename\t$myfeat\n";
   304 				if ($splitbklogs) { print tdoutputfile "$pagename\t$myfeat\n";}
   307 				if ($splitbklogs) { print tdoutputfile "$pagename\t$myfeat\n";}
   305         
   308         
       
   309       #  print "matching $myfeat with $count_target\n"    ;
       
   310         if ($myfeat =~ m/$count_target/sg) {$found_counter++;}
   306         $i++;
   311         $i++;
   307 			}
   312 			}
   308 			
   313 			
   309 		}
   314 		}
   310 
   315   
       
   316   if ($count_target){
       
   317     $mycount=$i."\t".$found_counter;
       
   318   } else {
       
   319     $mycount=$i;
       
   320   }
   311 	
   321 	
   312 	if ($splitbklogs) { 
   322 	if ($splitbklogs) { 
   313     print soutputfile "$id\t$pagename\t$i\t$headerformat\t$whichtd\thttp://developer.symbian.org/wiki/index.php/$pagename\n";
   323     print soutputfile "$id\t$pagename\t$mycount\t$headerformat\t$whichtd\thttp://developer.symbian.org/wiki/index.php/$pagename\n";
   314 	} else {
   324 	} else {
   315     print soutputfile "$id\t$pagename\t$i\t$headerformat\thttp://developer.symbian.org/wiki/index.php/$pagename\n";
   325     print soutputfile "$id\t$pagename\t$mycount\t$headerformat\thttp://developer.symbian.org/wiki/index.php/$pagename\n";
   316   }
   326   }
   317 
   327 
   318 	}
   328 	}
   319 
   329 
   320 	close (outputfile);
   330 	close (outputfile);
   334 	\ngettd.pl -t=url -d=domain \n\nRequired parameters for Technology Roadmaps:\n\t -t url containing the technology domain roadmap\n\t -d the technology domain name
   344 	\ngettd.pl -t=url -d=domain \n\nRequired parameters for Technology Roadmaps:\n\t -t url containing the technology domain roadmap\n\t -d the technology domain name
   335 	\n\nOptional Parmeters for Technology Roadmaps\n\t-new if the roadmap has the new wiki format
   345 	\n\nOptional Parmeters for Technology Roadmaps\n\t-new if the roadmap has the new wiki format
   336   \n\nRequired Parameters for Package backlogs\n\t-p for package backlog analysis. just run gettd.pl -p
   346   \n\nRequired Parameters for Package backlogs\n\t-p for package backlog analysis. just run gettd.pl -p
   337   \n\nOptional Pararmeters for Package backlogs\n\t -compare [f1] [f2] compares two package summary files for changes ignores order
   347   \n\nOptional Pararmeters for Package backlogs\n\t -compare [f1] [f2] compares two package summary files for changes ignores order
   338   \n\t -split splits the content of the backlog output into technology domains. requires package_domains.csv file with mapping details
   348   \n\t -split splits the content of the backlog output into technology domains. requires package_domains.csv file with mapping details
       
   349   \n\t -count=regexp counts the times that a package backlog line matches the regexp, the results are output to the summary file
   339   \n\nCommonOptional parameters\n\t-o filename ,the output is logged into the output.csv file by default\n\t-h for help
   350   \n\nCommonOptional parameters\n\t-o filename ,the output is logged into the output.csv file by default\n\t-h for help
   340 	\n\t recommend to run under cygwin environment and perl version v5.10.0 \n
   351 	\n\t recommend to run under cygwin environment and perl version v5.10.0 \n
   341   \n\t pages blacklisted for package backlogs are @blist\n";
   352   \n\t pages blacklisted for package backlogs are @blist\n";
   342 	exit;
   353 	exit;
   343 }
   354 }
   377   my @compare;
   388   my @compare;
   378 
   389 
   379 
   390 
   380   GetOptions('h' => \$help,'t=s'=> \$target_url, 'd=s' => \$tdomain , 'o=s' => \$csvfile, 
   391   GetOptions('h' => \$help,'t=s'=> \$target_url, 'd=s' => \$tdomain , 'o=s' => \$csvfile, 
   381 	'a' => \$authon , 'p' => \$ispackage, 'compare=s{2}' =>\@compare, 'new' => \$isnewformat,
   392 	'a' => \$authon , 'p' => \$ispackage, 'compare=s{2}' =>\@compare, 'new' => \$isnewformat,
   382    'split' => \$splitbklogs);
   393    'split' => \$splitbklogs, 'count=s' => \$count_target);
   383 
   394 
   384   if (@compare) {
   395   if (@compare) {
   385 	compare_bklogs @compare;
   396 	compare_bklogs @compare;
   386 	
   397 	
       
   398   }
       
   399   if ($count_target) {
       
   400     print "INFO - Seaching for $count_target\n";
   387   }
   401   }
   388 
   402 
   389   if ($help) {
   403   if ($help) {
   390     printhelp;
   404     printhelp;
   391   }
   405   }