scripts/gettd.pl
author victorp@symbian.org
Fri, 30 Oct 2009 09:09:10 +0000
changeset 4 98b4ffa15936
child 5 cb5ea404d492
permissions -rw-r--r--
oops, adding the .pl file missed the first time - v1.0
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
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    14
my $ispackage;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    15
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
    16
my $newtdformat = 0;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    17
my @blist = ("Tracking_Package_features","PoC_roadmap","Kernel_EPLization_Backlog","Package_Backlog_Q","Wishlist");
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    18
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    19
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    20
sub blacklist
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    21
{
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    22
 ($name)=@_;
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
 foreach(@blist) {
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
 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
    27
 }
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    28
 
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    29
 return 0;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    30
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
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    34
sub getpage
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
	#arguments
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    37
	($page,$host,$auth,$myfile)=@_;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    38
	
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
	#output file
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    41
	open ( outputfile, ">".$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
	$port = "http(80)";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    45
	$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
    46
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    47
	print "INFO - sending message - $getmess\n";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    48
	print outputfile "$getmess\n\n";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    49
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    50
	$sock = IO::Socket::INET->new 	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    51
		(
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    52
		 PeerAddr => $host,   PeerPort => $port,  Proto => 'tcp', 
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
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
	print $sock "$getmess\n\n";
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
	while(<$sock>) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    60
 
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    61
	  print outputfile $_;
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
	}	
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
	close ($sock);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    66
	close (outputfile);
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
sub prntfeatures 
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    70
{
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
	($release,$package,$features,$myfile,$domain)=@_;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    73
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    74
  $release =~ s/\\//sg;	
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
 if ($newtdformat) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    77
  $package =~ s/backlog//sgi;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    78
  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
    79
  
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    80
 } else {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    81
		
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    82
	$features = $features."<dt";
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
	
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
	while ( $features =~ /dt\>(.*?)\<\/dt(.*?)\<dt/sg  ){
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    87
		$myfeat = $1;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    88
		$subfeat =$2;
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
		$myfeat =~ s/\n/ /sg;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    91
		
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    92
		pos($features) = pos($features) -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
		$mystr="";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    95
		while ( $subfeat =~ /\<dd\>(.*?)\<\/dd\>/sg) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    96
			$mysubfeat = $mysubfeat.$mystr.$1;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    97
			$mystr = " & ";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    98
		}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
    99
		undef $mystr;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   100
	$mysubfeat =~ s/,/ /sg;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   101
	$mysubfeat =~ s/\n//sg;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   102
	$mysubfeat =~ s/\<.*?\>//sg;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   103
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   104
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   105
	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
   106
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   107
	$mysubfeat = "";	
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
		
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
}
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
sub loadfile
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
	#arguments
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   118
	($myfile)=@_;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   119
	open ( inputfile, "<".$myfile);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   120
	my $contents = do { local $/;  <inputfile> };
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   121
	close(inputfile);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   122
	return $contents;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   123
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   124
}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   125
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   126
sub td_roadmap
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
	#arguments
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   131
	($infile,$outfile,$domain,@releases)=@_;
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
	$roadmap=loadfile $infile;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   135
	open ( outputfile, ">>".$outfile);
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
  if ($newtdformat) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   139
       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
   140
         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
   141
         foreach (@releases) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   142
          $exp=$_." Roadmap";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   143
		         
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   144
           if ($roadmap =~ m /($exp)/sg) { 
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   145
			     print "PASS - Found entry for $_ \n";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   146
			     $relroad =$';	
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 /table\>(.*?)\<\/table/sg) { $relroad =$1;}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   149
			      $relroad =~ s/\n//sg;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   150
			      
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   151
            $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
   152
      #     while ($relroad =~ m/title\=\"(.*?)\"\>(.*)/g) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   153
            while ($relroad =~ m/\<tr\>(.*?)\<\/tr(.*)/sg){
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   154
                  $myfeat=$1;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   155
                  $relroad =$2;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   156
                  if ($skipfirst) {$skipfirst=0;next;}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   157
                  $package="";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   158
                  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
   159
                                  
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   160
                  $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
   161
                  $myfeat=~ s/\<.*?\>//sg;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   162
                 
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   163
                 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
   164
                
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   165
                 }  		     
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   166
         }
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   167
        }
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   168
  } else {
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
	 foreach (@releases) {
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
	 	$exp="\\<h2\\>.*?\\>".$_;
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
		if ($roadmap =~ m /($exp)/sg) { 
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   175
			print "PASS - Found entry for $_ \n";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   176
			$relroad =$';	
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 ($relroad =~ m /(.*?)\<h2/sg) { $relroad =$1;}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   179
			$i=0;	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   180
			while ($relroad=~ m/\<h3\>.*\>(.*?)\<.*<\/h3/g) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   181
				$package = $1;		
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   182
				$ppos[$i]= pos($relroad);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   183
				$pname[$i]= $package;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   184
				$i++;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   185
			}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   186
			for ( $i=0;$i<($#ppos); $i++){
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   187
				$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
   188
				prntfeatures($_,$pname[$i],$features,outputfile,$domain);
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
			$features= substr ($relroad, $ppos[$i]);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   191
		
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
			@ppos ="";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   194
			@pname ="";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   195
			undef ($features);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   196
		}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   197
	}		 	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   198
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   199
	}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   200
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   201
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   202
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   203
	close (outputfile);
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
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
sub parse_category {
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
	#arguments
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   212
	($infile)=@_;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   213
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   214
	my @mylink;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   215
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   216
	$mypage=loadfile $infile;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   217
	$i=0;	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   218
	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
   219
		print "INFO - Category page found\n";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   220
		$mypage = $1;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   221
		
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   222
		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
   223
			
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   224
			$mylink[$i] = $1;	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   225
			$i++;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   226
			
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   227
		}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   228
	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
   229
	}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   230
	return @mylink;
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
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   233
sub parse_bklog {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   234
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   235
	#arguments
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   236
	($infile,$outfile,$id)=@_;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   237
	$mypkg=loadfile $infile;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   238
	#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
   239
  $headerformat= "wiki_format";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   240
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   241
	open ( outputfile, ">>".$outfile);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   242
	open ( soutputfile, ">>"."summary_".$outfile);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   243
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   244
	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
   245
  
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   246
		$pagename = $1;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   247
		if (blacklist($pagename)) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   248
       
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   249
    	  close (outputfile);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   250
	      close (soutputfile);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   251
	      close (houtputfile);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   252
        return 0;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   253
    }
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   254
		print "INFO -Processing Package $pagename \n";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   255
		$i=0;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   256
		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
   257
		
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   258
		while ($mypkg =~ m/\<tr.*?\>(.*?)\<\/tr/sg) { 
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   259
			$myheader= $&;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   260
      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
   261
        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
   262
        next;
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
			$myfeat= $1;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   265
			$myfeat =~ s/\<\/td\>/\t/sg;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   266
			$myfeat =~ s/\<.*?\>//sg;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   267
			$myfeat =~ s/\n//sg;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   268
			
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   269
			
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   270
			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
   271
			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
   272
				print outputfile "$pagename\t$myfeat\n";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   273
				$i++;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   274
			}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   275
			
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   276
		}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   277
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   278
	print soutputfile "$id\t$pagename\t$i\t$headerformat\thttp://developer.symbian.org/wiki/index.php/$pagename\n";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   279
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   280
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   281
	}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   282
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   283
	close (outputfile);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   284
	close (soutputfile);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   285
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   286
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   287
}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   288
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   289
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   290
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   291
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   292
#help print
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   293
sub printhelp
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   294
{
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   295
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   296
	print "\n\n version 1.0
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   297
	\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
   298
	\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
   299
  \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
   300
  \n\nOptional Pararmeters for Package backlogs\n\t -compare [f1] [f2] compares two package summary files for changes ignores order
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   301
  \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
   302
	\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
   303
  \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
   304
	exit;
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
#compare bklogs
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   310
sub compare_bklogs {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   311
	#arguments
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   312
	(@bklogs)=@_;
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
	if (not $#bklogs == 1) { printhelp;}
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
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   317
	$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
   318
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   319
	system($cmd);
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
	$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
   322
	system($cmd);
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
	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
   325
	system("rm temp*.txt");
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   326
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   327
	exit;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   328
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   329
}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   330
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   331
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   332
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   333
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   334
#process command line options
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   335
sub cmd_options
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   336
{
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   337
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   338
  my $help;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   339
  my @compare;
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
  GetOptions('h' => \$help,'t=s'=> \$target_url, 'd=s' => \$tdomain , 'o=s' => \$csvfile, 
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   343
	'a' => \$authon , 'p' => \$ispackage, 'compare=s{2}' =>\@compare, 'new' => \$isnewformat);
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   344
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   345
  if (@compare) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   346
	compare_bklogs @compare;
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
  }
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
  if ($help) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   351
    printhelp;
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
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
 if ($ispackage) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   356
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   357
 	$tdomain =" ";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   358
	$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
   359
	
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
 if ($isnewformat){
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   362
    $newtdformat = 1;
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
 if ( not $target_url) {
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
	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
   369
	printhelp;	
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
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   373
 if (not $tdomain){
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   374
	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
   375
	printhelp;
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   376
 }
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   377
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   378
 	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
   379
  
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   380
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   381
 if (not $csvfile) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   382
	if (not $ispackage) { 
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   383
		$csvfile="output.csv";
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
	} else {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   386
		$csvfile="output.txt";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   387
		system ("rm *output.txt");
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
 }
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   391
 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
   392
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   393
                                      
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   394
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   395
}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   396
#main
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   397
$/ = " ";
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   398
$host1 = "developer.symbian.org";
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
cmd_options();
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   401
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   402
if ($authon) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   403
	#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
   404
	$mycookie = loadfile("mycookie.txt");
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
	$auth = "Cookie: " . $mycookie ;
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
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   409
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   410
if ($ispackage) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   411
	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
   412
	@bklog = parse_category("debug.txt");
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   413
	$j=0;
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
	foreach (@bklog) {
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   416
		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
   417
		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
   418
		$j++;
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
	
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   421
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   422
	}
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   423
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   424
} else {
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
	#foundation releases - add as required
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   427
	@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
   428
98b4ffa15936 oops, adding the .pl file missed the first time - v1.0
victorp@symbian.org
parents:
diff changeset
   429
	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
   430
	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
   431
}