added the ability to disable builds instead of removing them from the page

This commit is contained in:
ltabb 1998-06-22 21:28:47 +00:00
parent 365c772ff9
commit 9c93fda9a5
3 changed files with 71 additions and 11 deletions

View File

@ -31,7 +31,6 @@ EmitHtmlHeader("administer tinderbox", "tree: $tree");
&load_data;
if( -r "$tree/mod.pl" ){
require "$tree/mod.pl";
}
@ -88,22 +87,27 @@ print "
</FORM>
<FORM method=post action=doadmin.cgi>
<hr>
<B><font size=+1>If builds are behaving badly you can turn them off.</font></b><br> Uncheck
the build that is misbehaving and click the button. You can still see all the
builds even if some are disabled by adding the parameter <b><tt>&noignore=1</tt></b> to
the tinderbox URL.<br>
<B>Password:</B> <INPUT NAME=password TYPE=password> <BR>
<INPUT TYPE=HIDDEN NAME=tree VALUE=$tree>
<INPUT TYPE=HIDDEN NAME=command VALUE=remove_build>
<INPUT TYPE=HIDDEN NAME=command VALUE=disable_builds>
";
$i = 1;
while( $i <= $name_count ){
$n = $build_name_names->[$i];
print "<INPUT TYPE=radio NAME=build VALUE='$n'>";
print "$n<br>\n";
$i++;
@names = sort (@$build_name_names, keys %$ignore_builds) ;
for $i (@names){
if( $i ne "" ){
$checked = ($ignore_builds->{$i} != 0 ? "": "CHECKED" );
print "<INPUT TYPE=checkbox NAME='build_$i' $checked >";
print "$i<br>\n";
}
}
print "
<INPUT TYPE=SUBMIT VALUE='Remove Build From Page'>
<INPUT TYPE=SUBMIT VALUE='Show only checked builds'>
</FORM>
<hr>
";

View File

@ -24,6 +24,7 @@ require 'globals.pl';
umask O666;
$|=1;
check_password();
@ -44,6 +45,9 @@ elsif( $command eq 'trim_logs' ){
}
elsif( $command eq 'set_message' ){
&set_message;
}
elsif( $command eq 'disable_builds' ){
&disable_builds;
} else {
print "Unknown command: \"$command\".";
}
@ -161,6 +165,41 @@ sub remove_build {
$builds_removed Builds removed from build.dat</a></h2>\n";
}
sub disable_builds {
my $i,%buildnames;
$build_name = $form{'build'};
#
# Trim build.dat
#
open(BD, "<$tree/build.dat");
while( <BD> ){
($mailtime,$buildtime,$bname) = split( /\|/ );
$buildnames{$bname} = 0;
}
close( BD );
for $i (keys %form) {
if ($i =~ /^build_/ ){
$i =~ s/^build_//;
$buildnames{$i} = 1;
}
}
open(IGNORE, ">$tree/ignorebuilds.pl");
print IGNORE '$ignore_builds = {' . "\n";
for $i ( sort keys %buildnames ){
if( $buildnames{$i} == 0 ){
print IGNORE "\t\t'$i' => 1,\n";
}
}
print IGNORE "\t};\n";
chmod( 0777, "$tree/ignorebuilds.pl");
print "<h2><a href=showbuilds.cgi?tree=$treename>Build state Changed</a></h2>\n";
}
sub set_message {
$m = $form{'message'};
$m =~ s/\"/\\\"/g;

View File

@ -29,6 +29,7 @@ $td2 = {};
$build_list = []; # array of all build records
$build_name_index = {};
$ignore_builds = {};
$build_name_names = [];
$name_count = 0;
@ -120,11 +121,16 @@ 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';
}
@ -142,11 +148,19 @@ sub load_data {
die "the \"tree\" parameter must be provided\n" unless $tree;
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;
if( $cvs_root eq '' ){
$cvs_root = '/m/src';
}
@ -196,7 +210,10 @@ sub load_buildlog {
binaryname => $binaryname,
td => $t
};
if( $mailtime > 0 && $buildtime > $mindate ){
if( $mailtime > 0
&& $buildtime > $mindate
&& ($form{noignore} || !($t->{ignore_builds}->{$buildname} != 0))
){
push @{$build_list}, $buildrec;
}
}