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