#!/usr/bonsaitools/bin/perl -- # -*- Mode: perl; indent-tabs-mode: nil -*- # # The contents of this file are subject to the Netscape Public License # Version 1.0 (the "License"); you may not use this file except in # compliance with the License. You may obtain a copy of the License at # http://www.mozilla.org/NPL/ # # Software distributed under the License is distributed on an "AS IS" # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the # License for the specific language governing rights and limitations # under the License. # # The Original Code is the Tinderbox build tool. # # The Initial Developer of the Original Code is Netscape Communications # Corporation. Portions created by Netscape are Copyright (C) 1998 # Netscape Communications Corporation. All Rights Reserved. use lib "../bonsai"; require 'globals.pl'; require 'lloydcgi.pl'; require 'imagelog.pl'; require 'header.pl'; $|=1; # # show 12 hours by default # if($form{'showall'} != 0 ){ $mindate = 0; } else { $hours = 12; $hours = $form{hours} if $form{hours} ne ""; $mindate = time - ($hours*60*60); } $colormap = { success => '00ff00', busted => 'red', building => 'yellow', testfailed => 'orange' }; # # Debug hack # #$form{'tree'} = DogbertTip; $tree = $form{'tree'}; if (exists $form{'rebuildguilty'} || exists $form{'showall'}) { system ("./buildwho.pl -days 7 $tree > /dev/null"); undef $form{'rebuildguilty'}; } if ($form{'quickparse'}) { print "Content-type: text/plain\n\n"; &do_quickparse; exit(); } print "Content-type: text/html\nRefresh: 900\n\n\n"; if( $form{'tree'} eq '' ){ &show_tree_selector; exit; } else { if( $form{'express'} ) { &do_express; } else { &load_data; &load_javascript; &display_page_head; &display_build_table; } } sub make_tree_list { my @result; while(<*>) { if( -d $_ && $_ ne 'data' && $_ ne 'CVS' && -f "$_/treedata.pl"){ push @result, $_; } } return @result; } # Check to see if anyone checked in during time slot. # ex. has_who_list(1); # Check for checkins in most recent time slot. # ex. has_who_list(1,5); # Check range of times. sub has_who_list { my ($time1, $time2) = @_; if (not defined(@who_check_list)) { # Build a static array of true/false values for each time slot. $who_check_list[$time_count] = 0; my ($t) = 1; for (; $t<=$time_count; $t++) { $who_check_list[$t] = 1 if each %{$who_list->[$t]}; } } if ($time2) { for ($ii=$time1; $ii<=$time2; $ii++) { return 1 if $who_check_list[$ii] } return 0 } else { return $who_check_list[$time1]; } } sub show_tree_selector { EmitHtmlHeader("tinderbox"); print "

"; print ""; print "
Select one of the following trees:
\n"; print "
    \n"; my @list = make_tree_list(); foreach (@list) { print "
  • $_\n"; } print "
"; print "

"; print ""; print "
Administer one of the following trees:
\n"; print "
    \n"; foreach (@list) { print "
  • $_\n"; } print "
"; } sub display_page_head { # srand; # $when = 60*10 + int rand(60*40); # if( -r "$tree/mod.pl" ){ require "$tree/mod.pl"; } else { $message_of_day = ""; } $treename = $tree . ($tree2 ne "" ? " and $tree2" : "" ); my ($sec,$minute,$hour) = localtime(time()); my $now = sprintf("%02d:%02d", $hour, $minute); EmitHtmlTitleAndHeader("tinderbox: $treename", "tinderbox", "tree: $treename ($now)"); print "$script_str\n"; print "$message_of_day\n"; if (!$form{'nocrap'}) { my ($imageurl,$imagewidth,$imageheight,$quote) = &get_image; print qq{


$quote

L = Show Build Log
L = Show Log comments
C = Show changes that occured since the last build
B = Download binary generated by the build
Built successfully
Currently Building
Build Successful, Build Tests Failed
Build failed
}; } if($bonsai_tree){ print "

The tree is currently "; if( &tree_open ){ print "OPEN"; } else { print "CLOSED"; } print "\n"; } } sub display_build_table { &display_build_table_header; &display_build_table_body; &display_build_table_footer; } sub display_build_table_body { my($t); $t = 1; while( $t <= $time_count ){ display_build_table_row( $t ); $t++; } } sub display_build_table_row { my ($t) = @_; my ($tt, $hour_color); $tt = &print_time($build_time_times->[$t]); if( $tree2 ne "" || $form{nocrap}){ $qr = ""; $er = ""; } else { $qr = &query_ref( $td1, $build_time_times->[$t]); $er = ""; } if ($build_time_times->[$t] % 7200 > 3600) { $hour_color = ""; } else { $hour_color = " bgcolor=#e7e7e7"; } ($hour) = $tt =~ /(\d\d):/; if ($lasthour == $hour) { $tt =~ s/^.* //; } else { $lasthour = $hour; } # Time column # print "\n"; print "${qr}\n${tt}${er}\n"; if( $tree2 ne "" ){ print "\n"; $qr = &query_ref( $td1, $build_time_times->[$t]); print "${qr}\n"; } print ""; for $who (sort keys %{$who_list->[$t]} ){ $qr = &who_menu( $td1, $build_time_times->[$t],$build_time_times->[$t-1],$who); print " ${qr}$who\n"; } print ""; if( $tree2 ne "" ){ print "\n"; $qr = &query_ref( $td2, $build_time_times->[$t]); print "${qr}\n"; print "\n"; for $who (sort keys %{$who_list2->[$t]} ){ $qr = &who_menu( $td2, $build_time_times->[$t],$build_time_times->[$t-1],$who); print " ${qr}$who\n"; } print ""; } $bn = 1; while( $bn <= $name_count ){ if( defined($br = $build_table->[$t][$bn])){ if( $br != -1 ){ $hasnote = $br->{hasnote}; $noteid = $hasnote ? $br->{noteid} : 0; $rowspan = $br->{rowspan}; $color = $colormap->{$br->{buildstatus}}; $status = $br->{buildstatus}; print "\n"; $logfile = $br->{logfile}; $errorparser = $br->{errorparser}; $buildname = $br->{buildname}; if( $tree2 ne "" ){ $buildname =~ s/^[^ ]* //; } $buildtime = $br->{buildtime}; $buildtree = $br->{td}->{name}; print "\n"; # Build Note # if( $hasnote ){ print ""; print "\n"; } # Build Log # #print ""; print "L"; # What Changed # if( $br->{previousbuildtime} ){ my ($previous_br) = $build_table->[$t+$rowspan][$bn]; my ($previous_rowspan) = $previous_br->{rowspan}; if (has_who_list($t+$rowspan, $t+$rowspan+$previous_rowspan-1)) { $qr = &query_ref($br->{td}, $br->{previousbuildtime}, $br->{buildtime}); print "\n$qr"; print "C"; } } if( $br->{binaryname} ne '' ){ $binfile = "$buildtree/bin/$buildtime/$br->{buildname}/$br->{binaryname}"; $binfile =~ s/ //g; print " B"; } print "\n"; print ""; } } else { print "\n"; } $bn++; } print "\n"; } sub display_build_table_header { my($i,$nspan); # print "
\n"; print "\n"; print "\n"; print ""; $nspan = ( $tree2 ne "" ? 4 : 1); print ""; #print "\n"; #print "\n"; $i = 1; while ($i <= $name_count){ $bn = $build_name_names->[$i]; $bn =~ s/Clobber/Clbr/g; $bn =~ s/Depend/Dep/g; $t = &last_good_time($i); if( $form{'narrow'} ){ $bn =~ s/([^:])/$1
/g; $bn = "$bn"; } else { $bn = "$bn"; } if( $t->{isbusted} ){ if ($form{'nocrap'}) { print ""; } else { print ""; } #print "\n"; } else { print ""; } $i++; } print "\n"; print "\n"; print "\n"; if( $tree2 ne "" ){ print "\n"; print "\n"; } else { print "\n"; } print "\n"; } sub display_build_table_footer { print "
Click time to
see changes
since time
Click name to see what they did"; print "
Rebuild guilty list
Burning builds are busted"; #print "
$bn"; print "$bn$bn
Build Time$td1->{name}$td2->{name}Guilty
\n"; # print "
"; print "Show more checkin history

\n"; if (open(FOOTER, "<$data_dir/footer.html")) { while (