scripts/gettd.pl
author victorp@symbian.org
Thu, 05 Nov 2009 12:56:48 +0000
changeset 6 2ac7d35ac201
parent 5 cb5ea404d492
child 7 896da38e2b20
permissions -rw-r--r--
update to gettd.pl and runntd to reflect new TD roamap format and also a new version of tech_roadmap.csv
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
     1
#!/usr/bin/perl
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
     2
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
     3
 
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
     4
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
     5
use IO::Socket; 
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
     6
use Getopt::Long;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
     7
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
     8
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
     9
my $target_url; #target url for the roadmap
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    10
my $tdomain; #tag for the domain to be use in csv file
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    11
my $csvfile; #output csv file name
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    12
my $authon= '';	 #does it require authorisation? default is false
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    13
5
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
    14
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
    15
4
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    16
my $ispackage;
5
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
    17
my $splitbklogs;
4
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    18
my $summaryheader="ID\tPackage\tFeatures\tFormat\tHttp\n" ;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    19
my $newtdformat = 0;
5
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
    20
my @blist = ("Tracking_Package_features","Kernel_EPLization_Backlog",
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
    21
    "Package_Backlog_Q","Wishlist","Test_Package");
4
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    22
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    23
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    24
sub blacklist
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    25
{
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    26
 ($name)=@_;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    27
      
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    28
 foreach(@blist) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    29
 
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    30
 if ( $name =~ m/$_/sg) { print "WARNING - $name is blacklisted\n"; return 1;}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    31
 }
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    32
 
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    33
 return 0;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    34
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    35
}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    36
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    37
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    38
sub getpage
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    39
{
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    40
	#arguments
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    41
	($page,$host,$auth,$myfile)=@_;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    42
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    43
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    44
	#output file
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    45
	open ( outputfile, ">".$myfile);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    46
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    47
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    48
	$port = "http(80)";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    49
	$getmess = "GET " . $page ." HTTP/1.1\n" . $auth;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    50
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    51
	print "INFO - sending message - $getmess\n";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    52
	print outputfile "$getmess\n\n";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    53
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    54
	$sock = IO::Socket::INET->new 	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    55
		(
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    56
		 PeerAddr => $host,   PeerPort => $port,  Proto => 'tcp', 
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    57
		) ;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    58
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    59
 
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    60
	print $sock "$getmess\n\n";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    61
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    62
 
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    63
	while(<$sock>) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    64
 
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    65
	  print outputfile $_;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    66
 
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    67
	}	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    68
  	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    69
	close ($sock);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    70
	close (outputfile);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    71
}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    72
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    73
sub prntfeatures 
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    74
{
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    75
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    76
	($release,$package,$features,$myfile,$domain)=@_;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    77
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    78
  $release =~ s/\\//sg;	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    79
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    80
 if ($newtdformat) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    81
  $package =~ s/backlog//sgi;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    82
  print $myfile " $release, $domain, $package, $myfeat\n";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    83
  
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    84
 } else {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    85
		
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    86
	$features = $features."<dt";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    87
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    88
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    89
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    90
	while ( $features =~ /dt\>(.*?)\<\/dt(.*?)\<dt/sg  ){
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    91
		$myfeat = $1;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    92
		$subfeat =$2;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    93
		
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    94
		$myfeat =~ s/\n/ /sg;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    95
		
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    96
		pos($features) = pos($features) -2;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    97
		
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    98
		$mystr="";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    99
		while ( $subfeat =~ /\<dd\>(.*?)\<\/dd\>/sg) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   100
			$mysubfeat = $mysubfeat.$mystr.$1;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   101
			$mystr = " & ";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   102
		}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   103
		undef $mystr;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   104
	$mysubfeat =~ s/,/ /sg;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   105
	$mysubfeat =~ s/\n//sg;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   106
	$mysubfeat =~ s/\<.*?\>//sg;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   107
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   108
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   109
	print $myfile " $release, $domain, $package, $myfeat, $mysubfeat\n";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   110
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   111
	$mysubfeat = "";	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   112
	}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   113
		
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   114
 }
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   115
}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   116
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   117
sub loadfile
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   118
{
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   119
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   120
	$/ = " ";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   121
	#arguments
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   122
	($myfile)=@_;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   123
	open ( inputfile, "<".$myfile);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   124
	my $contents = do { local $/;  <inputfile> };
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   125
	close(inputfile);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   126
	return $contents;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   127
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   128
}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   129
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   130
sub td_roadmap
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   131
{
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   132
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   133
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   134
	#arguments
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   135
	($infile,$outfile,$domain,@releases)=@_;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   136
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   137
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   138
	$roadmap=loadfile $infile;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   139
	open ( outputfile, ">>".$outfile);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   140
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   141
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   142
  if ($newtdformat) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   143
       print "Processing new TD roadmap format\n";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   144
         if ($roadmap =~ m /Contents\<\/h2\>.*?\<\/table/sg) { $roadmap =$';}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   145
         foreach (@releases) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   146
          $exp=$_." Roadmap";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   147
		         
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   148
           if ($roadmap =~ m /($exp)/sg) { 
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   149
			     print "PASS - Found entry for $_ \n";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   150
			     $relroad =$';	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   151
			
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   152
			     if ($roadmap =~ m /table\>(.*?)\<\/table/sg) { $relroad =$1;}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   153
			      $relroad =~ s/\n//sg;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   154
			      
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   155
            $skipfirst =1; #skipping the header of the table         
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   156
            while ($relroad =~ m/\<tr\>(.*?)\<\/tr(.*)/sg){
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   157
                  $myfeat=$1;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   158
                  $relroad =$2;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   159
                  if ($skipfirst) {$skipfirst=0;next;}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   160
                  $package="";
6
2ac7d35ac201 update to gettd.pl and runntd to reflect new TD roamap format and also a new version of tech_roadmap.csv
victorp@symbian.org
parents: 5
diff changeset
   161
                  if  ($myfeat =~ m/title\=\"(.*?)\"/sg) {  $package=$1; } #looking for package name
4
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   162
                                  
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   163
                  $myfeat=~ s/\<\/td\>\<td\>/-/sg;   #TODO change - to , when the old format is dead
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   164
                  $myfeat=~ s/\<.*?\>//sg;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   165
                 
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   166
                 if ($myfeat =~m/[A-z]/sg ){prntfeatures($_,$package,$myfeat,outputfile,$domain);}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   167
                
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   168
                 }  		     
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   169
         }
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   170
        }
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   171
  } else {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   172
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   173
	 foreach (@releases) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   174
		
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   175
	 	$exp="\\<h2\\>.*?\\>".$_;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   176
		  
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   177
		if ($roadmap =~ m /($exp)/sg) { 
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   178
			print "PASS - Found entry for $_ \n";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   179
			$relroad =$';	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   180
			
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   181
			if ($relroad =~ m /(.*?)\<h2/sg) { $relroad =$1;}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   182
			$i=0;	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   183
			while ($relroad=~ m/\<h3\>.*\>(.*?)\<.*<\/h3/g) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   184
				$package = $1;		
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   185
				$ppos[$i]= pos($relroad);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   186
				$pname[$i]= $package;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   187
				$i++;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   188
			}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   189
			for ( $i=0;$i<($#ppos); $i++){
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   190
				$features= substr ($relroad, $ppos[$i],$ppos[$i+1]-$ppos[$i]);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   191
				prntfeatures($_,$pname[$i],$features,outputfile,$domain);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   192
			}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   193
			$features= substr ($relroad, $ppos[$i]);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   194
		
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   195
			prntfeatures($_,$pname[$i],$features,outputfile,$domain);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   196
			@ppos ="";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   197
			@pname ="";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   198
			undef ($features);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   199
		}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   200
	}		 	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   201
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   202
	}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   203
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   204
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   205
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   206
	close (outputfile);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   207
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   208
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   209
}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   210
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   211
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   212
sub parse_category {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   213
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   214
	#arguments
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   215
	($infile)=@_;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   216
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   217
	my @mylink;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   218
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   219
	$mypage=loadfile $infile;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   220
	$i=0;	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   221
	if ( $mypage =~ m/Pages in category(.*)\<\/table/sg) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   222
		print "INFO - Category page found\n";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   223
		$mypage = $1;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   224
		
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   225
		while ($mypage =~ m /\<a href\=\"(\/wiki\/index\.php\/.*?)\"/g) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   226
			
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   227
			$mylink[$i] = $1;	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   228
			$i++;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   229
			
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   230
		}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   231
	print "INFO - Found $i items in the category page\n"
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   232
	}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   233
	return @mylink;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   234
}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   235
5
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   236
sub bklog_domain {
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   237
 #argument
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   238
($mytechdomian)=@_;
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   239
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   240
  $mytechdomian =~s/\)//sg;
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   241
  $mytechdomian =~s/\(//sg;
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   242
  
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   243
 $domaininfo=loadfile ("package_domains.csv");
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   244
 if ($domaininfo =~ m/$mytechdomian.*?\{(.*?)\}/sgi ) {
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   245
      return $1;
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   246
 }
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   247
  print "ERROR - domain not found for $mytechdomian\n";
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   248
  return "orphan";
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   249
 
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   250
}
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   251
4
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   252
sub parse_bklog {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   253
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   254
	#arguments
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   255
	($infile,$outfile,$id)=@_;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   256
	$mypkg=loadfile $infile;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   257
	#list if the bklog has been ported to the new bugzilla based format
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   258
  $headerformat= "wiki_format";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   259
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   260
	open ( outputfile, ">>".$outfile);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   261
	open ( soutputfile, ">>"."summary_".$outfile);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   262
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   263
	if ($mypkg =~ m/index\.php\/(.*?) HTTP/sg) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   264
  
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   265
		$pagename = $1;
5
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   266
		
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   267
    if ($splitbklogs) {
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   268
      $whichtd =  bklog_domain($pagename);
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   269
      open ( tdoutputfile, ">>".$whichtd. "_".$outfile);
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   270
     }
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   271
    
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   272
    
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   273
    
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   274
    if (blacklist($pagename)) {
4
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   275
       
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   276
    	  close (outputfile);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   277
	      close (soutputfile);
5
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   278
	    
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   279
	      if ($splitbklogs) { close (tdoutputfile);}
4
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   280
        return 0;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   281
    }
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   282
		print "INFO -Processing Package $pagename \n";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   283
		$i=0;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   284
		if ($mypkg =~m/class\=\"bugzilla sortable\"/sg ) { $headerformat="autobug_format"; }
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   285
		
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   286
		while ($mypkg =~ m/\<tr.*?\>(.*?)\<\/tr/sg) { 
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   287
			$myheader= $&;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   288
      if ($myheader =~ m/style=\"background-color\:/sg) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   289
        if ($myheader =~ m/Bug ID/sg) { $headerformat="bugzilla_format";}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   290
        next;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   291
      }
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   292
			$myfeat= $1;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   293
			$myfeat =~ s/\<\/td\>/\t/sg;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   294
			$myfeat =~ s/\<.*?\>//sg;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   295
			$myfeat =~ s/\n//sg;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   296
			
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   297
			
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   298
			if ($myfeat =~ m/[A-z]/sg and not $myfeat =~ m/\&lt\;etc/sg and 
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   299
			not $myfeat =~ m/\&lt\;Feature/sg and not $myfeat =~ m/Item not available/sg) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   300
				print outputfile "$pagename\t$myfeat\n";
5
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   301
				if ($splitbklogs) { print tdoutputfile "$pagename\t$myfeat\n";}
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   302
        
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   303
        $i++;
4
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   304
			}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   305
			
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   306
		}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   307
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   308
	print soutputfile "$id\t$pagename\t$i\t$headerformat\thttp://developer.symbian.org/wiki/index.php/$pagename\n";
5
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   309
	if ($splitbklogs) { 
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   310
    print soutputfile "$id\t$pagename\t$i\t$headerformat\t$whichtd\thttp://developer.symbian.org/wiki/index.php/$pagename\n";
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   311
	}
4
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   312
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   313
	}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   314
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   315
	close (outputfile);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   316
	close (soutputfile);
5
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   317
  if ($splitbklogs) { close (tdoutputfile);}
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   318
                           
4
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   319
}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   320
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   321
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   322
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   323
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   324
#help print
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   325
sub printhelp
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   326
{
5
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   327
       
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   328
	print "\n\n version 1.1
4
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   329
	\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
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   330
	\n\nOptional Parmeters for Technology Roadmaps\n\t-new if the roadmap has the new wiki format
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   331
  \n\nRequired Parameters for Package backlogs\n\t-p for package backlog analysis. just run gettd.pl -p
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   332
  \n\nOptional Pararmeters for Package backlogs\n\t -compare [f1] [f2] compares two package summary files for changes ignores order
5
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   333
  \n\t -split splits the content of the backlog output into technology domains. requires package_domains.csv file with mapping details
4
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   334
  \n\nCommonOptional parameters\n\t-o filename ,the output is logged into the output.csv file by default\n\t-h for help
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   335
	\n\t recommend to run under cygwin environment and perl version v5.10.0 \n
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   336
  \n\t pages blacklisted for package backlogs are @blist\n";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   337
	exit;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   338
}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   339
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   340
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   341
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   342
#compare bklogs
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   343
sub compare_bklogs {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   344
	#arguments
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   345
	(@bklogs)=@_;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   346
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   347
	if (not $#bklogs == 1) { printhelp;}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   348
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   349
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   350
	$cmd ="cut -f 2,3 ". $bklogs[0] . " | sort -u > tmp1.txt";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   351
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   352
	system($cmd);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   353
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   354
	$cmd ="cut -f 2,3 ". $bklogs[1] . " | sort -u > tmp2.txt";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   355
	system($cmd);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   356
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   357
	exec ("diff tmp1.txt tmp2.txt | grep '[<|>]'");
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   358
	system("rm temp*.txt");
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   359
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   360
	exit;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   361
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   362
}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   363
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   364
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   365
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   366
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   367
#process command line options
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   368
sub cmd_options
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   369
{
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   370
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   371
  my $help;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   372
  my @compare;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   373
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   374
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   375
  GetOptions('h' => \$help,'t=s'=> \$target_url, 'd=s' => \$tdomain , 'o=s' => \$csvfile, 
5
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   376
	'a' => \$authon , 'p' => \$ispackage, 'compare=s{2}' =>\@compare, 'new' => \$isnewformat,
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   377
   'split' => \$splitbklogs);
4
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   378
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   379
  if (@compare) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   380
	compare_bklogs @compare;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   381
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   382
  }
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   383
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   384
  if ($help) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   385
    printhelp;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   386
  }
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   387
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   388
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   389
 if ($ispackage) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   390
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   391
 	$tdomain =" ";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   392
	$target_url = "http://developer.symbian.org/wiki/index.php/Category:Package_Backlog";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   393
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   394
 }  
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   395
 if ($isnewformat){
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   396
    $newtdformat = 1;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   397
 
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   398
 }
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   399
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   400
 if ( not $target_url) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   401
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   402
	print "ERROR-missing arguments target url\n";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   403
	printhelp;	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   404
  } 
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   405
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   406
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   407
 if (not $tdomain){
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   408
	print "ERROR-missing arguments domain level\n";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   409
	printhelp;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   410
 }
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   411
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   412
 	print "\nINFO-downloading $target_url with label $tdomain\n";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   413
  
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   414
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   415
 if (not $csvfile) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   416
	if (not $ispackage) { 
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   417
		$csvfile="output.csv";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   418
		
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   419
	} else {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   420
		$csvfile="output.txt";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   421
		system ("rm *output.txt");
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   422
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   423
	}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   424
 }
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   425
 print "\nINFO-output recorded in $csvfile \n";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   426
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   427
                                      
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   428
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   429
}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   430
#main
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   431
$/ = " ";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   432
$host1 = "developer.symbian.org";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   433
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   434
cmd_options();
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   435
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   436
if ($authon) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   437
	#file containing login details from http cookie
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   438
	$mycookie = loadfile("mycookie.txt");
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   439
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   440
	$auth = "Cookie: " . $mycookie ;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   441
}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   442
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   443
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   444
if ($ispackage) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   445
	getpage($target_url, $host1, $auth, "debug.txt");
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   446
	@bklog = parse_category("debug.txt");
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   447
	$j=0;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   448
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   449
	foreach (@bklog) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   450
		getpage("http://".$host1.$_, $host1, $auth, "pkg".$j.".txt");
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   451
		parse_bklog ("pkg".$j.".txt",$csvfile, $j);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   452
		$j++;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   453
		
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   454
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   455
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   456
	}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   457
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   458
} else {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   459
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   460
	#foundation releases - add as required
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   461
	@releases=("Symbian\\^2","Symbian\\^3","Symbian\\^4");
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   462
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   463
	getpage($target_url, $host1, $auth, "debug.txt");
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   464
	td_roadmap("debug.txt" , $csvfile, $tdomain ,@releases);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   465
}