summaryrefslogtreecommitdiff
path: root/www/showlog.cgi
blob: 06ef35154dda55f6b19d78e32e28baf332e675b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/usr/bin/perl

require "CGI.pm";

$req = new CGI;

$date = $req->param('date');
$type = $req->param('type');

print "Content-Type: text/html\n\n";

print <<MOO
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<link rel="STYLESHEET" type="text/css" href="/style.css">
<title>Rockbox: $type $date</title>
<meta name="author" content="Daniel Stenberg, in perl">
</head>
<body bgcolor="#b6c6e5" text="black" link="blue" vlink="purple" alink="red"
      topmargin=3 leftmargin=4 marginwidth=4 marginheight=4>
MOO
    ;


print "<h1>$date, $type</h1>\n";

my @o;
my $prob;
my $lserver;
my $buildtime;

if($date =~ /(....)-(..)-(..)/) {
    my $file = "allbuilds-$1$2$3";

    open(LOG, "</home/dast/rockbox-distbuild/output/$file");
    while(<LOG>) {
        if($_ =~ /^Build Server: (.*)/) {
            $lserver = $1;
        }
        if($_ =~ /^Build Time: (.*)/) {
            $buildtime = $1;
        }
        if( $_  =~ /^Build Date: (.*)/) {
            if($date eq $1) {
                $match++;
            }
            else {
                $match=0;
            }
        }
        elsif( $_  =~ /^Build Type: (.*)/) {
            if($type eq $1) {
                $match++;
            }
            else {
                $match=0;
            }
        }
        elsif(($match == 2) &&
              ($_  =~ /^Build Log Start/)) {
            $match++;
            push @o, "<div class=\"gccoutput\">";
        }
        elsif($match == 3) {
            if($_  =~ /^Build Log End/) {
                $match=0;
            }
            else {
                my $class="";
                $_ =~ s:/home/dast/rockbox-auto/::g;
                $line = $_;
                chomp $line;

                if($lserver) {
                    push @o, "Built on <b>$lserver</b> in $buildtime seconds<br>";
                    $lserver="";
                }

                if($line =~ /^([^:]*):(\d*):.*warning:/) {
                    $prob++;
                    push @o, "<a name=\"prob$prob\"></a>\n";
                    push @o, "<div class=\"gccwarn\">$line</div>\n";
                }
                elsif($line =~ /^([^:]*):(\d+):/) {
                    $prob++;
                    push @o, "<a name=\"prob$prob\"></a>\n";
                    push @o, "<div class=\"gccerror\">$line</div>\n";
                }
                elsif($line =~ /(: undefined reference to|ld returned (\d+) exit status|gcc: .*: No such file or)/) {
                    $prob++;
                    push @o, "<a name=\"prob$prob\"></a>\n";
                    push @o, "<div class=\"gccerror\">$line</div>\n";
                }
                else {
                    push @o, "$line\n<br>\n";
                }
            }
        }
    }
    close(LOG);

    if($prob) {
        print "Goto problem: ";
        my $p;
        foreach $p (1 .. $prob) {
            print "<a href=\"#prob$p\">$p</a>\n";
            if($p == 5) {
                last;
            }
        }
        if($prob > 5 ) {
            print "... <a href=\"#prob$prob\">last</a>\n";
        }

        print "<p>\n";
    }

    print @o;

    print "</div></body></html>\n";

}