#!/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 36 hours by default # if($form{'showall'} != 0 ){ $mindate = 0; } else { $hours = 36; if( $form{hours} ne "" ){ $hours = $form{hours}; } $mindate = time - ($hours*60*60); } $colormap = { success => '00ff00', busted => 'red', building => 'yellow', testfailed => 'orange' }; # # Debug hack # #$form{'tree'} = DogbertTip; $tree = $form{'tree'}; if ($form{'quickparse'}) { print "Content-type: text/plain\n\n"; &do_quickparse; exit(); } print "Content-type: text/html\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; } 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" : "" ); EmitHtmlTitleAndHeader("tinderbox: $treename", "tinderbox", "tree: $treename"); 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 { local($t); $t = 1; while( $t <= $time_count ){ display_build_table_row( $t ); $t++; } } sub display_build_table_row { local($t) = @_; local($tt); $tt = &print_time($build_time_times->[$t]); if( $tree2 ne "" ){ $qr = ""; $er = ""; } else { $qr = &query_ref( $td1, $build_time_times->[$t]); $er = ""; } if ($build_time_times->[$t] % 7200 > 3600) { $color = "white"; } else { $color = "beige"; } print "\n"; print "${qr}\n${tt}${er}\n"; if( $tree2 ne "" ){ print "\n"; $qr = &query_ref( $td1, $build_time_times->[$t]); print "${qr}X\n"; } print "\n"; for $who (sort keys %{$who_list->[$t]} ){ #$qr = &query_ref( $td1, $build_time_times->[$t],$build_time_times->[$t-1],$who); $qr = &who_menu( $td1, $build_time_times->[$t],$build_time_times->[$t-1],$who); print " ${qr}$who\n"; } if( $tree2 ne "" ){ print "\n"; $qr = &query_ref( $td2, $build_time_times->[$t]); print "${qr}X\n"; print "\n"; for $who (sort keys %{$who_list2->[$t]} ){ #$qr = &query_ref( $td2, $build_time_times->[$t],$build_time_times->[$t-1],$who); $qr = &who_menu( $td2, $build_time_times->[$t],$build_time_times->[$t-1],$who); print " ${qr}$who\n"; } } $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/^[^ ]* //; } $popupbuildname = $buildname; #Added so text in popup isn't whacky $buildname = &url_encode($buildname); $buildtime = $br->{buildtime}; $buildtree = $br->{td}->{name}; print "\n"; if( $hasnote ){ print ""; print "\n"; } print ""; print "L\n"; #print "Build Summary
\n"; if( $br->{previousbuildtime} ){ $qr = &query_ref($br->{td}, $br->{previousbuildtime},$br->{buildtime}); print "$qr\n"; print " C\n"; #print "What Changed
\n"; } if( $br->{binaryname} ne '' ){ $binfile = "$buildtree/bin/$buildtime/$br->{buildname}/$br->{binaryname}"; $binfile =~ s/ //g; print " B"; } print "
\n"; } } else { print " \n"; } $bn++; } print "\n"; } sub display_build_table_header { local($i,$nspan); print "\n"; print "\n"; 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 "\n"; print "\n"; print "\n"; } sub display_build_table_footer { print "
Click time to
see changes
since time
"; $nspan = ( $tree2 ne "" ? 4 : 1); print "
Click name to see what they did"; #print "Burning builds are busted"; #print "
$bn"; } else { print ""; print "$bn"; } #print "\n"; } else { print ""; print "$bn\n"; } $i++; } print "
Build Time\n"; if( $tree2 ne "" ){ print "$td1->{name}\n"; print "$td2->{name}\n"; } else { print "Guilty\n"; } print "
\n"; print "Show more checkin history

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