scripts/gettd.pl
author victorp@symbian.org
Fri, 30 Oct 2009 15:34:26 +0000
changeset 5 cb5ea404d492
parent 4 98b4ffa15936
child 6 2ac7d35ac201
permissions -rw-r--r--
wk44 update to planning_data and also gettd.pl v1.1
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/title\=\"(.*?)\"\>(.*)/g) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   157
            while ($relroad =~ m/\<tr\>(.*?)\<\/tr(.*)/sg){
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   158
                  $myfeat=$1;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   159
                  $relroad =$2;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   160
                  if ($skipfirst) {$skipfirst=0;next;}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   161
                  $package="";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   162
                  if  ($myfeat =~ m/title\=\"(.*?)\"\>/sg) {  $package=$1; }
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   163
                                  
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   164
                  $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
   165
                  $myfeat=~ s/\<.*?\>//sg;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   166
                 
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   167
                 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
   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
        }
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   172
  } else {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   173
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   174
	 foreach (@releases) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   175
		
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   176
	 	$exp="\\<h2\\>.*?\\>".$_;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   177
		  
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   178
		if ($roadmap =~ m /($exp)/sg) { 
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   179
			print "PASS - Found entry for $_ \n";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   180
			$relroad =$';	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   181
			
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   182
			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
   183
			$i=0;	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   184
			while ($relroad=~ m/\<h3\>.*\>(.*?)\<.*<\/h3/g) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   185
				$package = $1;		
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   186
				$ppos[$i]= pos($relroad);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   187
				$pname[$i]= $package;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   188
				$i++;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   189
			}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   190
			for ( $i=0;$i<($#ppos); $i++){
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   191
				$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
   192
				prntfeatures($_,$pname[$i],$features,outputfile,$domain);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   193
			}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   194
			$features= substr ($relroad, $ppos[$i]);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   195
		
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   196
			prntfeatures($_,$pname[$i],$features,outputfile,$domain);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   197
			@ppos ="";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   198
			@pname ="";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   199
			undef ($features);
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
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   207
	close (outputfile);
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
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   213
sub parse_category {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   214
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   215
	#arguments
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   216
	($infile)=@_;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   217
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   218
	my @mylink;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   219
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   220
	$mypage=loadfile $infile;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   221
	$i=0;	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   222
	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
   223
		print "INFO - Category page found\n";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   224
		$mypage = $1;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   225
		
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   226
		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
   227
			
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   228
			$mylink[$i] = $1;	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   229
			$i++;
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
		}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   232
	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
   233
	}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   234
	return @mylink;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   235
}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   236
5
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   237
sub bklog_domain {
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   238
 #argument
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   239
($mytechdomian)=@_;
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   240
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
  $mytechdomian =~s/\(//sg;
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   243
  
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   244
 $domaininfo=loadfile ("package_domains.csv");
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   245
 if ($domaininfo =~ m/$mytechdomian.*?\{(.*?)\}/sgi ) {
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   246
      return $1;
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   247
 }
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   248
  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
   249
  return "orphan";
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
}
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   252
4
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   253
sub parse_bklog {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   254
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   255
	#arguments
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   256
	($infile,$outfile,$id)=@_;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   257
	$mypkg=loadfile $infile;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   258
	#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
   259
  $headerformat= "wiki_format";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   260
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   261
	open ( outputfile, ">>".$outfile);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   262
	open ( soutputfile, ">>"."summary_".$outfile);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   263
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   264
	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
   265
  
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   266
		$pagename = $1;
5
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   267
		
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   268
    if ($splitbklogs) {
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   269
      $whichtd =  bklog_domain($pagename);
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   270
      open ( tdoutputfile, ">>".$whichtd. "_".$outfile);
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
    
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   275
    if (blacklist($pagename)) {
4
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   276
       
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   277
    	  close (outputfile);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   278
	      close (soutputfile);
5
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   279
	    
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   280
	      if ($splitbklogs) { close (tdoutputfile);}
4
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   281
        return 0;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   282
    }
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   283
		print "INFO -Processing Package $pagename \n";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   284
		$i=0;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   285
		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
   286
		
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   287
		while ($mypkg =~ m/\<tr.*?\>(.*?)\<\/tr/sg) { 
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   288
			$myheader= $&;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   289
      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
   290
        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
   291
        next;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   292
      }
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   293
			$myfeat= $1;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   294
			$myfeat =~ s/\<\/td\>/\t/sg;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   295
			$myfeat =~ s/\<.*?\>//sg;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   296
			$myfeat =~ s/\n//sg;
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
			
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   299
			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
   300
			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
   301
				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
   302
				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
   303
        
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   304
        $i++;
4
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
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   309
	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
   310
	if ($splitbklogs) { 
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   311
    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
   312
	}
4
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
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   316
	close (outputfile);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   317
	close (soutputfile);
5
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   318
  if ($splitbklogs) { close (tdoutputfile);}
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   319
                           
4
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
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   325
#help print
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   326
sub printhelp
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   327
{
5
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   328
       
cb5ea404d492 wk44 update to planning_data and also gettd.pl v1.1
victorp@symbian.org
parents: 4
diff changeset
   329
	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
   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
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   331
	\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
   332
  \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
   333
  \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
   334
  \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
   335
  \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
   336
	\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
   337
  \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
   338
	exit;
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
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   343
#compare bklogs
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   344
sub compare_bklogs {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   345
	#arguments
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   346
	(@bklogs)=@_;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   347
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   348
	if (not $#bklogs == 1) { printhelp;}
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
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   351
	$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
   352
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   353
	system($cmd);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   354
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   355
	$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
   356
	system($cmd);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   357
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   358
	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
   359
	system("rm temp*.txt");
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   360
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   361
	exit;
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
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   368
#process command line options
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   369
sub cmd_options
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
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   372
  my $help;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   373
  my @compare;
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
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   376
  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
   377
	'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
   378
   'split' => \$splitbklogs);
4
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   379
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   380
  if (@compare) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   381
	compare_bklogs @compare;
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
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   385
  if ($help) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   386
    printhelp;
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
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   390
 if ($ispackage) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   391
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   392
 	$tdomain =" ";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   393
	$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
   394
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   395
 }  
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   396
 if ($isnewformat){
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   397
    $newtdformat = 1;
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
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   401
 if ( not $target_url) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   402
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   403
	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
   404
	printhelp;	
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
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   408
 if (not $tdomain){
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   409
	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
   410
	printhelp;
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
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   413
 	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
   414
  
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   415
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   416
 if (not $csvfile) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   417
	if (not $ispackage) { 
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   418
		$csvfile="output.csv";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   419
		
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   420
	} else {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   421
		$csvfile="output.txt";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   422
		system ("rm *output.txt");
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
 }
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   426
 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
   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
}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   431
#main
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   432
$/ = " ";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   433
$host1 = "developer.symbian.org";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   434
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   435
cmd_options();
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   436
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   437
if ($authon) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   438
	#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
   439
	$mycookie = loadfile("mycookie.txt");
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   440
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   441
	$auth = "Cookie: " . $mycookie ;
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
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   445
if ($ispackage) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   446
	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
   447
	@bklog = parse_category("debug.txt");
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   448
	$j=0;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   449
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   450
	foreach (@bklog) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   451
		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
   452
		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
   453
		$j++;
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
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   459
} else {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   460
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   461
	#foundation releases - add as required
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   462
	@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
   463
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   464
	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
   465
	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
   466
}