tdroadmap_merger/gettd.pl
changeset 31 d1d21a2aeabc
parent 27 7dccd04e54f9
child 32 9cd541fe26d1
equal deleted inserted replaced
30:cf4bd27a8280 31:d1d21a2aeabc
    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 my $ispackage;
    14 my $ispackage;
    15 
    15 my $summaryheader="ID\tPackage\tFeatures\tFormat\tHttp\n" ;
    16 
    16 
    17 sub getpage
    17 sub getpage
    18 {
    18 {
    19 	#arguments
    19 	#arguments
    20 	($page,$host,$auth,$myfile)=@_;
    20 	($page,$host,$auth,$myfile)=@_;
   176 sub parse_bklog {
   176 sub parse_bklog {
   177 	
   177 	
   178 	#arguments
   178 	#arguments
   179 	($infile,$outfile,$id)=@_;
   179 	($infile,$outfile,$id)=@_;
   180 	$mypkg=loadfile $infile;
   180 	$mypkg=loadfile $infile;
       
   181 	#list if the bklog has been ported to the new bugzilla based format
       
   182   $headerformat= "wiki_format";
       
   183 	
   181 	open ( outputfile, ">>".$outfile);
   184 	open ( outputfile, ">>".$outfile);
   182 	open ( soutputfile, ">>"."summary_".$outfile);
   185 	open ( soutputfile, ">>"."summary_".$outfile);
   183 	
   186 	
   184 	if ($mypkg =~ m/index\.php\/(.*?) HTTP/sg) {
   187 	if ($mypkg =~ m/index\.php\/(.*?) HTTP/sg) {
   185   
   188   
   186 		$pagename = $1;
   189 		$pagename = $1;
   187 		print "INFO -Processing Package $pagename \n";
   190 		print "INFO -Processing Package $pagename \n";
   188 		$i=0;
   191 		$i=0;
   189 		
   192 		
   190 		while ($mypkg =~ m/\<tr.*?\>(.*?)\<\/tr/sg) {
   193 		while ($mypkg =~ m/\<tr.*?\>(.*?)\<\/tr/sg) {
   191 			next if ($& =~ m/style=\"background-color\:/s);
   194 			$myheader= $&;
       
   195       if ($myheader =~ m/style=\"background-color\:/sg) {
       
   196         if ($myheader =~ m/Bug ID/sg) { $headerformat="bugzilla_format";}
       
   197         next;
       
   198       }
   192 			$myfeat= $1;
   199 			$myfeat= $1;
   193 			$myfeat =~ s/\<\/td\>/\t/sg;
   200 			$myfeat =~ s/\<\/td\>/\t/sg;
   194 			$myfeat =~ s/\<.*?\>//sg;
   201 			$myfeat =~ s/\<.*?\>//sg;
   195 			$myfeat =~ s/\n//sg;
   202 			$myfeat =~ s/\n//sg;
   196 			
   203 			
   201 				$i++;
   208 				$i++;
   202 			}
   209 			}
   203 			
   210 			
   204 		}
   211 		}
   205 
   212 
   206 	print soutputfile "$id\t$pagename\t$i\thttp://developer.symbian.org/wiki/index.php/$pagename\n";
   213 	print soutputfile "$id\t$pagename\t$i\t$headerformat\thttp://developer.symbian.org/wiki/index.php/$pagename\n";
   207 	
   214 	
   208 
   215 
   209 	}
   216 	}
   210 
   217 
   211 	close (outputfile);
   218 	close (outputfile);
   219 
   226 
   220 #help print
   227 #help print
   221 sub printhelp
   228 sub printhelp
   222 {
   229 {
   223 
   230 
   224 	print "\n\n version 0.5 
   231 	print "\n\n version 0.5
   225 	\ngettd.pl -t=url -d=domain \n\nrequired parameters:\n\t -t url containing the technology domain roadmap\n\t -d the technology domain name
   232 	\ngettd.pl -t=url -d=domain \n\nrequired parameters:\n\t -t url containing the technology domain roadmap\n\t -d the technology domain name
   226 	\n\nOptional parameters\n\t-o filename ,the output is logged into the output.csv file by default\n\t-h for help
   233 	\n\nOptional parameters\n\t-o filename ,the output is logged into the output.csv file by default\n\t-h for help
   227 	\n\t-a setup authorisation by cookie follow instructions \n\tin http://developer.symbian.org/wiki/index.php/Roadmap_merger_script#Cookies
   234 	\n\t-a setup authorisation by cookie follow instructions \n\tin http://developer.symbian.org/wiki/index.php/Roadmap_merger_script#Cookies
   228 	\n\t -p adds support for package backlog analysis. just run gettd.pl -p
   235 	\n\t -p adds support for package backlog analysis. just run gettd.pl -p
   229 	\n\t -compare [f1] [f2] compares two package summary files for changes ignores order\n";
   236 	\n\t -compare [f1] [f2] compares two package summary files for changes ignores order
       
   237   \n\t recommend to run under cygwin environment\n";
   230 	exit;
   238 	exit;
   231 }
   239 }
   232 
   240 
   233 
   241 
   234 
   242 
   306 		$csvfile="output.csv";
   314 		$csvfile="output.csv";
   307 		system ("rm output.csv");
   315 		system ("rm output.csv");
   308 	} else {
   316 	} else {
   309 		$csvfile="output.txt";
   317 		$csvfile="output.txt";
   310 		system ("rm *output.txt");
   318 		system ("rm *output.txt");
   311 
   319 	
   312 	}
   320 	}
   313  }
   321  }
   314  print "\nINFO-output recorded in $csvfile \n";
   322  print "\nINFO-output recorded in $csvfile \n";
   315 
   323 
   316 
   324                                       
   317 
       
   318 
       
   319 
   325 
   320 }
   326 }
   321 #main
   327 #main
   322 $/ = " ";
   328 $/ = " ";
   323 $host1 = "developer.symbian.org";
   329 $host1 = "developer.symbian.org";
   334 
   340 
   335 if ($ispackage) {
   341 if ($ispackage) {
   336 	getpage($target_url, $host1, $auth, "debug.txt");
   342 	getpage($target_url, $host1, $auth, "debug.txt");
   337 	@bklog = parse_category("debug.txt");
   343 	@bklog = parse_category("debug.txt");
   338 	$j=0;
   344 	$j=0;
       
   345 	
   339 	foreach (@bklog) {
   346 	foreach (@bklog) {
   340 		getpage("http://".$host1.$_, $host1, $auth, "pkg".$j.".txt");
   347 		getpage("http://".$host1.$_, $host1, $auth, "pkg".$j.".txt");
   341 		parse_bklog ("pkg".$j.".txt",$csvfile, $j);
   348 		parse_bklog ("pkg".$j.".txt",$csvfile, $j);
   342 		$j++;
   349 		$j++;
   343 		
   350