update to gettd.pl including a count option see -h for more info
authorvictorp@symbian.org
Mon, 04 Jan 2010 16:00:55 +0000
changeset 25 48be12a54405
parent 24 9f3ba8091f46
child 26 53beda6ce2c3
update to gettd.pl including a count option see -h for more info
scripts/gettd.pl
--- a/scripts/gettd.pl	Mon Dec 21 12:33:47 2009 +0000
+++ b/scripts/gettd.pl	Mon Jan 04 16:00:55 2010 +0000
@@ -12,7 +12,7 @@
 my $authon= '';	 #does it require authorisation? default is false
 
 
-
+my $count_target; #this value is used to pass a string to match and count on each package backlog
 my $ispackage;
 my $splitbklogs;
 my $summaryheader="ID\tPackage\tFeatures\tFormat\tHttp\n" ;
@@ -257,6 +257,7 @@
 	$mypkg=loadfile $infile;
 	#list if the bklog has been ported to the new bugzilla based format
   $headerformat= "wiki_format";
+  
 	
 	open ( outputfile, ">>".$outfile);
 	open ( soutputfile, ">>"."summary_".$outfile);
@@ -282,6 +283,8 @@
     }
 		print "INFO -Processing Package $pagename \n";
 		$i=0;
+		$found_counter =0;
+		
 		if ($mypkg =~m/class\=\"bugzilla sortable\"/sg ) { $headerformat="autobug_format"; }
 		
 		while ($mypkg =~ m/\<tr.*?\>(.*?)\<\/tr/sg) { 
@@ -303,16 +306,23 @@
 				print outputfile "$pagename\t$myfeat\n";
 				if ($splitbklogs) { print tdoutputfile "$pagename\t$myfeat\n";}
         
+      #  print "matching $myfeat with $count_target\n"    ;
+        if ($myfeat =~ m/$count_target/sg) {$found_counter++;}
         $i++;
 			}
 			
 		}
-
+  
+  if ($count_target){
+    $mycount=$i."\t".$found_counter;
+  } else {
+    $mycount=$i;
+  }
 	
 	if ($splitbklogs) { 
-    print soutputfile "$id\t$pagename\t$i\t$headerformat\t$whichtd\thttp://developer.symbian.org/wiki/index.php/$pagename\n";
+    print soutputfile "$id\t$pagename\t$mycount\t$headerformat\t$whichtd\thttp://developer.symbian.org/wiki/index.php/$pagename\n";
 	} else {
-    print soutputfile "$id\t$pagename\t$i\t$headerformat\thttp://developer.symbian.org/wiki/index.php/$pagename\n";
+    print soutputfile "$id\t$pagename\t$mycount\t$headerformat\thttp://developer.symbian.org/wiki/index.php/$pagename\n";
   }
 
 	}
@@ -336,6 +346,7 @@
   \n\nRequired Parameters for Package backlogs\n\t-p for package backlog analysis. just run gettd.pl -p
   \n\nOptional Pararmeters for Package backlogs\n\t -compare [f1] [f2] compares two package summary files for changes ignores order
   \n\t -split splits the content of the backlog output into technology domains. requires package_domains.csv file with mapping details
+  \n\t -count=regexp counts the times that a package backlog line matches the regexp, the results are output to the summary file
   \n\nCommonOptional parameters\n\t-o filename ,the output is logged into the output.csv file by default\n\t-h for help
 	\n\t recommend to run under cygwin environment and perl version v5.10.0 \n
   \n\t pages blacklisted for package backlogs are @blist\n";
@@ -379,12 +390,15 @@
 
   GetOptions('h' => \$help,'t=s'=> \$target_url, 'd=s' => \$tdomain , 'o=s' => \$csvfile, 
 	'a' => \$authon , 'p' => \$ispackage, 'compare=s{2}' =>\@compare, 'new' => \$isnewformat,
-   'split' => \$splitbklogs);
+   'split' => \$splitbklogs, 'count=s' => \$count_target);
 
   if (@compare) {
 	compare_bklogs @compare;
 	
   }
+  if ($count_target) {
+    print "INFO - Seaching for $count_target\n";
+  }
 
   if ($help) {
     printhelp;