diff --git a/webtools/tinderbox/showbuilds.cgi b/webtools/tinderbox/showbuilds.cgi index d83efb83222..92277b9f8e1 100755 --- a/webtools/tinderbox/showbuilds.cgi +++ b/webtools/tinderbox/showbuilds.cgi @@ -57,14 +57,14 @@ else { star => 'star.gif' ); -$tree = $form{tree}; +$::tree = $form{tree}; # $rel_path is the relative path to webtools/tinderbox used for links. # It changes to "../" if the page is generated statically, because then -# it is placed in tinderbox/$tree. +# it is placed in tinderbox/$::tree. $rel_path = ''; -&show_tree_selector, exit if $form{tree} eq ''; +&show_tree_selector, exit if $::tree eq ''; &do_quickparse, exit if $form{quickparse}; &do_express, exit if $form{express}; &do_rdf, exit if $form{rdf}; @@ -136,7 +136,7 @@ sub do_static { foreach $pair (@pages) { my ($page, $call) = @{$pair}; - my $outfile = "$form{tree}/$page"; + my $outfile = "$::tree/$page"; open(OUT,">$outfile.$$"); select OUT; @@ -164,14 +164,14 @@ sub print_page_head { # Print time in format, "HH:MM timezone" my $now = strftime("%H:%M %Z", localtime); - EmitHtmlTitleAndHeader("tinderbox: $tree", "tinderbox", - "tree: $tree ($now)"); + EmitHtmlTitleAndHeader("tinderbox: $::tree", "tinderbox", + "tree: $::tree ($now)"); &print_javascript; # Get the message of the day only on the first pageful - do "$tree/mod.pl" if $nowdate eq $maxdate; - print "$message_of_day\n"; # from $tree/mod.pl + do "$::tree/mod.pl" if $nowdate eq $maxdate; + print "$message_of_day\n"; # from $::tree/mod.pl # Quote and Lengend # @@ -218,10 +218,10 @@ sub print_page_head { }; } - if ($bonsai_tree) { + if (is_tree_state_available()) { print ""; - print "The tree is currently "; - print (&tree_open ? 'OPEN' : 'CLOSED'); + print "The tree is "; + print (is_tree_open() ? 'open' : 'closed'); print "\n"; } } @@ -265,12 +265,12 @@ BEGIN { # my $query_link = ''; my $end_query = ''; - my $pretty_time = &print_time($build_time_times->[$tt]); + my $pretty_time = print_time($build_time_times->[$tt]); ($hour) = $pretty_time =~ /(\d\d):/; - if ($lasthour ne $hour or &has_who_list($tt)) { - $query_link = &query_ref($td, $build_time_times->[$tt]); + if ($lasthour ne $hour or has_who_list($tt)) { + $query_link = query_ref($td, $build_time_times->[$tt]); $end_query = ''; } if ($lasthour eq $hour) { @@ -300,11 +300,11 @@ BEGIN { # for (my $build_index=0; $build_index < $name_count; $build_index++) { if (not defined($br = $build_table->[$tt][$build_index])) { - # No build data for this time + # No build data for this time (e.g. no build after this time). print "
",
+ print " ",
"Administrate Tinderbox Trees
\n";
}
@@ -441,7 +441,7 @@ sub open_showbuilds_url {
@_
);
- my $url = "${rel_path}showbuilds.cgi?tree=$form{tree}";
+ my $url = "${rel_path}showbuilds.cgi?tree=$::tree";
$url .= "&hours=$hours" if $hours ne $default_hours;
while (my ($key, $value) = each %args) {
$url .= "&$key=$value" if $value ne '';
@@ -500,27 +500,47 @@ sub has_who_list {
}
}
-sub tree_open {
- my ($line, $treestate);
- open(BID, "<../bonsai/data/$bonsai_tree/batchid.pl")
- or print "can't open batchid
";
- $line =
";
- while ($line =
";
+ while (";
print " ";
- print &open_showbuilds_href."$tree as of $tm \n";
+ print &open_showbuilds_href."$::tree";
+ if (is_tree_state_available()) {
+ print (is_tree_open() ? ' is open' : ' is closed');
+ }
+ print ", $tm \n";
foreach my $buildname (@keys) {
print " $buildname ";
}
@@ -754,7 +778,7 @@ sub do_panel {
print "Content-type: text/html\n\n\n" unless $form{static};
my (%build, %times);
- tb_loadquickparseinfo($form{tree}, \%build, \%times);
+ tb_loadquickparseinfo($::tree, \%build, \%times);
print q(
@@ -770,17 +794,15 @@ sub do_panel {
LINK="#0000EE" VLINK="#551A8B" ALINK="#FF0000">
);
# Hack the panel link for now.
- print "$tree";
+ print "$::tree";
- $bonsai_tree = '';
- require "$tree/treedata.pl";
- if ($bonsai_tree ne '') {
- print " is ", tree_open() ? "OPEN" : "CLOSED";
+ if (is_tree_state_available()) {
+ print " is ", is_tree_open() ? 'open' : 'closed';
}
# Add the current time
my ($minute,$hour,$mday,$mon) = (localtime)[1..4];
my $tm = sprintf("%d/%d %d:%02d",$mon+1,$mday,$hour,$minute);
- print " as of $tm
";
+ print ", $tm
";
print "";
while (my ($name, $status) = each %build) {
@@ -793,7 +815,7 @@ sub do_flash {
print "Content-type: text/rdf\n\n" unless $form{static};
my (%build, %times);
- tb_loadquickparseinfo($form{tree}, \%build, \%times);
+ tb_loadquickparseinfo($::tree, \%build, \%times);
my ($mac,$unix,$win) = (0,0,0);
@@ -840,7 +862,7 @@ sub do_flash {
diff --git a/webtools/tinderbox/tbglobals.pl b/webtools/tinderbox/tbglobals.pl
index f591ca2806e..9f54de13f41 100755
--- a/webtools/tinderbox/tbglobals.pl
+++ b/webtools/tinderbox/tbglobals.pl
@@ -101,12 +101,22 @@ sub value_encode {
}
+BEGIN {
+ my $have_loaded_treedata = 0;
+
+ sub tb_load_treedata {
+ return if $have_loaded_treedata;
+ $have_loaded_treedata = 1;
+ require "$tree/treedata.pl" if -r "$tree/treedata.pl";
+ }
+}
+
sub tb_load_data {
$tree = $form{'tree'};
return undef unless $tree;
- require "$tree/treedata.pl" if -r "$tree/treedata.pl";
+ tb_load_treedata();
$ignore_builds = {};