diff --git a/mozilla/webtools/tinderbox/globals.pl b/mozilla/webtools/tinderbox/globals.pl index 77fc6a21a77..2dcd8f8cde3 100755 --- a/mozilla/webtools/tinderbox/globals.pl +++ b/mozilla/webtools/tinderbox/globals.pl @@ -78,452 +78,416 @@ sub unlock{ } sub print_time { - local($t) = @_; - local($sec,$minute,$hour,$mday,$mon,$year); - ($sec,$minute,$hour,$mday,$mon,$year) = localtime( $t ); - sprintf("%02d/%02d %02d:%02d",$mon+1,$mday,$hour,$minute); + my ($t) = @_; + my ($minute,$hour,$mday,$mon); + (undef,$minute,$hour,$mday,$mon,undef) = localtime($t); + sprintf("%02d/%02d %02d:%02d",$mon+1,$mday,$hour,$minute); } sub url_encode { - local( $s ) = @_; + my ($s) = @_; - $s =~ s/\%/\%25/g; - $s =~ s/\=/\%3d/g; - $s =~ s/\?/\%3f/g; - $s =~ s/ /\%20/g; - $s =~ s/\n/\%0a/g; - $s =~ s/\r//g; - $s =~ s/\"/\%22/g; - $s =~ s/\'/\%27/g; - $s =~ s/\|/\%7c/g; - $s =~ s/\&/\%26/g; - return $s; + $s =~ s/\%/\%25/g; + $s =~ s/\=/\%3d/g; + $s =~ s/\?/\%3f/g; + $s =~ s/ /\%20/g; + $s =~ s/\n/\%0a/g; + $s =~ s/\r//g; + $s =~ s/\"/\%22/g; + $s =~ s/\'/\%27/g; + $s =~ s/\|/\%7c/g; + $s =~ s/\&/\%26/g; + return $s; } sub url_decode { - local($value) = @_; - $value =~ tr/+/ /; - $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; - return $value; + my ($value) = @_; + $value =~ tr/+/ /; + $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; + return $value; } sub value_encode { - my($s) = @_; - $s =~ s@&@&@g; - $s =~ s@<@<@g; - $s =~ s@>@>@g; - $s =~ s@\"@"@g; - return $s; + my ($s) = @_; + $s =~ s@&@&@g; + $s =~ s@<@<@g; + $s =~ s@>@>@g; + $s =~ s@\"@"@g; + return $s; } sub load_data { - $tree2 = $form{'tree2'}; - if( $tree2 ne '' ){ - require "$tree2/treedata.pl"; - if( -r "$tree2/ignorebuilds.pl" ){ - require "$tree2/ignorebuilds.pl"; - } - - $td2 = {}; - $td2->{name} = $tree2; - $td2->{cvs_module} = $cvs_module; - $td2->{cvs_branch} = $cvs_branch; - $td2->{num} = 1; - $td2->{ignore_builds} = $ignore_builds; - if( $cvs_root eq '' ){ - $cvs_root = '/m/src'; - } - $td2->{cvs_root} = $cvs_root; - - $tree = $form{'tree'}; - require "$tree/treedata.pl"; - if( $cvs_root eq '' ){ - $cvs_root = '/m/src'; - } + $tree2 = $form{'tree2'}; + if( $tree2 ne '' ){ + require "$tree2/treedata.pl"; + if( -r "$tree2/ignorebuilds.pl" ){ + require "$tree2/ignorebuilds.pl"; } - $tree = $form{'tree'}; - - return unless $tree; - #die "the \"tree\" parameter must be provided\n" unless $tree; - - if ( -r "$tree/treedata.pl" ) { - require "$tree/treedata.pl"; - } - - $ignore_builds = {}; - if( -r "$tree/ignorebuilds.pl" ){ - require "$tree/ignorebuilds.pl"; - } - else { - } - - $td1 = {}; - $td1->{name} = $tree; - $td1->{num} = 0; - $td1->{cvs_module} = $cvs_module; - $td1->{cvs_branch} = $cvs_branch; - $td1->{ignore_builds} = $ignore_builds; + $td2 = {}; + $td2->{name} = $tree2; + $td2->{cvs_module} = $cvs_module; + $td2->{cvs_branch} = $cvs_branch; + $td2->{num} = 1; + $td2->{ignore_builds} = $ignore_builds; if( $cvs_root eq '' ){ - $cvs_root = '/m/src'; + $cvs_root = '/m/src'; } - $td1->{cvs_root} = $cvs_root; - - &lock; - &load_buildlog; - &unlock; - - &get_build_name_index; - &get_build_time_index; - - &load_who($who_list, $td1); - if( $tree2 ne "" ){ - &load_who($who_list2, $td2); + $td2->{cvs_root} = $cvs_root; + + $tree = $form{'tree'}; + require "$tree/treedata.pl"; + if( $cvs_root eq '' ){ + $cvs_root = '/m/src'; } + } - &make_build_table; + $tree = $form{'tree'}; + + return unless $tree; + #die "the 'tree' parameter must be provided\n" unless $tree; + + if ( -r "$tree/treedata.pl" ) { + require "$tree/treedata.pl"; + } + + $ignore_builds = {}; + if( -r "$tree/ignorebuilds.pl" ){ + require "$tree/ignorebuilds.pl"; + } + + $td1 = {}; + $td1->{name} = $tree; + $td1->{num} = 0; + $td1->{cvs_module} = $cvs_module; + $td1->{cvs_branch} = $cvs_branch; + $td1->{ignore_builds} = $ignore_builds; + if( $cvs_root eq '' ){ + $cvs_root = '/m/src'; + } + $td1->{cvs_root} = $cvs_root; + + &lock; + &load_buildlog; + &unlock; + + &get_build_name_index; + &get_build_time_index; + + &load_who($who_list, $td1); + if( $tree2 ne '' ){ + &load_who($who_list2, $td2); + } + + &make_build_table; } sub load_buildlog { - my ($mailtime, $buildtime, $buildname, $errorparser, $buildstatus, $logfile,$binaryname); - my ($buildrec, @treelist, $t); + my $mailtime, $buildtime, $buildname, $errorparser; + my $buildstatus, $logfile,$binaryname; + my $buildrec, @treelist, $t; - if (!defined $maxdate) { - $maxdate = time(); - } - if (!defined $mindate) { - $mindate = $maxdate - 24*60*60; - } - - if( $tree2 ne '' ){ - @treelist = ($td1, $td2); - } - else { - @treelist = ($td1); - } - - for $t (@treelist) { - use Backwards; + if (not defined $maxdate) { + $maxdate = time(); + } + if (not defined $mindate) { + $mindate = $maxdate - 24*60*60; + } + + if ($tree2 ne '') { + @treelist = ($td1, $td2); + } + else { + @treelist = ($td1); + } + + for $t (@treelist) { + use Backwards; - my ($bw) = Backwards->new("$t->{name}/build.dat") or die; + my ($bw) = Backwards->new("$t->{name}/build.dat") or die; - my $tooearly = 0; - while( $_ = $bw->readline ) { - chomp; - ($mailtime, $buildtime, $buildname, $errorparser, $buildstatus, $logfile, $binaryname) = - split( /\|/ ); - # Ignore stuff in the future. - next if $buildtime > $maxdate; + my $tooearly = 0; + while( $_ = $bw->readline ) { + chomp; + ($mailtime, $buildtime, $buildname, + $errorparser, $buildstatus, $logfile, $binaryname) = split /\|/; - # Ignore stuff in the past (but get a 2 hours of extra data) - if ($buildtime < $mindate - 2*60*60) { - # Occasionally, a build might show up with a bogus time. So, - # we won't judge ourselves as having hit the end until we - # hit a full 20 lines in a row that are too early. - if ($tooearly++ > 20) { - last; - } - next; - } - $tooearly = 0; - $buildrec = { - mailtime => $mailtime, - buildtime => $buildtime, - buildname => ($tree2 ne "" ? $t->{name} . " " : "" ) . $buildname, - errorparser => $errorparser, - buildstatus => $buildstatus, - logfile => $logfile, - binaryname => $binaryname, - td => $t - }; - if( $mailtime > 0 - && ($form{noignore} || !($t->{ignore_builds}->{$buildname} != 0)) - ){ - push @{$build_list}, $buildrec; - } - } + # Ignore stuff in the future. + next if $buildtime > $maxdate; + + # Ignore stuff in the past (but get a 2 hours of extra data) + if ($buildtime < $mindate - 2*60*60) { + # Occasionally, a build might show up with a bogus time. So, + # we won't judge ourselves as having hit the end until we + # hit a full 20 lines in a row that are too early. + last if $tooearly++ > 20; + + next; + } + $tooearly = 0; + $buildrec = { + mailtime => $mailtime, + buildtime => $buildtime, + buildname => ($tree2 ne '' ? $t->{name} . ' ' : '' ) . $buildname, + errorparser => $errorparser, + buildstatus => $buildstatus, + logfile => $logfile, + binaryname => $binaryname, + td => $t + }; + if ($mailtime > 0 + and ($form{noignore} or not $t->{ignore_builds}->{$buildname})) { + push @{$build_list}, $buildrec; + } } + } } sub load_who { - local( $who_list, $td ) = @_; - local($d,$w,$i,$bfound); + my ($who_list, $td) = @_; + my $d, $w, $i, $bfound; + + open(WHOLOG, "<$td->{name}/who.dat"); + while () { + $i = $time_count; + chop; + ($d,$w) = split /\|/; + $bfound = 0; + while ($i > 0 and not $bfound) { + if ($d <= $build_time_times->[$i]) { + $who_list->[$i+1]->{$w} = 1; + $bfound = 1; + } + else { + $i--; + } + } + } - open(WHOLOG, "<$td->{name}/who.dat" ); - while( ){ - $i = $time_count; - chop; - ($d,$w) = split(/\|/); - $bfound = 0; - while( $i > 0 && !$bfound ){ - if( $d <= $build_time_times->[$i] ){ - - $who_list->[$i+1]->{$w} = 1; - $bfound = 1; - } - else { - $i--; - } - } - } - # - # Ignore the last one - # - if( $time_count > 0 ){ - $who_list->[$time_count] = {}; - } + # Ignore the last one + # + if ($time_count > 0) { + $who_list->[$time_count] = {}; + } } sub get_build_name_index { - local($i,$br); - - # - # Get all the unique build names. - # - for $br (@{$build_list}) { - $build_name_index->{$br->{buildname}} = 1; - } + my $i,$br; + # Get all the unique build names. + # + foreach $br (@{$build_list}) { + $build_name_index->{$br->{buildname}} = 1; + } - $i = 1; - for $n (sort keys (%{$build_name_index})) { - $build_name_names->[$i] = $n; - $i++; - } + $i = 1; + foreach $n (sort keys (%{$build_name_index})) { + $build_name_names->[$i] = $n; + $i++; + } - $name_count = @{$build_name_names}-1; + $name_count = @{$build_name_names}-1; - - # - # update the map so it points to the right index - # - $i = 1; - while( $i < $name_count+1 ){ - $build_name_index->{$build_name_names->[$i]} = $i; - #print "$name_count $build_name_names->[$i] $i
\n"; - $i++; - } - - #for $i (@{$build_name_names}) { - # print "$build_name_names->[$i] $i
\n"; - #&} + # Update the map so it points to the right index + # + for ($i=1; $i < $name_count+1; $i++) { + $build_name_index->{$build_name_names->[$i]} = $i; + } } sub get_build_time_index { - local($i,$br); + my $i,$br; - # - # Get all the unique build names. - # - for $br (@{$build_list}) { - $build_time_index->{$br->{buildtime}} = 1; - #$build_time_index->{$br->{mailtime}} = 1; - } + # Get all the unique build names. + # + foreach $br (@{$build_list}) { + $build_time_index->{$br->{buildtime}} = 1; + } - - $i = 1; - for $n (sort {$b <=> $a} keys (%{$build_time_index})) { - $build_time_times->[$i] = $n; - $mindate_time_count = $i if $n >= $mindate; - $i++; - } + $i = 1; + foreach $n (sort {$b <=> $a} keys (%{$build_time_index})) { + $build_time_times->[$i] = $n; + $mindate_time_count = $i if $n >= $mindate; + $i++; + } - $time_count = @{$build_time_times}-1; - - # - # update the map so it points to the right index - # - $i = 1; - while( $i < $time_count+1 ){ - $build_time_index->{$build_time_times->[$i]} = $i; - $i++; - } - - #for $i (@{$build_time_times}) { - # print $i . "\n"; - #} - - #while( ($k,$v) = each(%{$build_time_index})) { - # print "$k=$v\n"; - #} + $time_count = @{$build_time_times}-1; + # Update the map so it points to the right index + # + for ($i=1; $i < $time_count+1; $i++) { + $build_time_index->{$build_time_times->[$i]} = $i; + } + + #for $i (@{$build_time_times}) { + # print $i . "\n"; + #} + + #while( ($k,$v) = each(%{$build_time_index})) { + # print "$k=$v\n"; + #} } sub make_build_table { - local($i,$ti,$bi,$ti1,$br); - $i = 1; + my $i,$ti,$bi,$ti1,$br; - # - # Create the build table - # - while( $i <= $time_count ){ - $build_table->[$i] = []; - $i++; - } + # Create the build table + # + for ($i=1; $i <= $time_count; $i++){ + $build_table->[$i] = []; + } - # - # Populate the build table with build data - # - for $br (reverse @{$build_list}) { - $ti = $build_time_index->{$br->{buildtime}}; - $bi = $build_name_index->{$br->{buildname}}; - $build_table->[$ti][$bi] = $br; - } + # Populate the build table with build data + # + foreach $br (reverse @{$build_list}) { + $ti = $build_time_index->{$br->{buildtime}}; + $bi = $build_name_index->{$br->{buildname}}; + $build_table->[$ti][$bi] = $br; + } - &load_notes; + &load_notes; - $bi = $name_count; - while( $bi > 0 ){ - $ti = $time_count; - while( $ti > 0 ){ - if( defined( $br = $build_table->[$ti][$bi] ) - && !defined( $br->{rowspan} ) - ){ - # - # If the cell immediatley after us is defined, then we - # can have a previousbuildtime. - # - if( defined( $br1 = $build_table->[$ti+1][$bi] )){ - $br->{previousbuildtime} = $br1->{buildtime}; - } - - $ti1 = $ti-1; - while( $ti1 > 0 - && !defined( $build_table->[$ti1][$bi] ) - #&& $build_time_times->[$ti1] < $br->{mailtime} - ){ - $build_table->[$ti1][$bi] = -1; - $ti1--; - } - $br->{rowspan} = $ti - $ti1; - if( $br->{rowspan} != 1 ){ - $build_table->[$ti1+1][$bi] = $br; - $build_table->[$ti][$bi] = -1; - - } - }; - - $ti--; + for ($bi = $name_count; $bi > 0; $bi--) { + for ($ti = $time_count; $ti > 0; $ti--) { + if (defined($br = $build_table->[$ti][$bi]) + and not defined($br->{rowspan})) { + + # If the cell immediatley after us is defined, then we + # can have a previousbuildtime. + if (defined($br1 = $build_table->[$ti+1][$bi])) { + $br->{previousbuildtime} = $br1->{buildtime}; } - $bi--; + + $ti1 = $ti-1; + while ($ti1 > 0 and not defined($build_table->[$ti1][$bi])) { + $build_table->[$ti1][$bi] = -1; + $ti1--; + } + $br->{rowspan} = $ti - $ti1; + if ($br->{rowspan} != 1) { + $build_table->[$ti1+1][$bi] = $br; + $build_table->[$ti][$bi] = -1; + } + } } + } } sub load_notes { - if( $tree2 ne '' ){ - @treelist = ($td1, $td2); - } - else { - @treelist = ($td1); - } + if ($tree2 ne '') { + @treelist = ($td1, $td2); + } + else { + @treelist = ($td1); + } - for $t (@treelist) { - open(NOTES,"<$t->{name}/notes.txt") || print "

warning: Couldn't open $t->{name}/notes.txt

\n"; - while(){ - chop; - ($nbuildtime,$nbuildname,$nwho,$nnow,$nenc_note) = split(/\|/); - if( $tree2 ne "" ) { $nbuildname = $t->{name} . " " . $nbuildname; } - $ti = $build_time_index->{$nbuildtime}; - $bi = $build_name_index->{$nbuildname}; - #print "[ti = $ti][bi=$bi][buildname='$nbuildname' $_
"; - if( $ti != 0 && $bi != 0 ){ - $build_table->[$ti][$bi]->{hasnote} = 1; - if( ! defined($build_table->[$ti][$bi]->{noteid}) ){ - $build_table->[$ti][$bi]->{noteid} = (0+@note_array); - } - $noteid = $build_table->[$ti][$bi]->{noteid}; - $now_str = &print_time($nnow); - $note = &url_decode($nenc_note); - $note_array[$noteid] .= - "
\n[$nwho - $now_str]\n$note\n
"; - } + foreach $t (@treelist) { + open(NOTES,"<$t->{name}/notes.txt") + or print "

warning: Couldn't open $t->{name}/notes.txt

\n"; + while () { + chop; + ($nbuildtime,$nbuildname,$nwho,$nnow,$nenc_note) = split /\|/; + $nbuildname = "$t->{name} $nbuildname" if $tree2 ne ''; + $ti = $build_time_index->{$nbuildtime}; + $bi = $build_name_index->{$nbuildname}; + #print "[ti = $ti][bi=$bi][buildname='$nbuildname' $_
"; + if ($ti != 0 and $bi != 0) { + $build_table->[$ti][$bi]->{hasnote} = 1; + if (not defined($build_table->[$ti][$bi]->{noteid})) { + $build_table->[$ti][$bi]->{noteid} = (0+@note_array); } - close(NOTES); + $noteid = $build_table->[$ti][$bi]->{noteid}; + $now_str = &print_time($nnow); + $note = &url_decode($nenc_note); + $note_array[$noteid] .= "
\n["
+                               ."$nwho - $now_str]\n$note\n
"; + } } + close(NOTES); + } } -sub last_good_time { - local($row) = @_; - local($t,$currently_busted); +sub last_success_time { + my ($row) = @_; - $t = 1; - $isbusted = 0; - while( $t <= $time_count ){ - if( defined( $build_table->[$t][$row] )){ - if( $build_table->[$t][$row]->{buildstatus} eq 'success' ){ - return { - buildtime => - $build_time_times->[ $t + - $build_table->[$t][$row]->{rowspan} ], - isbusted => $isbusted }; - } - elsif( ($build_table->[$t][$row]->{buildstatus} eq 'busted') || - ($build_table->[$t][$row]->{buildstatus} eq 'testfailed')){ - $isbusted = 1; - } - else { - } - } - $t++; - } - return {buildtime => 0, isbusted => 1}; + for (my $tt=1; $tt <= $time_count; $tt++) { + my $br = $build_table->[$tt][$row]; + next if not defined $br; + next unless $br->{buildstatus} eq 'success'; + return $build_time_times->[$tt + $br->{rowspan} ]; + } + return 0; } +sub last_status { + my ($row) = @_; + + for (my $tt=1; $tt <= $time_count; $tt++) { + my $status = $build_table->[$tt][$row]->{buildstatus}; + next if not defined $status; + next if $status eq 'building'; + return $status; + } + return ''; +} sub check_password { - if ($form{'password'} eq "") { - if (defined $cookie_jar{'tinderbox_password'}) { - $form{'password'} = $cookie_jar{'tinderbox_password'}; - } + if ($form{password} eq '') { + if (defined $cookie_jar{tinderbox_password}) { + $form{password} = $cookie_jar{tinderbox_password}; } - my $correct = ""; - if (open(REAL, "; - close REAL; - $correct =~ s/\s+$//; # Strip trailing whitespace. + } + my $correct = ''; + if (open(REAL, '; + close REAL; + $correct =~ s/\s+$//; # Strip trailing whitespace. } - $form{'password'} =~ s/\s+$//; # Strip trailing whitespace. - if ($form{'password'} ne "") { - open(TRAPDOOR, "../bonsai/data/trapdoor $form{'password'} |") || die "Can't run trapdoor func!"; - my $encoded = ; - close TRAPDOOR; - $encoded =~ s/\s+$//; # Strip trailing whitespace. - if ($encoded eq $correct) { - if ($form{'rememberpassword'} ne "") { - print "Set-Cookie: tinderbox_password=$form{'password'} ; path=/ ; expires = Sun, 1-Mar-2020 00:00:00 GMT\n"; - } - return; - } + $form{password} =~ s/\s+$//; # Strip trailing whitespace. + if ($form{password} ne '') { + open(TRAPDOOR, "../bonsai/data/trapdoor $form{'password'} |") + or die "Can't run trapdoor func!"; + my $encoded = ; + close TRAPDOOR; + $encoded =~ s/\s+$//; # Strip trailing whitespace. + if ($encoded eq $correct) { + if ($form{rememberpassword} ne '') { + print "Set-Cookie: tinderbox_password=$form{'password'} ;" + ." path=/ ; expires = Sun, 1-Mar-2020 00:00:00 GMT\n"; + } + return; } + } - require 'header.pl'; + require 'header.pl'; - print "Content-type: text/html\n"; - print "Set-Cookie: tinderbox_password= ; path=/ ; expires = Sun, 1-Mar-2020 00:00:00 GMT\n"; - print "\n"; + print "Content-type: text/html\n"; + print "Set-Cookie: tinderbox_password= ; path=/ ; " + ." expires = Sun, 1-Mar-2020 00:00:00 GMT\n"; + print "\n"; - EmitHtmlHeader("What's the magic word?", - "You need to know the magic word to use this page."); + EmitHtmlHeader("What's the magic word?", + "You need to know the magic word to use this page."); - if ($form{'password'} ne "") { - print "Invalid password; try again.
"; - } - print " -
-Password: -
- If correct, remember password as a cookie
-"; + if ($form{password} ne '') { + print "Invalid password; try again.
"; + } + print q( + + Password: +
+ + If correct, remember password as a cookie
+ ); - while (my ($key,$value) = each %form) { - if ($key eq "password" || $key eq "rememberpassword") { - next; - } - my $enc = value_encode($value); - print "\n"; - } - print "
\n"; - exit; + while (my ($key,$value) = each %form) { + next if $key eq "password" or $key eq "rememberpassword"; + + my $enc = value_encode($value); + print "\n"; + } + print "\n"; + exit; } diff --git a/mozilla/webtools/tinderbox/showbuilds.cgi b/mozilla/webtools/tinderbox/showbuilds.cgi index 60a38053734..0a299dbf556 100755 --- a/mozilla/webtools/tinderbox/showbuilds.cgi +++ b/mozilla/webtools/tinderbox/showbuilds.cgi @@ -17,106 +17,403 @@ # Corporation. Portions created by Netscape are Copyright (C) 1998 # Netscape Communications Corporation. All Rights Reserved. -use lib "../bonsai"; - +use lib '../bonsai'; require 'globals.pl'; require 'lloydcgi.pl'; require 'imagelog.pl'; require 'header.pl'; $|=1; -#require 'utils.pl'; -#$default_root = pickDefaultRepository(); -# Terrible hack until I can figure out how to do this properly. -slamm +# Hack this until I can figure out how to do get default root. -slamm $default_root = '/cvsroot'; -# -# show 12 hours by default +# Show 12 hours by default # $nowdate = time; if (not defined($maxdate = $form{maxdate})) { $maxdate = $nowdate; } -if($form{'showall'} != 0 ){ - $mindate = 0; +if ($form{showall}) { + $mindate = 0; } else { - $hours = 12; - $hours = $form{hours} if $form{hours} ne ""; - $mindate = $maxdate - ($hours*60*60); + $hours = 12; + $hours = $form{hours} if $form{hours}; + $mindate = $maxdate - ($hours*60*60); } $colormap = { - success => '00ff00', - busted => 'red', - building => 'yellow', - testfailed => 'orange' - }; + success => '00ff00', + busted => 'red', + building => 'yellow', + testfailed => 'orange' +}; -# -# Debug hack -# -#$form{'tree'} = DogbertTip; -$tree = $form{'tree'}; +$tree = $form{tree}; -if (exists $form{'rebuildguilty'} || exists $form{'showall'}) { - system ("./buildwho.pl -days 7 $tree > /dev/null"); - undef $form{'rebuildguilty'}; +if (exists $form{rebuildguilty} or 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(); -} -if ($form{'rdf'}) { - print "Content-type: text/plain\n\n"; - &do_rdf; - exit(); -} -if ($form{'flash'}) { - print "Content-type: text/rdf\n\n"; - &do_flash; - exit(); -} -if ($form{'panel'}) { - # Refresh the tinderbox sidebar panel every minute. - print "Content-type: text/html\nRefresh: 60\n\n\n"; - &do_panel; - exit(); -} - -if ($nowdate eq $maxdate) { - print "Content-type: text/html\nRefresh: 900\n\n\n"; -} else { - 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; - } -} +&show_tree_selector, exit if $form{tree} eq ''; +&do_quickparse, exit if $form{quickparse}; +&do_express, exit if $form{express}; +&do_rdf, exit if $form{rdf}; +&do_flash, exit if $form{flash}; +&do_panel, exit if $form{panel}; +&load_data; +&print_page_head; +&print_table_header; +&print_table_body; +&print_table_footer; +exit; +# end of main +#===================================================================== sub make_tree_list { - my @result; - while(<*>) { - if( -d $_ && $_ ne 'data' && $_ ne 'CVS' && -f "$_/treedata.pl"){ - push @result, $_; - } + my @result; + while(<*>) { + if( -d $_ && $_ ne 'data' && $_ ne 'CVS' && -f "$_/treedata.pl") { + push @result, $_; } - return @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 "
"; + print "Administer one of the following trees:
\n"; + print "
    \n"; + + foreach (@list) { + print "
  • $_\n"; + } + print "
"; +} + +sub print_page_head { + + print "Content-type: text/html", + ($nowdate eq $maxdate ? "\nRefresh: 900" : ''), + "\n\n\n"; + + # Get the message of the day only on the first pageful + do "$tree/mod.pl" if $nowdate eq $maxdate; + + $treename = $tree . ($tree2 ne '' ? " and $tree2" : ''); + + my ($minute, $hour) = (localtime)[1,2]; + my $now = sprintf("%02d:%02d", $hour, $minute); + + EmitHtmlTitleAndHeader("tinderbox: $treename", "tinderbox", + "tree: $treename ($now)"); + + &print_javascript; + print "$message_of_day\n"; + + # Quote and Lengend + # + unless ($form{nocrap}) { + my ($imageurl,$imagewidth,$imageheight,$quote) = &get_image; + print qq{ + + + + +
+


+ $quote

+
+

+

+
+ L= Show Build Log +
+ = Show Log comments +
+ +
Successful Build +
Build in Progress +
Successful Build, + but Tests Failed +
Build Failed +
+
+
+ }; + } + if ($bonsai_tree) { + print "The tree is currently "; + print (&tree_open ? 'OPEN' : 'CLOSED'); + print "\n"; + } +} + +sub print_table_body { + for (my $tt=1; $tt <= $time_count; $tt++) { + last if $build_time_times->[$tt] < $mindate; + print_table_row($tt); + } +} + +sub print_table_row { + my ($tt) = @_; + + # Time column + # + my $query_link = ''; + my $end_query = ''; + my $pretty_time = &print_time($build_time_times->[$tt]); + + ($hour) = $pretty_time =~ /(\d\d):/; + + if ($tree2 eq '' and ($lasthour != $hour or &has_who_list($tt))) { + $query_link = &query_ref($td1, $build_time_times->[$tt]); + $end_query = ''; + } + if ($lasthour == $hour) { + $pretty_time =~ s/^.* //; + } else { + $lasthour = $hour; + } + + my $hour_color = ''; + $hour_color = ' bgcolor=#e7e7e7' if $build_time_times->[$tt] % 7200 <= 3600; + print "", + "$query_link\n$pretty_time$end_query\n"; + + if ($tree2 ne '') { + print "\n"; + $query_link = &query_ref( $td1, $build_time_times->[$tt]); + print "$query_link\n"; + } + + # Guilty + # + print ''; + for $who (sort keys %{$who_list->[$tt]} ){ + $qr = &who_menu($td1, $build_time_times->[$tt], + $build_time_times->[$tt-1],$who); + $who =~ s/%.*$//; + print " ${qr}$who\n"; + } + print ''; + + if ($tree2 ne '') { + print "\n"; + $qr = &query_ref( $td2, $build_time_times->[$tt]); + print "${qr}\n"; + + print "\n"; + + for $who (sort keys %{$who_list2->[$tt]} ){ + $qr = &who_menu($td2, $build_time_times->[$tt], + $build_time_times->[$tt-1],$who); + print " ${qr}$who\n"; + } + print ''; + } + + # Build Status + # + for ($bn=1; $bn <= $name_count; $bn++) { + if (not defined($br = $build_table->[$tt][$bn])) { + # No build data for this time + print "\n"; + next; + } + next if $br == -1; # rowspan has covered this row + + $hasnote = $br->{hasnote}; + $noteid = $hasnote ? $br->{noteid} : 0; + $rowspan = $br->{rowspan}; + $rowspan = $mindate_time_count - $tt + 1 + if $tt + $rowspan - 1 > $mindate_time_count; + $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 "\n"; + } + + # Build Log + # + $buildname = &url_encode($buildname); + print ""; + print "L"; + + # What Changed + # +# This gives bogus information because the CVS mirror is +# out of sync with the build times +# if( $br->{previousbuildtime} ){ +# my ($previous_br) = $build_table->[$tt+$rowspan][$bn]; +# my ($previous_rowspan) = $previous_br->{rowspan}; +# if (&has_who_list($tt+$rowspan, +# $tt+$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 "\n"; +} + +sub print_table_header { + my $ii, $nspan; + + print "\n"; + + print "\n"; + print ""; + $nspan = ($tree2 ne '' ? 4 : 1); + print ""; + + for ($ii=1; $ii <= $name_count; $ii++) { + + my $bn = $build_name_names->[$ii]; + $bn =~ s/Clobber/Clbr/g; + $bn =~ s/Depend/Dep/g; + + if( $form{narrow} ){ + $bn =~ s/([^:])/$1
/g; + $bn = "$bn"; + } + else { + $bn = "$bn"; + } + + my $last_status = &last_status($ii); + if ($last_status eq 'busted') { + if ($form{nocrap}) { + print ""; + } else { + print ""; + } + } + else { + print ""; + } + } + print "\n"; + print "\n"; + + if ($tree2 ne '') { + print "\n"; + print "\n"; + } + else { + print "\n"; + } + print "\n"; +} + +sub print_table_footer { + print "
Click time to
see changes
", + "since time
", + "Click name to see what they did"; + print "
Rebuild guilty list
{busted}>$bn"; + print "$bn{$last_status}>$bn
Build Time$td1->{name}$td2->{name}Guilty
\n"; + + my $nextdate = $maxdate - $hours*60*60; + print "", + "Show next $hours hours"; + + if (open(FOOTER, "<$data_dir/footer.html")) { + while (