scripts/gettd.pl
changeset 5 cb5ea404d492
parent 4 98b4ffa15936
child 6 2ac7d35ac201
--- a/scripts/gettd.pl	Fri Oct 30 09:09:10 2009 +0000
+++ b/scripts/gettd.pl	Fri Oct 30 15:34:26 2009 +0000
@@ -11,10 +11,14 @@
 my $csvfile; #output csv file name
 my $authon= '';	 #does it require authorisation? default is false
 
+
+
 my $ispackage;
+my $splitbklogs;
 my $summaryheader="ID\tPackage\tFeatures\tFormat\tHttp\n" ;
 my $newtdformat = 0;
-my @blist = ("Tracking_Package_features","PoC_roadmap","Kernel_EPLization_Backlog","Package_Backlog_Q","Wishlist");
+my @blist = ("Tracking_Package_features","Kernel_EPLization_Backlog",
+    "Package_Backlog_Q","Wishlist","Test_Package");
 
 
 sub blacklist
@@ -230,6 +234,22 @@
 	return @mylink;
 }
 
+sub bklog_domain {
+ #argument
+($mytechdomian)=@_;
+
+  $mytechdomian =~s/\)//sg;
+  $mytechdomian =~s/\(//sg;
+  
+ $domaininfo=loadfile ("package_domains.csv");
+ if ($domaininfo =~ m/$mytechdomian.*?\{(.*?)\}/sgi ) {
+      return $1;
+ }
+  print "ERROR - domain not found for $mytechdomian\n";
+  return "orphan";
+ 
+}
+
 sub parse_bklog {
 	
 	#arguments
@@ -244,11 +264,20 @@
 	if ($mypkg =~ m/index\.php\/(.*?) HTTP/sg) {
   
 		$pagename = $1;
-		if (blacklist($pagename)) {
+		
+    if ($splitbklogs) {
+      $whichtd =  bklog_domain($pagename);
+      open ( tdoutputfile, ">>".$whichtd. "_".$outfile);
+     }
+    
+    
+    
+    if (blacklist($pagename)) {
        
     	  close (outputfile);
 	      close (soutputfile);
-	      close (houtputfile);
+	    
+	      if ($splitbklogs) { close (tdoutputfile);}
         return 0;
     }
 		print "INFO -Processing Package $pagename \n";
@@ -270,20 +299,24 @@
 			if ($myfeat =~ m/[A-z]/sg and not $myfeat =~ m/\&lt\;etc/sg and 
 			not $myfeat =~ m/\&lt\;Feature/sg and not $myfeat =~ m/Item not available/sg) {
 				print outputfile "$pagename\t$myfeat\n";
-				$i++;
+				if ($splitbklogs) { print tdoutputfile "$pagename\t$myfeat\n";}
+        
+        $i++;
 			}
 			
 		}
 
 	print soutputfile "$id\t$pagename\t$i\t$headerformat\thttp://developer.symbian.org/wiki/index.php/$pagename\n";
-	
+	if ($splitbklogs) { 
+    print soutputfile "$id\t$pagename\t$i\t$headerformat\t$whichtd\thttp://developer.symbian.org/wiki/index.php/$pagename\n";
+	}
 
 	}
 
 	close (outputfile);
 	close (soutputfile);
-
-
+  if ($splitbklogs) { close (tdoutputfile);}
+                           
 }
 
 
@@ -292,12 +325,13 @@
 #help print
 sub printhelp
 {
-
-	print "\n\n version 1.0
+       
+	print "\n\n version 1.1
 	\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
 	\n\nOptional Parmeters for Technology Roadmaps\n\t-new if the roadmap has the new wiki format
   \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\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";
@@ -340,7 +374,8 @@
 
 
   GetOptions('h' => \$help,'t=s'=> \$target_url, 'd=s' => \$tdomain , 'o=s' => \$csvfile, 
-	'a' => \$authon , 'p' => \$ispackage, 'compare=s{2}' =>\@compare, 'new' => \$isnewformat);
+	'a' => \$authon , 'p' => \$ispackage, 'compare=s{2}' =>\@compare, 'new' => \$isnewformat,
+   'split' => \$splitbklogs);
 
   if (@compare) {
 	compare_bklogs @compare;