2 # This CGI script presents the results of the build_farm build
4 # Copyright (C) Andrew Tridgell <tridge@samba.org> 2001-2005
5 # Copyright (C) Andrew Bartlett <abartlet@samba.org> 2001
6 # Copyright (C) Vance Lankhaar <vance@samba.org> 2002-2005
7 # Copyright (C) Martin Pool <mbp@samba.org> 2001
8 # Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 2 of the License, or
13 # (at your option) any later version.
15 # This program is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write to the Free Software
22 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 # TODO: Allow filtering of the "Recent builds" list to show
25 # e.g. only broken builds or only builds that you care about.
29 use FindBin qw($RealBin);
36 use CGI qw/:standard/;
39 my $WEBDIR = "$RealBin";
40 my $BASEDIR = "$WEBDIR/..";
41 my $CACHEDIR = "$WEBDIR/../cache";
46 my $DEADAGE = 60*60*24*4;
48 ##############################################
49 # this defines what it is possible to build
50 # and what boxes. Should be in a config file
51 my @compilers = util::load_list("$WEBDIR/compilers.list");
52 my (%hosts) = util::load_hash("$WEBDIR/hosts.list");
53 my @hosts = sort { $hosts{$a} cmp $hosts{$b} } keys %hosts;
54 my (%trees) = util::load_hash("$WEBDIR/trees.list");
55 # these aren't really trees... they're just things we want in the menu.
56 # (for recent checkins)
57 my @pseudo_trees = util::load_list("$WEBDIR/pseudo.list");
59 # this is automatically filled in
62 ###############################################
63 # URL so I can refer to myself in links
64 my $myself = $req->url();
66 ################################################
70 print start_html(-title => 'samba.org build farm',
71 -script => {-language=> 'JAVASCRIPT', -src=>"/build_farm.js" },
73 -keywords => "Samba SMB CIFS Build Farm",
74 -description => "Home of the Samba Build Farm, the automated testing facility.",
79 Link({-rel => "stylesheet",
80 -href => "build_farm.css",
83 Link({-rel => "stylesheet",
84 -href => "http://master.samba.org/samba/style/common.css",
87 Link({-rel=>"shortcut icon",
88 -href=>"http://www.samba.org/samba/images/favicon.ico"})
92 print util::FileLoad("$BASEDIR/web/header2.html");
94 print util::FileLoad("$BASEDIR/web/header3.html");
97 ################################################
100 print util::FileLoad("$BASEDIR/web/footer.html");
101 print $req->end_html;
104 ################################################
105 # print an error on fatal errors
110 print $req->h1("ERROR: $msg");
115 ################################################
116 # get a param from the request, after sanitizing it
120 if (!defined $req->param($param)) {
121 return wantarray ? () : undef;
126 @result = $req->param($param);
128 $result[0] = $req->param($param);
131 for (my $i = 0; $i <= $#result; $i++) {
132 $result[$i] =~ s/ /_/g;
136 if ($_ =~ m/[^a-zA-Z0-9\-\_\.]/) {
137 fatal("Parameter $param is invalid");
138 return wantarray ? () : undef;
142 return wantarray ? @result : $result[0];
145 ################################
146 # get the name of the build file
147 sub build_fname($$$$)
149 my ($tree, $host, $compiler, $rev) = @_;
151 return "oldrevs/build.$tree.$host.$compiler-$rev";
153 return "build.$tree.$host.$compiler";
156 ###########################################
157 # get a list of old builds and their status
158 sub get_old_revs($$$)
160 my ($tree, $host, $compiler) = @_;
161 my @list = split('\n', `ls oldrevs/build.$tree.$host.$compiler-*.log`);
164 if ($l =~ /-(\d+).log$/) {
166 $ret{$rev} = build_status($host, $tree, $compiler, $rev);
174 # the mtime age is used to determine if builds are still happening
176 # the ctime age is used to determine when the last real build happened
178 ##############################################
179 # get the age of build from mtime
180 sub build_age_mtime($$$$)
182 my ($host, $tree, $compiler, $rev) = @_;
183 my $file=build_fname($tree, $host, $compiler, $rev);
187 $st = stat("$file.log");
189 $age = time() - $st->mtime;
195 ##############################################
196 # get the age of build from ctime
197 sub build_age_ctime($$$$)
199 my ($host, $tree, $compiler, $rev) = @_;
200 my $file = build_fname($tree, $host, $compiler, $rev);
204 $st = stat("$file.log");
206 $age = time() - $st->ctime;
212 ##############################################
213 # get the svn revision of build
214 sub build_revision($$$$)
216 my ($host, $tree, $compiler, $rev) = @_;
217 my $file = build_fname($tree, $host, $compiler, $rev);
225 my $st1 = stat("$file.log");
230 my $st2 = stat("$CACHEDIR/$file.revision");
232 # the ctime/mtime asymmetry is needed so we don't get fooled by
233 # the mtime update from rsync
234 if ($st1 && $st2 && $st1->ctime <= $st2->mtime) {
235 return util::FileLoad("$CACHEDIR/$file.revision");
238 $log = util::FileLoad("$file.log");
240 if ($log =~ /BUILD REVISION:(.*)/) {
244 util::FileSave("$CACHEDIR/$file.revision", "$ret");
249 #############################################
250 # get the overall age of a host
255 for my $compiler (@compilers) {
256 for my $tree (keys %trees) {
257 my $age = build_age_mtime($host, $tree, $compiler, "");
258 if ($age != -1 && ($age < $ret || $ret == -1)) {
266 #############################################
267 # show an age as a string
272 if ($age > $OLDAGE) {
273 return $req->span({-class=>"old"}, util::dhm_time($age));
275 return util::dhm_time($age);
278 ##############################################
279 # get status of build
280 sub build_status($$$$)
282 my ($host, $tree, $compiler, $rev) = @_;
283 my $file = build_fname($tree, $host, $compiler, $rev);
284 my $cachefile="$CACHEDIR/" . $file . ".status";
285 my ($cstatus, $bstatus, $istatus, $tstatus, $sstatus, $dstatus);
286 $cstatus = $bstatus = $istatus = $tstatus = $sstatus = $dstatus =
287 "<span class=\"status unknown\">?</span>";
292 my $st1 = stat("$file.log");
294 return "Unknown Build";
296 my $st2 = stat("$cachefile");
298 if ($st1 && $st2 && $st1->ctime <= $st2->mtime) {
299 return util::FileLoad($cachefile);
302 $log = util::FileLoad("$file.log");
304 if ($log =~ /TEST STATUS:([0-9]+)/) {
306 $tstatus = "<span class=\"status passed\">ok</span>";
308 $tstatus = "<span class=\"status failed\">$1</span>";
312 if ($log =~ /INSTALL STATUS:(.*)/) {
314 $istatus = "<span class=\"status passed\">ok</span>";
316 $istatus = "<span class=\"status failed\">$1</span>";
320 if ($log =~ /BUILD STATUS:(.*)/) {
322 $bstatus = "<span class=\"status passed\">ok</span>";
324 $bstatus = "<span class=\"status failed\">$1</span>";
328 if ($log =~ /CONFIGURE STATUS:(.*)/) {
330 $cstatus = "<span class=\"status passed\">ok</span>";
332 $cstatus = "<span class=\"status failed\">$1</span>";
336 if ($log =~ /(PANIC|INTERNAL ERROR):.*/ ) {
337 $sstatus = "/<span class=\"status panic\">PANIC</span>";
342 if ($log =~ /No space left on device.*/ ) {
343 $dstatus = "/<span class=\"status failed\">disk full</span>";
348 if ($log =~ /CC_CHECKER STATUS: (.*)/ && $1 > 0) {
349 $sstatus .= "/<span class=\"status checker\">$1</span>";
352 $ret = "<a href=\"$myself?function=View+Build;host=$host;tree=$tree;compiler=$compiler";
354 $ret .= ";revision=$rev";
356 $ret .= "\">$cstatus/$bstatus/$istatus/$tstatus$sstatus$dstatus</a>";
358 util::FileSave("$CACHEDIR/$file.status", $ret);
363 ##############################################
364 # translate a status into a set of int representing status
365 sub build_status_vals($) {
366 my $status = util::strip_html(shift);
370 $status =~ s/PANIC/1/g;
372 return split m%/%, $status;
375 ##############################################
376 # get status of build
379 my ($host, $tree, $compiler, $rev) = @_;
380 my $file = build_fname($tree, $host, $compiler, $rev);
383 my $st1 = stat("$file.err");
387 my $st2 = stat("$CACHEDIR/$file.errcount");
389 if ($st1 && $st2 && $st1->ctime <= $st2->mtime) {
390 return util::FileLoad("$CACHEDIR/$file.errcount");
393 $err = util::FileLoad("$file.err") or return 0;
395 my $ret = util::count_lines($err);
397 util::FileSave("$CACHEDIR/$file.errcount", "$ret");
402 ##############################################
404 sub view_summary($) {
406 my $list = `ls *.log`;
410 # either "text" or anything else.
411 my $output_type = shift;
418 # zero broken and panic counters
419 for my $tree (keys %trees) {
420 $broken_count{$tree} = 0;
421 $panic_count{$tree} = 0;
422 $host_count{$tree} = 0;
425 # set up a variable to store the broken builds table's code, so we can output when we want
426 my $broken_table = "";
430 # for the text report, include the current time
431 if ($output_type eq 'text') {
433 print "Build status as of $time\n\n";
436 for my $host (@hosts) {
437 for my $compiler (@compilers) {
438 for my $tree (keys %trees) {
439 my $status = build_status($host, $tree, $compiler, "");
440 next if $status =~ /^Unknown Build/;
441 my $age_mtime = build_age_mtime($host, $tree, $compiler, "");
443 if ($age_mtime != -1 && $age_mtime < $DEADAGE) {
444 $host_count{$tree}++;
447 if ($age_mtime < $DEADAGE && $status =~ /status failed/) {
448 $broken_count{$tree}++;
449 if ($status =~ /PANIC/) {
450 $panic_count{$tree}++;
457 if ($output_type eq 'text') {
458 print "Build counts:\n";
459 printf "%-12s %-6s %-6s %-6s\n", "Tree", "Total", "Broken", "Panic";
462 print $req->start_div(-id=>"build-counts", -class=>"build-section");
463 print $req->h2('Build counts:');
464 print $req->start_table({-class => "real"}),
466 $req->Tr($req->th("Tree"), $req->th("Total"),
467 $req->th("Broken"), $req->th("Panic"))),
471 for my $tree (sort keys %trees) {
472 if ($output_type eq 'text') {
473 printf "%-12s %-6s %-6s %-6s\n", $tree, $host_count{$tree},
474 $broken_count{$tree}, $panic_count{$tree};
476 print $req->start_Tr;
477 print $req->td($req->a({-href=>"$myself?function=Recent+Builds;tree=$tree",
478 -title=>"View recent builds for $tree"}, $tree));
479 print $req->td($host_count{$tree});
480 print $req->td($broken_count{$tree});
481 if ($panic_count{$tree}) {
482 print $req->start_td({-class => "panic"});
484 print $req->start_td;
486 print $panic_count{$tree} . $req->end_td;
491 if ($output_type eq 'text') {
494 print $req->end_tbody, $req->end_table;
499 ##############################################
500 # Draw the "recent builds" view
501 sub view_recent_builds() {
509 my $sort = { revision => sub { $$b[6] <=> $$a[6] },
510 age => sub { $$a[0] <=> $$b[0] },
511 host => sub { $$a[2] cmp $$b[2] },
512 platform => sub { $$a[1] cmp $$b[1] },
513 compiler => sub { $$a[3] cmp $$b[3] },
515 my (@bstat) = build_status_vals($$b[5]);
516 my (@astat) = build_status_vals($$a[5]);
519 if (defined $bstat[4] && !defined $astat[4]) {
521 } elsif (!defined $bstat[4] && defined $astat[4]) {
524 return ($bstat[0] <=> $astat[0] || # configure
525 $bstat[1] <=> $astat[1] || # compile
526 $bstat[2] <=> $astat[2] || # install
527 $bstat[3] <=> $astat[3] # test
532 my $tree = get_param("tree");
533 my $sort_by = get_param("sortby") || "revision"; # default to revision
535 util::InArray($tree, [keys %trees]) || fatal("not a build tree");
536 util::InArray($sort_by, [keys %$sort]) || fatal("not a valid sort");
538 for my $host (@hosts) {
539 for my $compiler (@compilers) {
540 my $status = build_status($host, $tree, $compiler, "");
541 my $age_mtime = build_age_mtime($host, $tree, $compiler, "");
542 my $age_ctime = build_age_ctime($host, $tree, $compiler, "");
543 my $revision = build_revision($host, $tree, $compiler, "");
544 push @all_builds, [$age_ctime, $hosts{$host}, $req->a({-href=>"$myself?function=View+Host;host=$host;tree=$tree;compiler=$compiler#$host"}, $host), $compiler, $tree, $status, $revision]
545 unless $age_mtime == -1 or $age_mtime >= $DEADAGE;
549 @all_builds = sort { $sort->{$sort_by}() || $sort->{age}() } @all_builds;
551 my $sorturl = "$myself?tree=$tree;function=Recent+Builds";
553 print $req->start_div(-id=>"recent-builds", -class=>"build-section"),
554 $req->h2("Recent builds of $tree");
556 print $req->start_table({-class => "real"}),
559 $req->th($req->a({-href => "$sorturl;sortby=age",
560 -title => "Sort by build age"}, "Age")),
561 $req->th($req->a({-href => "$sorturl;sortby=revision",
562 -title => "Sort by build revision"},
565 $req->th($req->a({-href => "$sorturl;sortby=platform",
566 -title => "Sort by platform"}, "Platform")),
567 $req->th($req->a({-href => "$sorturl;sortby=host",
568 -title => "Sort by host"}, "Host")),
569 $req->th($req->a({-href=>"$sorturl;sortby=compiler",
570 -title=>"Sort by compiler"}, "Compiler")),
571 $req->th($req->a({-href=>"$sorturl;sortby=status",
572 -title=>"Sort by build status"}, "Status"))
577 for my $build (@all_builds) {
578 my $age_mtime = $$build[0];
579 my $rev = $$build[6];
581 $req->td(util::dhm_time($age_mtime)),
583 $req->td($$build[4]),
584 $req->td($$build[1]),
585 $req->td($$build[2]),
586 $req->td($$build[3]),
587 $req->td($$build[5]));
589 print $req->end_tbody, $req->end_table;
593 ##############################################
594 # Draw the "dead hosts" table
595 sub draw_dead_hosts {
596 my $output_type = shift;
599 # don't output anything if there are no dead hosts
600 return if ($#deadhosts < 0);
602 # don't include in text report
603 return if ($output_type eq 'text');
605 print $req->start_div(-class => "build-section", -id=>"dead-hosts"),
606 $req->h2('Dead Hosts:');
607 print $req->start_table({-class => "real"}),
610 $req->th("Host"), $req->th("OS"),
611 $req->th("Min Age"))),
614 for my $host (@deadhosts) {
615 my $age_ctime = host_age($host);
616 print $req->tr($req->td($host), $req->td($hosts{$host}),
617 $req->td(util::dhm_time($age_ctime)));
620 print $req->end_tbody, $req->end_table;
624 ##############################################
625 # show the available old revisions, if any
626 sub show_oldrevs($$$)
628 my ($tree, $host, $compiler) = @_;
629 my %revs = get_old_revs($tree, $host, $compiler);
630 my @revs = sort { $revs{$b} cmp $revs{$a} } keys %revs;
632 return if ($#revs < 1);
634 print $req->h2("Older builds:");
636 print $req->start_table({-class => "real"}),
639 $req->th("Revision"),
640 $req->th("Status"))),
645 for my $rev (@revs) {
648 next if ($s eq $lastrev);
650 print $req->Tr($req->td($rev), $req->td($revs{$rev}));
652 print $req->end_tbody, $req->end_table;
655 ##############################################
656 # view one build in detail
658 my $tree=get_param("tree");
659 my $host=get_param("host");
660 my $compiler=get_param("compiler");
661 my $rev=get_param('revision');
663 # ensure the params are valid before using them
664 util::InArray($host, [keys %hosts]) || fatal("unknown host");
665 util::InArray($compiler, \@compilers) || fatal("unknown compiler");
666 util::InArray($tree, [keys %trees]) || fatal("not a build tree");
668 my $file=build_fname($tree, $host, $compiler, $rev);
674 my $age_mtime = build_age_mtime($host, $tree, $compiler, $rev);
675 my $revision = build_revision($host, $tree, $compiler, $rev);
676 my $status = build_status($host, $tree, $compiler, $rev);
678 $rev = int($rev) if $rev;
680 $log = util::FileLoad("$file.log");
681 $err = util::FileLoad("$file.err");
684 $log = escapeHTML($log);
686 if ($log =~ /(.*)/) { $uname=$1; }
687 if ($log =~ /CFLAGS=(.*)/) { $cflags=$1; }
688 if ($log =~ /configure options: (.*)/) { $config=$1; }
692 $err = escapeHTML($err);
695 print $req->h2('Host information:');
697 print util::FileLoad("../web/$host.html");
699 print $req->table({-class=>"real"},
701 $req->td(["Host:", $req->a({-href=>"$myself?function=View+Host;host=$host;tree=$tree;compiler=$compiler#$host"}, $host)." - $hosts{$host}"]),
702 $req->td(["Uname:", $uname]),
703 $req->td(["Tree:", $tree]),
704 $req->td(["Build Revision:", $revision]),
705 $req->td(["Build age:", "<div class=\"age\">" . red_age($age_mtime) . "</div>"]),
706 $req->td(["Status:", $status]),
707 $req->td(["Compiler:", $compiler]),
708 $req->td(["CFLAGS:", $cflags]),
709 $req->td(["configure options:", $config])]));
711 show_oldrevs($tree, $host, $compiler);
713 # check the head of the output for our magic string
714 my $plain_logs = (defined get_param("plain") &&
715 get_param("plain") =~ /^(yes|1|on|true|y)$/i);
718 $rev_var = ";revision=$rev";
721 print $req->start_div(-id=>"log");
725 print $req->p("Switch to the ".$req->a({-href => "$myself?function=View+Build;host=$host;tree=$tree;compiler=$compiler$rev_var;plain=true", -title=> "Switch to bland, non-javascript, unstyled view"}, "Plain View"));
727 print $req->start_div(-id=>"actionList");
728 # These can be pretty wide -- perhaps we need to
729 # allow them to wrap in some way?
731 print $req->h2("No error log available");
733 print $req->h2("Error log:");
734 print make_collapsible_html('action', "Error Output", "\n$err", "stderr-0");
738 print $req->h2("No build log available");
740 print $req->h2("Build log:");
741 print_log_pretty($log);
744 print $req->p($req->small("Some of the above icons derived from the <a href=\"http://www.gnome.org\">Gnome Project</a>'s stock icons."));
747 print $req->p("Switch to the <a href=\"$myself?function=View+Build;host=$host;tree=$tree;compiler=$compiler$rev_var\" title=\"Switch to colourful, javascript-enabled, styled view \">Enhanced View</a>");
749 print $req->h2("No error log available");
751 print $req->h2('Error log:');
752 print $req->div({-id=>"errorLog"}, $req->pre(join('', $err)));
755 print $req->h2('No build log available');
758 print $req->h2('Build log:');
759 print $req->div({-id=>"buildLog"}, $req->pre(join('', $log)));
766 ##################################################
767 # print the host's table of information
770 my $output_type = "html";
772 if ($output_type eq 'text') {
773 print "Host summary:\n";
775 print $req->start_div({-class=>"build-section", -id=>"build-summary"});
776 print $req->h2('Host summary:');
779 my $list = `ls *.log`;
781 my (@requested_hosts) = get_param('host');
783 foreach (@requested_hosts) {
784 util::InArray($_, [keys %hosts]) || fatal("unknown host");
787 for my $host (@requested_hosts) {
788 # make sure we have some data from it
789 if (! ($list =~ /$host/)) {
790 if ($output_type ne 'text') {
791 print "<!-- skipping $host -->\n";
798 for my $compiler (@compilers) {
799 for my $tree (sort keys %trees) {
800 my $revision = build_revision($host, $tree, $compiler, "");
801 my $age_mtime = build_age_mtime($host, $tree, $compiler, "");
802 my $age_ctime = build_age_ctime($host, $tree, $compiler, "");
803 my $warnings = err_count($host, $tree, $compiler, "");
804 if ($age_ctime != -1 && $age_ctime < $DEADAGE) {
805 my $status = build_status($host, $tree, $compiler, "");
807 if ($output_type eq 'text') {
808 printf "%-12s %-10s %-10s %-10s %-10s\n",
809 "Tree", "Compiler", "Build Age", "Status", "Warnings";
812 print $req->start_div({-class=>"host summary"});
814 <a id="$host" name="$host" />
815 <h3>$host - $hosts{$host}</h3>
819 <th>Target</th><th>Build<br />Revision</th><th>Build<br />Age</th><th>Status<br />config/build<br />install/test</th><th>Warnings</th>
827 if ($output_type eq 'text') {
828 printf "%-12s %-10s %-10s %-10s %-10s\n",
829 $tree, $compiler, util::dhm_time($age_mtime),
830 util::strip_html($status), $warnings;
832 print " <tr><td><span class=\"tree\">$tree</span>/$compiler</td><td>$revision</td><td class=\"age\">" . red_age($age_mtime) . "</td><td class=\"status\">$status</td><td>$warnings</td></tr>\n";
839 if ($output_type eq 'text') {
842 print " </tbody>\n</table>\n";
846 push(@deadhosts, $host);
850 if ($output_type ne 'text') {
854 draw_dead_hosts($output_type, @deadhosts);
857 ##############################################
858 # prints the log in a visually appealing manner
859 sub print_log_pretty() {
862 # do some pretty printing for the actions
865 Running\ action\s+([\w\-]+)
867 ACTION\ (PASSED|FAILED):\ ([\w\-]+)
873 # handle pretty-printing of static-analysis tools
874 if ($actionName eq 'cc_checker') {
875 $output = print_log_cc_checker($output);
878 make_collapsible_html('action', $actionName, $output, $id++,
882 # $log is already CGI-escaped, so handle '>' in test name by handling >
884 --==--==--==--==--==--==--==--==--==--==--.*?
885 Running\ test\ ([\w\-=,_:\ /.&;]+).*?
886 --==--==--==--==--==--==--==--==--==--==--
888 ==========================================.*?
889 TEST\ (FAILED|PASSED|SKIPPED):.*?
890 ==========================================\s+
891 }{make_collapsible_html('test', $1, $2, $id++, $3)}exgs;
893 print $req->tt($req->pre(join('', $log)))."<p>\n";
896 ##############################################
897 # generate pretty-printed html for static analysis tools
898 sub print_log_cc_checker($) {
902 # for now, we only handle the IBM Checker's output style
903 if ($input !~ m/^BEAM_VERSION/ms) {
911 my ($entry, $title, $status, $id);
913 foreach (split /\n/, $input) {
915 # for each line, check if the line is a new entry,
916 # otherwise, store the line under the current entry.
921 $output .= make_collapsible_html('cc_checker', $title, $content,
927 # clear maintenance vars
928 ($inEntry, $content) = (1, "");
931 m/^-- ((ERROR|WARNING|MISTAKE).*?)\s+>>>([a-zA-Z0-9]+_(\w+)_[a-zA-Z0-9]+)/;
933 # then store the result
934 ($title, $status, $id) = ("$1 $4", $2, $3);
935 } elsif (m/^CC_CHECKER STATUS/) {
937 $output .= make_collapsible_html('cc_checker', $title, $content,
945 # not a new entry, so part of the current entry's output
950 # This function does approximately the same as the following, following
951 # commented-out regular expression except that the regex doesn't quite
952 # handle IBM Checker's newlines quite right.
954 # --\ ((ERROR|WARNING|MISTAKE).*?)\s+
958 # }{make_collapsible_html('cc_checker', "$1 $4", $5, $3, $2)}exgs;
962 ##############################################
963 # generate html for a collapsible section
964 sub make_collapsible_html($$$$)
966 my ($type, # the logical type of it. e.g. "test" or "action"
967 $title, # the title to be displayed
969 my $status = (shift or "");
971 my $icon = (defined $status && ($status =~ /failed/i)) ? 'icon_hide_16.png' : 'icon_unhide_16.png';
973 # trim leading and trailing whitespace
974 $output =~ s/^\s+//s;
975 $output =~ s/\s+$//s;
977 # note that we may be inside a <pre>, so we don't put any extra whitespace in this html
978 my $return = $req->div({-class=>"$type unit $status",
980 $req->a({-href=>"javascript:handle('$id');"},
981 $req->img({-id=>"img-$id", -name=>"img-$id",
983 $req->div({-class => "$type title"}, $title),
985 $req->div({-class=> "$type status $status"}, $status) .
986 $req->div({-class => "$type output", -id=>"output-$id"},
987 $req->pre($output)));
992 ##############################################
995 print $req->startform("GET");
996 print $req->start_div(-id=>"build-menu");
997 print $req->popup_menu(-name=>'host',
999 -labels=>\%hosts) . "\n";
1000 print $req->popup_menu("tree", [sort (keys %trees, @pseudo_trees)]) . "\n";
1001 print $req->popup_menu("compiler", \@compilers) . "\n";
1003 print $req->submit('function', 'View Build') . "\n";
1004 print $req->submit('function', 'View Host') . "\n";
1005 print $req->submit('function', 'Recent Checkins') . "\n";
1006 print $req->submit('function', 'Summary') . "\n";
1007 print $req->submit('function', 'Recent Builds') . "\n";
1008 print $req->end_div;
1009 print $req->endform() . "\n";
1012 ###############################################
1013 # display top of page
1016 chdir("$BASEDIR/data") || fatal("can't change to data directory");
1019 ###############################################
1022 my $fn_name = get_param('function') || '';
1024 if ($fn_name eq 'text_diff') {
1025 print header('application/x-diff');
1026 chdir("$BASEDIR/data") || fatal("can't change to data directory");
1027 history::diff(get_param('author'),
1030 get_param('revision'),
1032 } elsif ($fn_name eq 'Text_Summary') {
1033 print header('text/plain');
1034 chdir("$BASEDIR/data") || fatal("can't change to data directory");
1035 view_summary('text');
1039 if ($fn_name eq "View_Build") {
1041 } elsif ($fn_name eq "View_Host") {
1043 } elsif ($fn_name eq "Recent_Builds") {
1044 view_recent_builds();
1045 } elsif ($fn_name eq "Recent_Checkins") {
1046 history::history(get_param('tree'));
1047 } elsif ($fn_name eq "diff") {
1048 history::diff(get_param('author'),
1051 get_param('revision'),
1054 view_summary('html');