author | victorp@symbian.org |
Fri, 31 Jul 2009 14:15:17 +0100 | |
changeset 24 | 8fb98cf0b1ac |
parent 23 | dbe87093a3ca |
child 25 | 7a2c092f0fbf |
permissions | -rw-r--r-- |
23
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
1 |
#!/usr/bin/perl |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
2 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
3 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
4 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
5 |
use IO::Socket; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
6 |
use Getopt::Long; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
7 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
8 |
|
24
8fb98cf0b1ac
remove authentication as default, added -a option for cookies
victorp@symbian.org
parents:
23
diff
changeset
|
9 |
my $target_url; #target url for the roadmap |
8fb98cf0b1ac
remove authentication as default, added -a option for cookies
victorp@symbian.org
parents:
23
diff
changeset
|
10 |
my $tdomain; #tag for the domain to be use in csv file |
8fb98cf0b1ac
remove authentication as default, added -a option for cookies
victorp@symbian.org
parents:
23
diff
changeset
|
11 |
my $csvfile; #output csv file name |
8fb98cf0b1ac
remove authentication as default, added -a option for cookies
victorp@symbian.org
parents:
23
diff
changeset
|
12 |
my $authon= ''; ; #does it require authorisation? default is false |
23
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
13 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
14 |
sub getpage |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
15 |
{ |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
16 |
#arguments |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
17 |
($page,$host,$auth,$myfile)=@_; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
18 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
19 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
20 |
#output file |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
21 |
open ( outputfile, ">".$myfile); |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
22 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
23 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
24 |
$port = "http(80)"; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
25 |
$getmess = "GET " . $page ." HTTP/1.1\n" . $auth; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
26 |
|
24
8fb98cf0b1ac
remove authentication as default, added -a option for cookies
victorp@symbian.org
parents:
23
diff
changeset
|
27 |
print "INFO - sending message - $getmess\n"; |
23
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
28 |
print outputfile "$getmess\n\n"; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
29 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
30 |
$sock = IO::Socket::INET->new |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
31 |
( |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
32 |
PeerAddr => $host, PeerPort => $port, Proto => 'tcp', |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
33 |
) ; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
34 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
35 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
36 |
print $sock "$getmess\n\n"; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
37 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
38 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
39 |
while(<$sock>) { |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
40 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
41 |
print outputfile $_; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
42 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
43 |
} |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
44 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
45 |
close ($sock); |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
46 |
close (outputfile); |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
47 |
} |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
48 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
49 |
sub prntfeatures |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
50 |
{ |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
51 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
52 |
($release,$package,$features,$myfile,$domain)=@_; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
53 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
54 |
$features = $features."<dt"; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
55 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
56 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
57 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
58 |
while ( $features =~ /dt\>(.*?)\<\/dt(.*?)\<dt/sg ){ |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
59 |
$myfeat = $1; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
60 |
$subfeat =$2; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
61 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
62 |
$myfeat =~ s/\n/ /sg; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
63 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
64 |
pos($features) = pos($features) -2; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
65 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
66 |
$mystr=""; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
67 |
while ( $subfeat =~ /\<dd\>(.*?)\<\/dd\>/sg) { |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
68 |
$mysubfeat = $mysubfeat.$mystr.$1; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
69 |
$mystr = " & "; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
70 |
} |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
71 |
undef $mystr; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
72 |
$mysubfeat =~ s/,/ /sg; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
73 |
$mysubfeat =~ s/\n//sg; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
74 |
$mysubfeat =~ s/\<.*?\>//sg; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
75 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
76 |
$release =~ s/\\//sg; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
77 |
print $myfile " $release, $domain, $package, $myfeat, $mysubfeat\n"; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
78 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
79 |
$mysubfeat = ""; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
80 |
} |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
81 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
82 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
83 |
} |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
84 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
85 |
sub loadfile |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
86 |
{ |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
87 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
88 |
$/ = " "; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
89 |
#arguments |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
90 |
($myfile)=@_; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
91 |
open ( inputfile, "<".$myfile); |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
92 |
my $contents = do { local $/; <inputfile> }; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
93 |
close(inputfile); |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
94 |
return $contents; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
95 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
96 |
} |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
97 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
98 |
sub td_roadmap |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
99 |
{ |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
100 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
101 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
102 |
#arguments |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
103 |
($infile,$outfile,$domain,@releases)=@_; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
104 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
105 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
106 |
$roadmap=loadfile $infile; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
107 |
open ( outputfile, ">>".$outfile); |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
108 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
109 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
110 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
111 |
foreach (@releases) { |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
112 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
113 |
$exp="\\<h2\\>.*?\\>".$_; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
114 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
115 |
if ($roadmap =~ m /($exp)/sg) { |
24
8fb98cf0b1ac
remove authentication as default, added -a option for cookies
victorp@symbian.org
parents:
23
diff
changeset
|
116 |
print "PASS - Found entry for $_ \n"; |
23
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
117 |
$relroad =$'; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
118 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
119 |
if ($relroad =~ m /(.*?)\<h2/sg) { $relroad =$1;} |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
120 |
$i=0; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
121 |
while ($relroad=~ m/\<h3\>.*\>(.*?)\<.*<\/h3/g) { |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
122 |
$package = $1; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
123 |
$ppos[$i]= pos($relroad); |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
124 |
$pname[$i]= $package; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
125 |
$i++; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
126 |
} |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
127 |
for ( $i=0;$i<($#ppos); $i++){ |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
128 |
$features= substr ($relroad, $ppos[$i],$ppos[$i+1]-$ppos[$i]); |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
129 |
prntfeatures($_,$pname[$i],$features,outputfile,$domain); |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
130 |
} |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
131 |
$features= substr ($relroad, $ppos[$i]); |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
132 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
133 |
prntfeatures($_,$pname[$i],$features,outputfile,$domain); |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
134 |
@ppos =""; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
135 |
@pname =""; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
136 |
undef ($features); |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
137 |
} |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
138 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
139 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
140 |
} |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
141 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
142 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
143 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
144 |
close (outputfile); |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
145 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
146 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
147 |
} |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
148 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
149 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
150 |
#help print |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
151 |
sub printhelp |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
152 |
{ |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
153 |
|
24
8fb98cf0b1ac
remove authentication as default, added -a option for cookies
victorp@symbian.org
parents:
23
diff
changeset
|
154 |
print "\n\n version 0.3 |
23
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
155 |
\ngettd.pl -t=url -d=domain \nrequired parameters:\n\t -t url containing the technology domain roadmap\n\t -d the technology domain name |
24
8fb98cf0b1ac
remove authentication as default, added -a option for cookies
victorp@symbian.org
parents:
23
diff
changeset
|
156 |
\n Optional parameters\n\t-o filename ,the output is logged into the output.csv file by default\n\t-h for help |
8fb98cf0b1ac
remove authentication as default, added -a option for cookies
victorp@symbian.org
parents:
23
diff
changeset
|
157 |
\n\t-a setup authorisation by cookie follow instructions in http://developer.symbian.org/wiki/index.php/Roadmap_merger_script#Cookies"; |
23
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
158 |
exit; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
159 |
} |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
160 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
161 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
162 |
#process command line options |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
163 |
sub cmd_options |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
164 |
{ |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
165 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
166 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
167 |
my $help; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
168 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
169 |
|
24
8fb98cf0b1ac
remove authentication as default, added -a option for cookies
victorp@symbian.org
parents:
23
diff
changeset
|
170 |
GetOptions('h' => \$help,'t=s'=> \$target_url, 'd=s' => \$tdomain , 'o=s' => \$csvfile, 'a' => \$authon); |
23
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
171 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
172 |
if ($help) { |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
173 |
printhelp; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
174 |
} |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
175 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
176 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
177 |
if ( not $target_url) { |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
178 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
179 |
print "ERROR-missing arguments target url\n"; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
180 |
printhelp; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
181 |
} |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
182 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
183 |
if (not $tdomain){ |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
184 |
print "ERROR-missing arguments domain level\n"; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
185 |
printhelp; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
186 |
} |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
187 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
188 |
print "\nINFO-downloading $target_url with label $tdomain\n"; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
189 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
190 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
191 |
if (not $csvfile) { |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
192 |
$csvfile="output.csv"; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
193 |
} |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
194 |
print "\nINFO-output recorded in $csvfile \n"; |
24
8fb98cf0b1ac
remove authentication as default, added -a option for cookies
victorp@symbian.org
parents:
23
diff
changeset
|
195 |
|
8fb98cf0b1ac
remove authentication as default, added -a option for cookies
victorp@symbian.org
parents:
23
diff
changeset
|
196 |
|
8fb98cf0b1ac
remove authentication as default, added -a option for cookies
victorp@symbian.org
parents:
23
diff
changeset
|
197 |
|
8fb98cf0b1ac
remove authentication as default, added -a option for cookies
victorp@symbian.org
parents:
23
diff
changeset
|
198 |
|
23
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
199 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
200 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
201 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
202 |
} |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
203 |
#main |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
204 |
$/ = " "; |
24
8fb98cf0b1ac
remove authentication as default, added -a option for cookies
victorp@symbian.org
parents:
23
diff
changeset
|
205 |
cmd_options(); |
23
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
206 |
|
24
8fb98cf0b1ac
remove authentication as default, added -a option for cookies
victorp@symbian.org
parents:
23
diff
changeset
|
207 |
if ($authon) { |
8fb98cf0b1ac
remove authentication as default, added -a option for cookies
victorp@symbian.org
parents:
23
diff
changeset
|
208 |
#file containing login details from http cookie |
8fb98cf0b1ac
remove authentication as default, added -a option for cookies
victorp@symbian.org
parents:
23
diff
changeset
|
209 |
$mycookie = loadfile("mycookie.txt"); |
23
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
210 |
|
24
8fb98cf0b1ac
remove authentication as default, added -a option for cookies
victorp@symbian.org
parents:
23
diff
changeset
|
211 |
$auth = "Cookie: " . $mycookie ; |
8fb98cf0b1ac
remove authentication as default, added -a option for cookies
victorp@symbian.org
parents:
23
diff
changeset
|
212 |
} |
23
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
213 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
214 |
#foundation releases - add as required |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
215 |
@releases=("Symbian\\^2","Symbian\\^3","Symbian\\^4"); |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
216 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
217 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
218 |
$host1 = "developer.symbian.org"; |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
219 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
220 |
|
24
8fb98cf0b1ac
remove authentication as default, added -a option for cookies
victorp@symbian.org
parents:
23
diff
changeset
|
221 |
|
23
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
222 |
|
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
223 |
getpage($target_url, $host1, $auth, "debug.txt"); |
dbe87093a3ca
adding roadmap_merger script - first version
victorp@symbian.org
parents:
diff
changeset
|
224 |
td_roadmap("debug.txt" , $csvfile, $tdomain ,@releases); |