#!/usr/bin/perl
my $some_dir="output";
opendir(DIR, $some_dir) || die "can't opendir $some_dir: $!";
@logs = sort grep { /^allbuilds/ && -f "$some_dir/$_" } readdir(DIR);
closedir DIR;
my $building = $ARGV[0];
my @b;
my @rounds;
my %round;
my %dir; # hash per type for build dir
# number of builds in the output table
my $numout = 20;
sub nicehead {
my ($file, $title)=@_;
open(NICE, ">$file");
open(READ, ") {
s/_PAGE_/$title/;
print NICE $_;
}
close(NICE);
close(READ);
}
sub nicefoot {
my ($file, $date)=@_;
open(NICE, ">>$file");
open(READ, "
Back to daily builds / CVS builds
How To Add a Build Server to the build farm.
MOO
;
while() {
s/_PAGE_/$date/;
print NICE $_;
}
close(NICE);
close(READ);
}
sub urlencode {
shift() if ref($_[0]) || $_[0] eq $DefaultClass;
my $toencode = shift;
return undef unless defined($toencode);
$toencode=~s/([^a-zA-Z0-9_.-])/uc sprintf("%%%02x",ord($1))/eg;
return $toencode;
}
my $build=0;
sub log2html {
my ($file)=@_;
my $log=0;
my $bigstart=-1;
open(LOG, "<$file");
while() {
$line = $_;
if($line =~ /^Build Server: (.*)/) {
$lserver = $1;
}
elsif($line =~ /^Build Time: (\d+)/) {
$btime = $1;
}
elsif( $line =~ /^Build End All Systems/) {
# this is how a complete build round MUST stop
$bigstart=0;
}
if(!$log) {
if( $line =~ /^Build Start All Systems/) {
if($bigstart > 0) {
# the round was not completed properly until this new one
# starts so we don't care of the previous one but instead
# try to hide it
}
else {
$bigstart=1;
$build++; # number of this "round"
push @rounds, $build;
}
}
elsif($line =~ /^Build Start Single/) {
}
elsif($line =~ /^Build Date: (.*)/) {
$date = $1;
}
elsif($line =~ /^Build Dir: (.*)/) {
# usually after the build type
$dir{$type}=$1;
}
elsif($line =~ /^Build Type: (.*)/) {
$type = $1;
push @b, $type.$date;
$alltypes{$type}.="$date%";
# remember all types in this round
$round{$build}.= "$type$date%";
}
elsif($line =~ /^Build Status: (.*)/) {
$status{$type.$date} = $1;
$type{$type.$date} = $type;
$date{$type.$date} = $date;
$server{$type.$date} = $lserver;
}
elsif($line =~ /^Build Log Start/) {
$btime{$type.$date} = $btime;
$log = 1;
}
}
else {
if($line =~ /^Build Log End/) {
$log = 0;
}
else {
$compile{$type.$date} .= $line;
if($line =~ /^([^:]*):(\d*):.*warning: (.*)/) {
if($3 !~ /\(near/) {
# we don't count "(near" comments as warnings
$warnings{$type.$date}++;
}
}
elsif(($line =~ /^([^:]+):(\d+):(.+)/) ||
($line =~ /: undefined reference to/) ||
($line =~ /gcc: .*: No such file or/) ||
($line =~ /ld returned (\d+) exit status/) ||
($line =~ /^ *make\[.*\*\*\*/) ) {
# error
$errors{$type.$date}++;
# print STDERR "Error $type $date $1 $2\n";
}
}
}
}
}
for(@logs) {
log2html("$some_dir/$_");
}
#printf( " %d different builds\n", scalar(keys %alltypes));
print "
| Timestamp | \n";
foreach $t (sort keys %alltypes) {
my $alt = $t;
$alt =~ s/FM Recorder/FM/;
$alt =~ s/Playerold/P-old/;
$alt =~ s/Player/Play/;
$alt =~ s/Recorder/Rec/;
$alt =~ s/Debug/Dbg/;
$alt =~ s/Normal//;
$alt =~ s/Simulator/Sim/;
$alt =~ s/-//g;
$alt =~ s/ +/ /g;
printf (" | \n", $dir{$t});
}
print "score | ";
print "
\n";
open(IN, "
%d builds in %d seconds (%dmins %dsecs) makes %.1f seconds/build\n",
$numbuilds, $prevtime, $prevtime/60, $prevtime%60, $prevtime/$numbuilds;