author | Dario Sestito <darios@symbian.org> |
Fri, 03 Sep 2010 11:18:29 +0100 | |
changeset 319 | 3c4e66eaef4a |
parent 317 | 2ca4533db9fe |
child 322 | 2b7e66ca13ba |
permissions | -rw-r--r-- |
177 | 1 |
# Copyright (c) 2009 Symbian Foundation Ltd |
2 |
# This component and the accompanying materials are made available |
|
3 |
# under the terms of the License "Eclipse Public License v1.0" |
|
4 |
# which accompanies this distribution, and is available |
|
5 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
6 |
# |
|
7 |
# Initial Contributors: |
|
8 |
# Symbian Foundation Ltd - initial contribution. |
|
9 |
# |
|
10 |
# Contributors: |
|
258
08436a227940
Add author information. Reviewed descriptions
Dario Sestito <darios@symbian.org>
parents:
223
diff
changeset
|
11 |
# Dario Sestito <darios@symbian.org> |
177 | 12 |
# |
13 |
# Description: |
|
14 |
# Raptor parser module. |
|
15 |
# Extract releaseable (whatlog) information |
|
16 |
||
17 |
package releaseables; |
|
18 |
||
298
27d2c4249a97
Fix: Missing 'missing' info
Dario Sestito <darios@symbian.org>
parents:
260
diff
changeset
|
19 |
use File::Path; |
313
8e1488905621
Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents:
298
diff
changeset
|
20 |
use File::Find; |
298
27d2c4249a97
Fix: Missing 'missing' info
Dario Sestito <darios@symbian.org>
parents:
260
diff
changeset
|
21 |
|
177 | 22 |
use strict; |
23 |
||
24 |
our $reset_status = {}; |
|
25 |
my $buildlog_status = {}; |
|
26 |
my $whatlog_status = {}; |
|
27 |
my $bitmap_status = {}; |
|
28 |
my $resource_status = {}; |
|
29 |
my $build_status = {}; |
|
30 |
my $export_status = {}; |
|
31 |
my $stringtable_status = {}; |
|
32 |
my $archive_status = {}; |
|
33 |
my $archive_member_status = {}; |
|
34 |
my $whatlog_default_status = {}; |
|
35 |
||
36 |
$reset_status->{name} = 'reset_status'; |
|
37 |
$reset_status->{next_status} = {buildlog=>$buildlog_status}; |
|
38 |
||
39 |
$buildlog_status->{name} = 'buildlog_status'; |
|
40 |
$buildlog_status->{next_status} = {whatlog=>$whatlog_status}; |
|
41 |
$buildlog_status->{on_start} = 'releaseables::on_start_buildlog'; |
|
42 |
||
43 |
$whatlog_status->{name} = 'whatlog_status'; |
|
44 |
$whatlog_status->{next_status} = {bitmap=>$bitmap_status, resource=>$resource_status, build=>$build_status, export=>$export_status, stringtable=>$stringtable_status, archive=>$archive_status, '?default?'=>$whatlog_default_status}; |
|
45 |
$whatlog_status->{on_start} = 'releaseables::on_start_whatlog'; |
|
46 |
$whatlog_status->{on_end} = 'releaseables::on_end_whatlog'; |
|
47 |
||
48 |
$bitmap_status->{name} = 'bitmap_status'; |
|
49 |
$bitmap_status->{next_status} = {}; |
|
50 |
$bitmap_status->{on_start} = 'releaseables::on_start_bitmap'; |
|
51 |
$bitmap_status->{on_end} = 'releaseables::on_end_whatlog_subtag'; |
|
52 |
$bitmap_status->{on_chars} = 'releaseables::on_chars_whatlog_subtag'; |
|
53 |
||
54 |
$resource_status->{name} = 'resource_status'; |
|
55 |
$resource_status->{next_status} = {}; |
|
56 |
$resource_status->{on_start} = 'releaseables::on_start_resource'; |
|
57 |
$resource_status->{on_end} = 'releaseables::on_end_whatlog_subtag'; |
|
58 |
$resource_status->{on_chars} = 'releaseables::on_chars_whatlog_subtag'; |
|
59 |
||
60 |
$build_status->{name} = 'build_status'; |
|
61 |
$build_status->{next_status} = {}; |
|
62 |
$build_status->{on_start} = 'releaseables::on_start_build'; |
|
63 |
$build_status->{on_end} = 'releaseables::on_end_whatlog_subtag'; |
|
64 |
$build_status->{on_chars} = 'releaseables::on_chars_whatlog_subtag'; |
|
65 |
||
66 |
$stringtable_status->{name} = 'stringtable_status'; |
|
67 |
$stringtable_status->{next_status} = {}; |
|
68 |
$stringtable_status->{on_start} = 'releaseables::on_start_stringtable'; |
|
69 |
$stringtable_status->{on_end} = 'releaseables::on_end_whatlog_subtag'; |
|
70 |
$stringtable_status->{on_chars} = 'releaseables::on_chars_whatlog_subtag'; |
|
71 |
||
72 |
$archive_status->{name} = 'archive_status'; |
|
73 |
$archive_status->{next_status} = {member=>$archive_member_status}; |
|
74 |
||
75 |
$archive_member_status->{name} = 'archive_member_status'; |
|
76 |
$archive_member_status->{next_status} = {}; |
|
77 |
$archive_member_status->{on_start} = 'releaseables::on_start_archive_member'; |
|
78 |
$archive_member_status->{on_end} = 'releaseables::on_end_whatlog_subtag'; |
|
79 |
$archive_member_status->{on_chars} = 'releaseables::on_chars_whatlog_subtag'; |
|
80 |
||
81 |
$export_status->{name} = 'export_status'; |
|
82 |
$export_status->{next_status} = {}; |
|
83 |
$export_status->{on_start} = 'releaseables::on_start_export'; |
|
84 |
||
85 |
$whatlog_default_status->{name} = 'whatlog_default_status'; |
|
86 |
$whatlog_default_status->{next_status} = {}; |
|
87 |
$whatlog_default_status->{on_start} = 'releaseables::on_start_whatlog_default'; |
|
88 |
||
89 |
my $whatlog_info = {}; |
|
90 |
my $curbldinf = 'unknown'; |
|
91 |
my $curconfig = 'unknown'; |
|
92 |
my $curfiletype = 'unknown'; |
|
93 |
my $characters = ''; |
|
94 |
||
95 |
sub on_start_buildlog |
|
96 |
{ |
|
97 |
||
98 |
} |
|
99 |
||
100 |
sub on_start_whatlog |
|
101 |
{ |
|
102 |
my ($el) = @_; |
|
103 |
||
104 |
$whatlog_info = {}; |
|
105 |
||
106 |
my $bldinf = ''; |
|
107 |
my $config = ''; |
|
108 |
my $attributes = $el->{Attributes}; |
|
109 |
for (keys %{$attributes}) |
|
110 |
{ |
|
111 |
#print "reading attribute $_\n"; |
|
112 |
if ($attributes->{$_}->{'LocalName'} eq 'bldinf') |
|
113 |
{ |
|
114 |
$bldinf = $attributes->{$_}->{'Value'}; |
|
115 |
#print "bldinf=$bldinf\n"; |
|
116 |
} |
|
117 |
elsif ($attributes->{$_}->{'LocalName'} eq 'config') |
|
118 |
{ |
|
119 |
$config = $attributes->{$_}->{'Value'}; |
|
120 |
$config =~ s,\.whatlog$,,; |
|
121 |
} |
|
122 |
} |
|
123 |
||
124 |
if ($bldinf eq '') |
|
125 |
{ |
|
126 |
print "WARNING: whatlog tag with no bldinf attribute. Skipping\n"; |
|
127 |
return; |
|
128 |
} |
|
129 |
||
130 |
$curbldinf = $bldinf; |
|
131 |
$curconfig = $config; |
|
132 |
$whatlog_info->{$curbldinf} = {} if (!defined $whatlog_info->{$curbldinf}); |
|
133 |
$whatlog_info->{$curbldinf}->{$curconfig} = {} if (!defined $whatlog_info->{$curbldinf}->{$curconfig}); |
|
134 |
} |
|
135 |
||
136 |
sub on_start_whatlog_subtag |
|
137 |
{ |
|
138 |
my ($ft) = @_; |
|
139 |
||
140 |
$curfiletype = $ft; |
|
141 |
$characters = ''; |
|
142 |
$whatlog_info->{$curbldinf}->{$curconfig}->{$curfiletype} = [] if (! defined $whatlog_info->{$curbldinf}->{$curconfig}->{$curfiletype}); |
|
143 |
} |
|
144 |
||
145 |
sub on_chars_whatlog_subtag |
|
146 |
{ |
|
147 |
my ($ch) = @_; |
|
148 |
||
149 |
$characters .= $ch->{Data}; |
|
150 |
||
151 |
#print "characters is now -->$characters<--\n"; |
|
152 |
} |
|
153 |
||
154 |
sub on_end_whatlog_subtag |
|
155 |
{ |
|
156 |
$characters = normalize_filepath($characters); |
|
157 |
||
158 |
push(@{$whatlog_info->{$curbldinf}->{$curconfig}->{$curfiletype}}, $characters); |
|
159 |
||
160 |
$curfiletype = 'unknown'; |
|
161 |
$characters = ''; |
|
162 |
} |
|
163 |
||
164 |
sub on_start_bitmap |
|
165 |
{ |
|
166 |
on_start_whatlog_subtag('bitmap'); |
|
167 |
} |
|
168 |
||
169 |
sub on_start_resource |
|
170 |
{ |
|
171 |
on_start_whatlog_subtag('resource'); |
|
172 |
} |
|
173 |
||
174 |
sub on_start_build |
|
175 |
{ |
|
176 |
on_start_whatlog_subtag('build'); |
|
177 |
} |
|
178 |
||
179 |
sub on_start_stringtable |
|
180 |
{ |
|
181 |
on_start_whatlog_subtag('stringtable'); |
|
182 |
} |
|
183 |
||
184 |
sub on_start_archive_member |
|
185 |
{ |
|
186 |
on_start_whatlog_subtag('export'); |
|
187 |
} |
|
188 |
||
189 |
sub on_start_export |
|
190 |
{ |
|
191 |
my ($el) = @_; |
|
192 |
||
193 |
$whatlog_info->{$curbldinf}->{$curconfig}->{export} = [] if (! defined $whatlog_info->{$curbldinf}->{$curconfig}->{export}); |
|
194 |
||
195 |
my $destination = ''; |
|
196 |
my $attributes = $el->{Attributes}; |
|
197 |
for (keys %{$attributes}) |
|
198 |
{ |
|
199 |
#print "reading attribute $_\n"; |
|
200 |
if ($attributes->{$_}->{'LocalName'} eq 'destination') |
|
201 |
{ |
|
202 |
$destination = $attributes->{$_}->{'Value'}; |
|
203 |
#print "destination=$destination\n"; |
|
204 |
last; |
|
205 |
} |
|
206 |
} |
|
207 |
||
208 |
if ($destination eq '') |
|
209 |
{ |
|
210 |
print "WARNING: export tag with no destination attribute. Skipping\n"; |
|
211 |
return; |
|
212 |
} |
|
213 |
||
214 |
$destination = normalize_filepath($destination); |
|
215 |
||
216 |
push(@{$whatlog_info->{$curbldinf}->{$curconfig}->{export}}, $destination); |
|
217 |
} |
|
218 |
||
219 |
sub on_end_whatlog |
|
220 |
{ |
|
221 |
my $unknown_counter = 0; |
|
222 |
||
223 |
for my $bldinf (keys %{$whatlog_info}) |
|
224 |
{ |
|
225 |
for my $config (keys %{$whatlog_info->{$bldinf}}) |
|
226 |
{ |
|
298
27d2c4249a97
Fix: Missing 'missing' info
Dario Sestito <darios@symbian.org>
parents:
260
diff
changeset
|
227 |
my $normalized = $bldinf; |
27d2c4249a97
Fix: Missing 'missing' info
Dario Sestito <darios@symbian.org>
parents:
260
diff
changeset
|
228 |
RaptorCommon::normalize_bldinf_path(\$normalized); |
27d2c4249a97
Fix: Missing 'missing' info
Dario Sestito <darios@symbian.org>
parents:
260
diff
changeset
|
229 |
|
27d2c4249a97
Fix: Missing 'missing' info
Dario Sestito <darios@symbian.org>
parents:
260
diff
changeset
|
230 |
my $package = RaptorCommon::get_package_subpath($normalized); |
177 | 231 |
|
298
27d2c4249a97
Fix: Missing 'missing' info
Dario Sestito <darios@symbian.org>
parents:
260
diff
changeset
|
232 |
mkpath("$::releaseablesdir/$package"); |
177 | 233 |
|
298
27d2c4249a97
Fix: Missing 'missing' info
Dario Sestito <darios@symbian.org>
parents:
260
diff
changeset
|
234 |
my $filename = "$::releaseablesdir/$package/info.tsv"; |
27d2c4249a97
Fix: Missing 'missing' info
Dario Sestito <darios@symbian.org>
parents:
260
diff
changeset
|
235 |
$package =~ s,/,_,g; |
27d2c4249a97
Fix: Missing 'missing' info
Dario Sestito <darios@symbian.org>
parents:
260
diff
changeset
|
236 |
my $filenamemissing = "$::raptorbitsdir/$package\_missing.txt" if ($::missing); |
177 | 237 |
|
238 |
print "Writing info file $filename\n" if (!-f$filename); |
|
239 |
open(FILE, ">>$filename"); |
|
240 |
||
241 |
for my $filetype (keys %{$whatlog_info->{$bldinf}->{$config}}) |
|
242 |
{ |
|
243 |
for (sort(@{$whatlog_info->{$bldinf}->{$config}->{$filetype}})) |
|
244 |
{ |
|
245 |
print FILE "$_\t$filetype\t$config\n"; |
|
216
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
246 |
my $file = $_; |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
247 |
|
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
248 |
if($::missing && !-f $file) |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
249 |
{ |
223
604012c39141
Minor adjustments to UH parser
Dario Sestito <darios@symbian.org>
parents:
216
diff
changeset
|
250 |
open(MISSING, ">>$filenamemissing"); |
604012c39141
Minor adjustments to UH parser
Dario Sestito <darios@symbian.org>
parents:
216
diff
changeset
|
251 |
print MISSING $file."\n"; |
604012c39141
Minor adjustments to UH parser
Dario Sestito <darios@symbian.org>
parents:
216
diff
changeset
|
252 |
close(MISSING); |
604012c39141
Minor adjustments to UH parser
Dario Sestito <darios@symbian.org>
parents:
216
diff
changeset
|
253 |
} |
177 | 254 |
} |
255 |
} |
|
223
604012c39141
Minor adjustments to UH parser
Dario Sestito <darios@symbian.org>
parents:
216
diff
changeset
|
256 |
close(FILE); |
177 | 257 |
} |
258 |
} |
|
259 |
} |
|
313
8e1488905621
Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents:
298
diff
changeset
|
260 |
|
8e1488905621
Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents:
298
diff
changeset
|
261 |
sub count_distinct |
8e1488905621
Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents:
298
diff
changeset
|
262 |
{ |
8e1488905621
Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents:
298
diff
changeset
|
263 |
my @files; |
8e1488905621
Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents:
298
diff
changeset
|
264 |
my $finder = sub { |
8e1488905621
Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents:
298
diff
changeset
|
265 |
return if ! -f; |
8e1488905621
Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents:
298
diff
changeset
|
266 |
return if ! /\.tsv$/; |
8e1488905621
Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents:
298
diff
changeset
|
267 |
push @files, $File::Find::name; |
8e1488905621
Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents:
298
diff
changeset
|
268 |
}; |
8e1488905621
Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents:
298
diff
changeset
|
269 |
find($finder, $::releaseablesdir); |
8e1488905621
Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents:
298
diff
changeset
|
270 |
|
8e1488905621
Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents:
298
diff
changeset
|
271 |
for my $file (@files) |
8e1488905621
Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents:
298
diff
changeset
|
272 |
{ |
319
3c4e66eaef4a
Add one more debug line and a possible fix for the total releasables number not displayed problem
Dario Sestito <darios@symbian.org>
parents:
317
diff
changeset
|
273 |
print "counting distinct releasables in file $file\n"; |
3c4e66eaef4a
Add one more debug line and a possible fix for the total releasables number not displayed problem
Dario Sestito <darios@symbian.org>
parents:
317
diff
changeset
|
274 |
$file =~ /$::releaseablesdir[\\\/]*(.*)[\\\/]info\.tsv/; |
313
8e1488905621
Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents:
298
diff
changeset
|
275 |
my $package = $1; |
8e1488905621
Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents:
298
diff
changeset
|
276 |
$package =~ s,\\,/,g; |
8e1488905621
Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents:
298
diff
changeset
|
277 |
|
8e1488905621
Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents:
298
diff
changeset
|
278 |
my @releasables; |
8e1488905621
Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents:
298
diff
changeset
|
279 |
open(FILE, $file); |
8e1488905621
Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents:
298
diff
changeset
|
280 |
while (<FILE>) |
8e1488905621
Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents:
298
diff
changeset
|
281 |
{ |
8e1488905621
Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents:
298
diff
changeset
|
282 |
my $line = $_; |
8e1488905621
Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents:
298
diff
changeset
|
283 |
next if ($line !~ /^([^\t]*)\t[^\t]*\t[^\t]*$/); |
8e1488905621
Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents:
298
diff
changeset
|
284 |
push @releasables, $1; |
8e1488905621
Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents:
298
diff
changeset
|
285 |
} |
8e1488905621
Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents:
298
diff
changeset
|
286 |
close(FILE); |
8e1488905621
Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents:
298
diff
changeset
|
287 |
#for my $r (@releasables) {print "$r\n";} |
8e1488905621
Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents:
298
diff
changeset
|
288 |
#print "\n\n\n\n"; |
8e1488905621
Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents:
298
diff
changeset
|
289 |
my $previous = ''; |
8e1488905621
Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents:
298
diff
changeset
|
290 |
my @distincts = grep {$_ ne $previous && ($previous = $_, 1) } sort @releasables; |
8e1488905621
Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents:
298
diff
changeset
|
291 |
|
8e1488905621
Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents:
298
diff
changeset
|
292 |
my $nd = scalar(@distincts); |
317
2ca4533db9fe
Add debug lines to help understanding why total releasables are not displayed correctly during the builds
Dario Sestito <darios@symbian.org>
parents:
313
diff
changeset
|
293 |
print "adding $package -> $nd to releaseables_by_package\n"; |
313
8e1488905621
Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents:
298
diff
changeset
|
294 |
$::releaseables_by_package->{$package} = $nd; |
8e1488905621
Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents:
298
diff
changeset
|
295 |
} |
8e1488905621
Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents:
298
diff
changeset
|
296 |
} |
8e1488905621
Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents:
298
diff
changeset
|
297 |
|
216
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
298 |
sub remove_missing_duplicates |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
299 |
{ |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
300 |
opendir(DIR, $::raptorbitsdir); |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
301 |
my @files = grep((-f "$::raptorbitsdir/$_" && $_ !~ /^\.\.?$/ && $_ =~ /_missing\.txt$/), readdir(DIR)); |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
302 |
close(DIR); |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
303 |
|
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
304 |
for my $file (@files) |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
305 |
{ |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
306 |
open(FILE, "+<$::raptorbitsdir/$file"); |
313
8e1488905621
Add number of releasables (by package) in the missing column
Dario Sestito <darios@symbian.org>
parents:
298
diff
changeset
|
307 |
#print "working on $file\n"; |
216
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
308 |
|
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
309 |
# Read it |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
310 |
my @content = <FILE>; |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
311 |
|
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
312 |
# Sort it, and grep to remove duplicates |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
313 |
my $previous = "\n\n"; |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
314 |
@content = grep {$_ ne $previous && ($previous = $_, 1) } sort @content; |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
315 |
|
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
316 |
# Write it |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
317 |
seek(FILE, 0, 0); |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
318 |
print FILE @content; |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
319 |
truncate(FILE,tell(FILE)); |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
320 |
|
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
321 |
close(FILE); |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
322 |
} |
2c2dbe93b84b
Uh parser to report on list of missing releaseables
Dario Sestito <darios@symbian.org>
parents:
177
diff
changeset
|
323 |
} |
177 | 324 |
|
325 |
sub normalize_filepath |
|
326 |
{ |
|
327 |
my ($filepath) = @_; |
|
328 |
||
329 |
if ($filepath =~ m,[^\s^\r^\n]+(.*)[\r\n]+(.*)[^\s^\r^\n]+,) |
|
330 |
{ |
|
331 |
print "WARNING: file path string extends over multiple line: $filepath. Removing all NL's and CR's\n"; |
|
332 |
} |
|
333 |
||
334 |
# strip all CR's and NL's |
|
335 |
$filepath =~ s,[\r\n],,g; |
|
336 |
||
337 |
# strip all whitespaces at string start/end |
|
338 |
$filepath =~ s,^\s+,,g; |
|
339 |
$filepath =~ s,\s+$,,g; |
|
340 |
||
341 |
# remove drive letter and colon from the beginning of the string |
|
342 |
$filepath =~ s,^[A-Za-z]:,,; |
|
343 |
||
344 |
# normalize slashes |
|
345 |
$filepath =~ s,\\,/,g; |
|
346 |
$filepath =~ s,//,/,g; |
|
347 |
||
348 |
if ($filepath !~ m,^/epoc32/,i) |
|
349 |
{ |
|
350 |
print "WARNING: file '$filepath' doesn't seem valid. Writing to info file anyway\n"; |
|
351 |
} |
|
352 |
||
353 |
return $filepath; |
|
354 |
} |
|
355 |
||
356 |
sub on_start_whatlog_default |
|
357 |
{ |
|
358 |
my ($el) = @_; |
|
359 |
||
360 |
my $tagname = $el->{LocalName}; |
|
361 |
||
362 |
print "WARNING: unsupported tag '$tagname' in <whatlog> context\n"; |
|
363 |
} |
|
364 |
||
365 |
1; |