scripts/gettd.pl
changeset 5 cb5ea404d492
parent 4 98b4ffa15936
child 6 2ac7d35ac201
equal deleted inserted replaced
4:98b4ffa15936 5:cb5ea404d492
     9 my $target_url; #target url for the roadmap
     9 my $target_url; #target url for the roadmap
    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 
       
    15 
    14 my $ispackage;
    16 my $ispackage;
       
    17 my $splitbklogs;
    15 my $summaryheader="ID\tPackage\tFeatures\tFormat\tHttp\n" ;
    18 my $summaryheader="ID\tPackage\tFeatures\tFormat\tHttp\n" ;
    16 my $newtdformat = 0;
    19 my $newtdformat = 0;
    17 my @blist = ("Tracking_Package_features","PoC_roadmap","Kernel_EPLization_Backlog","Package_Backlog_Q","Wishlist");
    20 my @blist = ("Tracking_Package_features","Kernel_EPLization_Backlog",
       
    21     "Package_Backlog_Q","Wishlist","Test_Package");
    18 
    22 
    19 
    23 
    20 sub blacklist
    24 sub blacklist
    21 {
    25 {
    22  ($name)=@_;
    26  ($name)=@_;
   228 	print "INFO - Found $i items in the category page\n"
   232 	print "INFO - Found $i items in the category page\n"
   229 	}
   233 	}
   230 	return @mylink;
   234 	return @mylink;
   231 }
   235 }
   232 
   236 
       
   237 sub bklog_domain {
       
   238  #argument
       
   239 ($mytechdomian)=@_;
       
   240 
       
   241   $mytechdomian =~s/\)//sg;
       
   242   $mytechdomian =~s/\(//sg;
       
   243   
       
   244  $domaininfo=loadfile ("package_domains.csv");
       
   245  if ($domaininfo =~ m/$mytechdomian.*?\{(.*?)\}/sgi ) {
       
   246       return $1;
       
   247  }
       
   248   print "ERROR - domain not found for $mytechdomian\n";
       
   249   return "orphan";
       
   250  
       
   251 }
       
   252 
   233 sub parse_bklog {
   253 sub parse_bklog {
   234 	
   254 	
   235 	#arguments
   255 	#arguments
   236 	($infile,$outfile,$id)=@_;
   256 	($infile,$outfile,$id)=@_;
   237 	$mypkg=loadfile $infile;
   257 	$mypkg=loadfile $infile;
   242 	open ( soutputfile, ">>"."summary_".$outfile);
   262 	open ( soutputfile, ">>"."summary_".$outfile);
   243 	
   263 	
   244 	if ($mypkg =~ m/index\.php\/(.*?) HTTP/sg) {
   264 	if ($mypkg =~ m/index\.php\/(.*?) HTTP/sg) {
   245   
   265   
   246 		$pagename = $1;
   266 		$pagename = $1;
   247 		if (blacklist($pagename)) {
   267 		
       
   268     if ($splitbklogs) {
       
   269       $whichtd =  bklog_domain($pagename);
       
   270       open ( tdoutputfile, ">>".$whichtd. "_".$outfile);
       
   271      }
       
   272     
       
   273     
       
   274     
       
   275     if (blacklist($pagename)) {
   248        
   276        
   249     	  close (outputfile);
   277     	  close (outputfile);
   250 	      close (soutputfile);
   278 	      close (soutputfile);
   251 	      close (houtputfile);
   279 	    
       
   280 	      if ($splitbklogs) { close (tdoutputfile);}
   252         return 0;
   281         return 0;
   253     }
   282     }
   254 		print "INFO -Processing Package $pagename \n";
   283 		print "INFO -Processing Package $pagename \n";
   255 		$i=0;
   284 		$i=0;
   256 		if ($mypkg =~m/class\=\"bugzilla sortable\"/sg ) { $headerformat="autobug_format"; }
   285 		if ($mypkg =~m/class\=\"bugzilla sortable\"/sg ) { $headerformat="autobug_format"; }
   268 			
   297 			
   269 			
   298 			
   270 			if ($myfeat =~ m/[A-z]/sg and not $myfeat =~ m/\&lt\;etc/sg and 
   299 			if ($myfeat =~ m/[A-z]/sg and not $myfeat =~ m/\&lt\;etc/sg and 
   271 			not $myfeat =~ m/\&lt\;Feature/sg and not $myfeat =~ m/Item not available/sg) {
   300 			not $myfeat =~ m/\&lt\;Feature/sg and not $myfeat =~ m/Item not available/sg) {
   272 				print outputfile "$pagename\t$myfeat\n";
   301 				print outputfile "$pagename\t$myfeat\n";
   273 				$i++;
   302 				if ($splitbklogs) { print tdoutputfile "$pagename\t$myfeat\n";}
       
   303         
       
   304         $i++;
   274 			}
   305 			}
   275 			
   306 			
   276 		}
   307 		}
   277 
   308 
   278 	print soutputfile "$id\t$pagename\t$i\t$headerformat\thttp://developer.symbian.org/wiki/index.php/$pagename\n";
   309 	print soutputfile "$id\t$pagename\t$i\t$headerformat\thttp://developer.symbian.org/wiki/index.php/$pagename\n";
   279 	
   310 	if ($splitbklogs) { 
       
   311     print soutputfile "$id\t$pagename\t$i\t$headerformat\t$whichtd\thttp://developer.symbian.org/wiki/index.php/$pagename\n";
       
   312 	}
   280 
   313 
   281 	}
   314 	}
   282 
   315 
   283 	close (outputfile);
   316 	close (outputfile);
   284 	close (soutputfile);
   317 	close (soutputfile);
   285 
   318   if ($splitbklogs) { close (tdoutputfile);}
   286 
   319                            
   287 }
   320 }
   288 
   321 
   289 
   322 
   290 
   323 
   291 
   324 
   292 #help print
   325 #help print
   293 sub printhelp
   326 sub printhelp
   294 {
   327 {
   295 
   328        
   296 	print "\n\n version 1.0
   329 	print "\n\n version 1.1
   297 	\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
   330 	\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
   298 	\n\nOptional Parmeters for Technology Roadmaps\n\t-new if the roadmap has the new wiki format
   331 	\n\nOptional Parmeters for Technology Roadmaps\n\t-new if the roadmap has the new wiki format
   299   \n\nRequired Parameters for Package backlogs\n\t-p for package backlog analysis. just run gettd.pl -p
   332   \n\nRequired Parameters for Package backlogs\n\t-p for package backlog analysis. just run gettd.pl -p
   300   \n\nOptional Pararmeters for Package backlogs\n\t -compare [f1] [f2] compares two package summary files for changes ignores order
   333   \n\nOptional Pararmeters for Package backlogs\n\t -compare [f1] [f2] compares two package summary files for changes ignores order
       
   334   \n\t -split splits the content of the backlog output into technology domains. requires package_domains.csv file with mapping details
   301   \n\nCommonOptional parameters\n\t-o filename ,the output is logged into the output.csv file by default\n\t-h for help
   335   \n\nCommonOptional parameters\n\t-o filename ,the output is logged into the output.csv file by default\n\t-h for help
   302 	\n\t recommend to run under cygwin environment and perl version v5.10.0 \n
   336 	\n\t recommend to run under cygwin environment and perl version v5.10.0 \n
   303   \n\t pages blacklisted for package backlogs are @blist\n";
   337   \n\t pages blacklisted for package backlogs are @blist\n";
   304 	exit;
   338 	exit;
   305 }
   339 }
   338   my $help;
   372   my $help;
   339   my @compare;
   373   my @compare;
   340 
   374 
   341 
   375 
   342   GetOptions('h' => \$help,'t=s'=> \$target_url, 'd=s' => \$tdomain , 'o=s' => \$csvfile, 
   376   GetOptions('h' => \$help,'t=s'=> \$target_url, 'd=s' => \$tdomain , 'o=s' => \$csvfile, 
   343 	'a' => \$authon , 'p' => \$ispackage, 'compare=s{2}' =>\@compare, 'new' => \$isnewformat);
   377 	'a' => \$authon , 'p' => \$ispackage, 'compare=s{2}' =>\@compare, 'new' => \$isnewformat,
       
   378    'split' => \$splitbklogs);
   344 
   379 
   345   if (@compare) {
   380   if (@compare) {
   346 	compare_bklogs @compare;
   381 	compare_bklogs @compare;
   347 	
   382 	
   348   }
   383   }