author | Maciej Seroka <maciejs@symbian.org> |
Fri, 27 Aug 2010 17:52:32 +0100 | |
changeset 1232 | dbae6d7aeb52 |
parent 160 | 09e24be89e4b |
permissions | -rw-r--r-- |
131
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
1 |
#!/usr/bin/perl |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
2 |
|
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
3 |
# Copyright (c) 2009 Symbian Foundation Ltd |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
4 |
# This component and the accompanying materials are made available |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
5 |
# under the terms of the License "Eclipse Public License v1.0" |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
6 |
# which accompanies this distribution, and is available |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
7 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html". |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
8 |
# |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
9 |
# Initial Contributors: |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
10 |
# Symbian Foundation Ltd - initial contribution. |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
11 |
# |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
12 |
# Contributors: |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
13 |
# |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
14 |
# Description: |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
15 |
# Adds info form a file to a CSV |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
16 |
|
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
17 |
use strict; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
18 |
use HTTP::Date; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
19 |
|
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
20 |
my $srccsvfile = shift @ARGV; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
21 |
my $whatlogfile = shift @ARGV; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
22 |
my @sysmodelfiles = @ARGV; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
23 |
|
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
24 |
if(! -e $srccsvfile) |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
25 |
{ |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
26 |
die "cannot find $srccsvfile\n"; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
27 |
} |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
28 |
|
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
29 |
if(! -e $whatlogfile) |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
30 |
{ |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
31 |
die "cannot find $whatlogfile\n"; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
32 |
} |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
33 |
|
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
34 |
foreach my $sysmodelfile (@sysmodelfiles) |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
35 |
{ |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
36 |
if(! -e $sysmodelfile) |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
37 |
{ |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
38 |
die "cannot find $sysmodelfile\n"; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
39 |
} |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
40 |
} |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
41 |
|
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
42 |
# Search for timestamp threshold in whatlog file |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
43 |
# It corresponds to the first timestamp for which the target was genuinly rebuilt |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
44 |
# Every target that has a timestamp below is considered as not rebuilt properly |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
45 |
open(WHATLOG,"<$whatlogfile") or die "Error: Couldn't open $whatlogfile\n"; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
46 |
my %bldtimes; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
47 |
my $timestampLimit = 0; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
48 |
while (my $line = <WHATLOG>) |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
49 |
{ |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
50 |
if($line =~ m/,\s*(\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2})\s*$/){ |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
51 |
$bldtimes{str2time($1)} = $1; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
52 |
} |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
53 |
} |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
54 |
my $previoustime = 0; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
55 |
foreach my $decimaltime (sort(keys %bldtimes)) |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
56 |
{ |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
57 |
if ($previoustime == 0) {$previoustime = $decimaltime;} |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
58 |
if ( ($decimaltime - (30*60) ) > $previoustime ) |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
59 |
{ |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
60 |
$timestampLimit = $bldtimes{$decimaltime}; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
61 |
print "Timestamp Threshold found: $timestampLimit\n"; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
62 |
last; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
63 |
} |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
64 |
} |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
65 |
close(WHATLOG); |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
66 |
|
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
67 |
# Create the Package List from sources.csv |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
68 |
# And assign license type |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
69 |
# Everything that is not found FCL or MCL are considered RND |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
70 |
my @pkgList; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
71 |
open(SRCCSV,"<$srccsvfile") or die "Error: Couldn't open $srccsvfile\n"; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
72 |
while (my $line = <SRCCSV>) |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
73 |
{ |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
74 |
if ($line =~ m/^source,/) {next;} |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
75 |
if ($line =~ m/^([^,]+),\/([^,]+),/){ |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
76 |
my $pkglicense = $1; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
77 |
my $pkgpath=$2; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
78 |
if ($pkglicense =~ m/^[^,]+\/(\w+)\/(MCL|FCL)\/\w+/i) {$pkglicense = uc($1);} |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
79 |
else {$pkglicense = "RND";} |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
80 |
push @pkgList, "$pkgpath,$pkglicense"; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
81 |
} |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
82 |
} |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
83 |
print "Number of Packages to analyse: $#pkgList\n"; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
84 |
close(SRCCSV); |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
85 |
|
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
86 |
# Create System Definition Component List |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
87 |
my @sysdefcomplist; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
88 |
foreach my $sysdeffile (@sysmodelfiles) |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
89 |
{ |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
90 |
open(SYSDEF,"<$sysdeffile") or die "Error: Couldn't open $sysdeffile\n"; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
91 |
while (my $line = <SYSDEF>) |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
92 |
{ |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
93 |
if ($line =~ m/(\s*)<!--\s*(<.*?>)\s*-->/) {next;} |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
94 |
if ($line =~m/bldFile=\"([^"]*)"/i) |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
95 |
{ |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
96 |
#push @sysdefcomplist, &getComponentInfo($1); |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
97 |
push @sysdefcomplist, $1; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
98 |
} |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
99 |
} |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
100 |
close(SYSDEF); |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
101 |
} |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
102 |
|
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
103 |
# For each package in the list, process the whatlog to verify if it's built clean |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
104 |
# And build the final summary log |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
105 |
open(WHATLOG,"<$whatlogfile") or die "Error: Couldn't open $whatlogfile\n"; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
106 |
my @whatlogs = <WHATLOG>; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
107 |
my @outputList; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
108 |
foreach my $package (@pkgList) |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
109 |
{ |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
110 |
my $corruptbldinfcount = 0; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
111 |
# Write a CSV entry for pkgpath, license |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
112 |
my $pkgline = "$package"; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
113 |
# Search whatlog and match -> extract bldfiles -> clean vs not_clean |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
114 |
$package =~ s/,.*//; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
115 |
foreach my $whatlog (@whatlogs) |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
116 |
{ |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
117 |
if ($whatlog =~ /^[^,]+,($package\/[^,]+),[^,]*,[^,]*,[^,]*,[^,]*(,([^,]*))?(,([^,]*))?/) |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
118 |
{ |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
119 |
my $bldfilepath = $1; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
120 |
my $status = $3; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
121 |
my $timestamp = $5; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
122 |
if (($status =~ /fail/i) || ($status eq "") || |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
123 |
(($status =~ /untouched/i) and ($timestamp ne "") and (str2time($timestamp) < str2time($timestampLimit))) ) |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
124 |
{ |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
125 |
chomp($status);chomp($timestamp); |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
126 |
$status = "KO ($status - $timestamp)"; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
127 |
} |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
128 |
else {$status = "OK"; } |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
129 |
#if ($status =~ /KO/ ) {print "$pkgline,$bldfilepath,$status\n";} |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
130 |
push @outputList, "$pkgline,$bldfilepath,$status\n"; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
131 |
} |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
132 |
} |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
133 |
} |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
134 |
|
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
135 |
# Write the Full Analysis log |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
136 |
open(OUTPUT,">PkgComponentAnalysisFull.csv") or die "Error: Couldn't open PkgComponentAnalysisFull.csv for writing\n"; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
137 |
print OUTPUT "Package Path (from Sources.csv), License, BldFile (from whatlog), Status\n"; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
138 |
print OUTPUT @outputList; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
139 |
close(OUTPUT); |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
140 |
|
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
141 |
# Keep only uniq bldfile in the list |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
142 |
# And calculate final status |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
143 |
#my @uniq = keys %{{ map { $_ => 1 } @outputList }}; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
144 |
my %seen = (); |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
145 |
my $value; my $remains; my $status; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
146 |
foreach my $item (@outputList) { |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
147 |
$item =~ /^([^,]+,[^,]+,([^,]+)),([^,]+)/; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
148 |
$remains = $1; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
149 |
$value = $2; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
150 |
$status = $3; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
151 |
chomp($status); |
145
430173497dd4
Reorder the PkgComponentAnalysisSummary.csv columns, and change "KO" to "Bad".
William Roberts <williamr@symbian.org>
parents:
131
diff
changeset
|
152 |
if ($status ne "OK") {$status = "Bad"}; |
131
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
153 |
if ($seen{$value}) |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
154 |
{ |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
155 |
$seen{$value} =~ /^[^,]+,([^,]+)/; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
156 |
my $currentstatus = $1; |
145
430173497dd4
Reorder the PkgComponentAnalysisSummary.csv columns, and change "KO" to "Bad".
William Roberts <williamr@symbian.org>
parents:
131
diff
changeset
|
157 |
if ($currentstatus eq "Bad") |
131
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
158 |
{ |
145
430173497dd4
Reorder the PkgComponentAnalysisSummary.csv columns, and change "KO" to "Bad".
William Roberts <williamr@symbian.org>
parents:
131
diff
changeset
|
159 |
$status = "Bad"; |
131
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
160 |
} |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
161 |
} |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
162 |
$seen{$value} = "$remains,$status\n"; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
163 |
} |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
164 |
my @uniq = values(%seen); |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
165 |
|
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
166 |
# Prepend system model info (block name, component name) |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
167 |
foreach my $line (@uniq) |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
168 |
{ |
145
430173497dd4
Reorder the PkgComponentAnalysisSummary.csv columns, and change "KO" to "Bad".
William Roberts <williamr@symbian.org>
parents:
131
diff
changeset
|
169 |
chomp $line; |
131
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
170 |
if ($line =~ /^[^,]+,[^,]+,([^,]+),/) |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
171 |
{ |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
172 |
my $bldfile = $1; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
173 |
my $sysmodelinfo = &getSysModelInfo($bldfile); |
145
430173497dd4
Reorder the PkgComponentAnalysisSummary.csv columns, and change "KO" to "Bad".
William Roberts <williamr@symbian.org>
parents:
131
diff
changeset
|
174 |
$line = "$line, $sysmodelinfo\n"; |
131
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
175 |
} |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
176 |
} |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
177 |
|
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
178 |
|
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
179 |
# Write the summary log |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
180 |
open(OUTPUT,">PkgComponentAnalysisSummary.csv") or die "Error: Couldn't open PkgComponentAnalysisSummary.csv for writing\n"; |
160
09e24be89e4b
Add the missing column heading in PkgComponentAnalysisSummary.csv
William Roberts <williamr@symbian.org>
parents:
145
diff
changeset
|
181 |
print OUTPUT "Source Path (from Sources.csv), License, BldFile (from whatlog), Status, Package Name, Component Name\n"; |
131
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
182 |
print OUTPUT @uniq; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
183 |
close(OUTPUT); |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
184 |
close(WHATLOG); |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
185 |
|
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
186 |
# Status statistics |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
187 |
my $componentOkCount = 0; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
188 |
my $componentKoCount = 0; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
189 |
my $totalcompCount = 0; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
190 |
foreach my $line (@uniq) |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
191 |
{ |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
192 |
if ($line =~ /OK$/) {$componentOkCount++;} |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
193 |
else {$componentKoCount++;} |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
194 |
$totalcompCount++; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
195 |
} |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
196 |
print "Total number of Components: $totalcompCount\n"; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
197 |
print "Number of Components Cleanly rebuilt: $componentOkCount\n"; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
198 |
print "Number of Components not rebuilt properly: $componentKoCount\n"; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
199 |
|
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
200 |
|
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
201 |
|
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
202 |
sub getSysModelInfo |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
203 |
{ |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
204 |
my $bldfilepath = shift; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
205 |
|
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
206 |
# remove prepending sf dir, and trailing bld.inf |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
207 |
$bldfilepath =~ s/^sf\///; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
208 |
$bldfilepath =~ s/\/bld.inf$//i; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
209 |
#print "Looking for bldfile path: $bldfilepath ...\n"; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
210 |
|
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
211 |
my $packageName = ""; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
212 |
my $componentName = ""; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
213 |
|
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
214 |
MODEL_LOOP: foreach my $sysmodelfile (@sysmodelfiles) |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
215 |
{ |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
216 |
open(SYSFILE,"<$sysmodelfile") or die "Error: Couldn't open $sysmodelfile\n"; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
217 |
my @model_lines = <SYSFILE>; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
218 |
foreach my $line (@model_lines) |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
219 |
{ |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
220 |
$line =~ s/\\/\//g; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
221 |
|
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
222 |
if ($line =~ m/bldFile=\"$bldfilepath"/i) |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
223 |
{ |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
224 |
#print "Component $packageName/$componentName found in model $sysmodelfile\n"; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
225 |
last MODEL_LOOP; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
226 |
} |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
227 |
elsif ($line =~ m/<component/) |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
228 |
{ |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
229 |
$line =~m/\slong-name="([^"]*)"/; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
230 |
$componentName = $1; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
231 |
} |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
232 |
elsif ($line=~ m/<\/component/) |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
233 |
{ |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
234 |
$componentName = ""; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
235 |
} |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
236 |
elsif ($line =~ m/<block/) |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
237 |
{ |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
238 |
$line =~m/\slong-name="([^"]*)"/; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
239 |
$packageName = $1; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
240 |
} |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
241 |
elsif ($line=~ m/<\/block/) |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
242 |
{ |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
243 |
$packageName = ""; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
244 |
} |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
245 |
} |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
246 |
close(SYSFILE); |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
247 |
} |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
248 |
|
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
249 |
# One mode file remains open if match found |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
250 |
if ($packageName ne "") { close(SYSFILE)} |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
251 |
|
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
252 |
return "$packageName, $componentName"; |
1f3285cd5668
Added analyse_components.pl and related call to build.xml
thomase
parents:
diff
changeset
|
253 |
} |