1998-06-16 21:43:24 +00:00
#!/usr/bonsaitools/bin/perl --
# -*- Mode: perl; indent-tabs-mode: nil -*-
#
1999-11-01 23:33:56 +00:00
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (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/
1998-06-16 21:43:24 +00:00
#
1999-11-01 23:33:56 +00:00
# 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.
1998-06-16 21:43:24 +00:00
#
# The Original Code is the Tinderbox build tool.
#
# The Initial Developer of the Original Code is Netscape Communications
1999-11-01 23:33:56 +00:00
# Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
1998-06-16 21:43:24 +00:00
1999-07-23 19:36:38 +00:00
require 'tbglobals.pl';
1998-06-16 21:43:24 +00:00
require 'header.pl';
2006-05-27 00:18:42 +00:00
# Process the form arguments
%form = ();
&split_cgi_args();
1998-06-16 21:43:24 +00:00
$|=1;
2006-07-24 18:41:23 +00:00
print "Content-type: text/html\n\n";
1998-06-16 21:43:24 +00:00
1999-03-10 03:03:27 +00:00
$form{noignore} = 1; # Force us to load all build info, not
# paying any attention to ignore_builds stuff.
$maxdate = time();
$mindate = $maxdate - 24*60*60;
1999-10-29 18:52:04 +00:00
tb_load_data();
1998-06-16 21:43:24 +00:00
2000-07-20 02:52:11 +00:00
EmitHtmlHeader("administer tinderbox", "tree: $tree");
1998-09-01 01:14:20 +00:00
if (defined($tree)) {
2000-07-20 23:33:11 +00:00
# Sheriff
if( -r "$tree/sheriff.pl" ){
require "$tree/sheriff.pl";
$current_sheriff =~ s/\s*$//; # Trim trailing whitespace;
} else {
$current_sheriff = "";
1998-09-01 01:40:24 +00:00
}
2000-07-20 23:33:11 +00:00
# Status message.
if( -r "$tree/status.pl" ){
require "$tree/status.pl";
$status_message =~ s/\s*$//; # Trim trailing whitespace;
} else {
$status_message = "";
1998-09-01 01:40:24 +00:00
}
1998-06-16 21:43:24 +00:00
2000-07-20 23:33:11 +00:00
# Tree rules.
if( -r "$tree/rules.pl" ){
require "$tree/rules.pl";
$rules_message =~ s/\s*$//; # Trim trailing whitespace;
} else {
$rules_message = "";
}
#
# Change sheriff
#
1998-09-01 01:40:24 +00:00
print "
1998-06-16 21:43:24 +00:00
<FORM method=post action=doadmin.cgi>
2000-07-20 23:33:11 +00:00
<INPUT TYPE=HIDDEN NAME=tree VALUE=$tree>
<INPUT TYPE=HIDDEN NAME=command VALUE=set_sheriff>
<br><b>Change sheriff info.</b> (mailto: url, phone number, etc.)<br>
2002-02-21 07:02:09 +00:00
<TEXTAREA NAME=sheriff ROWS=8 COLS=75 WRAP=SOFT>$current_sheriff
2000-07-20 23:33:11 +00:00
</TEXTAREA>
<br>
1998-06-16 21:43:24 +00:00
<B>Password:</B> <INPUT NAME=password TYPE=password>
2000-07-20 23:33:11 +00:00
<b><INPUT TYPE=SUBMIT VALUE='Change Sheriff'></b>
</FORM>
<hr>
";
#
# Status message
#
print "
<FORM method=post action=doadmin.cgi>
1998-06-16 21:43:24 +00:00
<INPUT TYPE=HIDDEN NAME=tree VALUE=$tree>
2000-07-20 23:33:11 +00:00
<INPUT TYPE=HIDDEN NAME=command VALUE=set_status_message>
<br><b>Status message.</b> (Use this for stay-out-of-the-tree warnings, etc.)<br>
2002-02-21 07:02:09 +00:00
<TEXTAREA NAME=status ROWS=8 COLS=75 WRAP=SOFT>$status_message
1998-06-16 21:43:24 +00:00
</TEXTAREA>
2000-07-20 23:33:11 +00:00
<br>
<b>
<B>Password:</B> <INPUT NAME=password TYPE=password>
<INPUT TYPE=SUBMIT VALUE='Change status message'>
</b>
1998-06-16 21:43:24 +00:00
</FORM>
<hr>
";
2000-07-20 23:33:11 +00:00
#
# Rules message.
#
1998-06-16 21:43:24 +00:00
1998-09-01 01:40:24 +00:00
print "
1998-06-16 21:43:24 +00:00
<FORM method=post action=doadmin.cgi>
2000-07-20 23:33:11 +00:00
<INPUT TYPE=HIDDEN NAME=tree VALUE=$tree>
<INPUT TYPE=HIDDEN NAME=command VALUE=set_rules_message>
<br><b>The tree rules.</b>
<br><TEXTAREA NAME=rules ROWS=18 COLS=75 WRAP=SOFT>$rules_message
</TEXTAREA>
<br>
1998-06-16 21:43:24 +00:00
<B>Password:</B> <INPUT NAME=password TYPE=password>
2000-07-20 23:33:11 +00:00
<b><INPUT TYPE=SUBMIT VALUE='Change rules message'></b>
</FORM>
<hr>
";
#
# Trim logs.
#
2006-06-23 16:21:53 +00:00
# Determine the collective size & age of the build logs
opendir(TRIM_DIR, "$tree") || die "opendir($tree): $!";
my @trim_files = grep { /\.(?:gz|brief\.html)$/ && -f "$tree/$_" } readdir(TRIM_DIR);
close(TRIM_DIR);
my $trim_bytes = 0;
my $now = time();
my $trim_oldest = $now;
my $size_K = 1024;
my $size_M = 1048576;
my $size_G = 1073741824;
for my $file (@trim_files) {
my @file_stat = stat("$tree/$file");
$trim_bytes += $file_stat[7];
$trim_oldest = $file_stat[9] if ($trim_oldest > $file_stat[9]);
}
$trim_days = int (($now - $trim_oldest) / 86400);
if ($trim_bytes < $size_k) {
$trim_size = "$trim_bytes b";
} elsif ($trim_bytes < $size_M) {
$trim_size = int($trim_bytes / $size_K) . " Kb";
} elsif ($trim_bytes < $size_G){
$trim_size = int($trim_bytes / $size_M) . " Mb";
} else {
2006-07-24 19:47:00 +00:00
$trim_size = (int($trim_bytes / $size_G * 1000)/1000) . " Gb";
2006-06-23 16:21:53 +00:00
}
2000-07-20 23:33:11 +00:00
print "
<FORM method=post action=doadmin.cgi>
2006-06-23 16:21:53 +00:00
<INPUT TYPE=HIDDEN NAME=tree VALUE='$tree'>
1998-06-16 21:43:24 +00:00
<INPUT TYPE=HIDDEN NAME=command VALUE=trim_logs>
2000-07-20 23:33:11 +00:00
<b>Trim Logs</b><br>
2006-06-23 16:21:53 +00:00
Trim Logs to <INPUT NAME=days size=5 VALUE='$trim_days'> days<br>
Tinderbox is configured to show up to $who_days days of log history. Currently, there are $trim_days days of logging taking up $trim_size of space.<br>
2000-07-20 23:33:11 +00:00
<B>Password:</B> <INPUT NAME=password TYPE=password>
<INPUT TYPE=SUBMIT VALUE='Trim Logs'>
1998-06-16 21:43:24 +00:00
</FORM>
<hr>
" ;
2006-07-18 01:12:38 +00:00
} else {
1998-06-16 21:43:24 +00:00
2000-07-20 23:33:11 +00:00
#
# Create a new tinderbox page.
#
1998-06-16 21:43:24 +00:00
print "
<FORM method=post action=doadmin.cgi>
<INPUT TYPE=HIDDEN NAME=tree VALUE=$tree>
<INPUT TYPE=HIDDEN NAME=command VALUE=create_tree>
2001-03-29 03:45:38 +00:00
<b>Create a new tinderbox page, examples for SeaMonkey shown in parens.</b>
1998-06-16 21:43:24 +00:00
<TABLE>
<TR>
2000-07-20 23:33:11 +00:00
<TD>tinderbox tree name:</TD>
1998-06-16 21:43:24 +00:00
<TD><INPUT NAME=treename VALUE=''></TD>
2001-03-29 03:45:38 +00:00
<TD>(SeaMonkey)</TD>
</TR>
<TR>
2006-06-23 16:12:41 +00:00
<TD>days of commit history to display:</TD>
<TD><INPUT NAME=who_days VALUE=14></TD>
<TD>(14)</TD>
</TR>
<TR>
2006-06-05 17:42:48 +00:00
<TD>
<b>Bonsai query options:</b><br>
</TD>
</TR>
<TR>
2000-07-20 23:33:11 +00:00
<TD>cvs repository:</TD>
1998-12-31 21:33:19 +00:00
<TD><INPUT NAME=repository VALUE=''></TD>
2001-03-29 03:45:38 +00:00
<TD>(/cvsroot)</TD>
</TR>
<TR>
2000-07-20 23:33:11 +00:00
<TD>cvs module name:</TD>
1998-06-16 21:43:24 +00:00
<TD><INPUT NAME=modulename VALUE=''></TD>
2001-03-29 03:45:38 +00:00
<TD>(MozillaTinderboxAll)</TD>
</TR>
<TR>
2000-07-20 23:33:11 +00:00
<TD>cvs branch:</TD>
2006-06-05 17:42:48 +00:00
<TD><INPUT NAME=branchname VALUE=''></TD>
2001-03-29 03:45:38 +00:00
<TD>(HEAD)</TD>
</TR>
<TR>
<TD>bonsai tree:</TD>
<TD><INPUT NAME=bonsaitreename></TD>
<TD>(SeaMonkey)</TD>
1998-06-16 21:43:24 +00:00
</TR>
2006-06-05 17:42:48 +00:00
<TR>
<TD>
<b>ViewVC query options:</b><br>
</TD>
</TR>
<TR>
<TD>ViewVC URL:</TD>
<TD><INPUT NAME=viewvc_url></TD>
<TD>(http://viewvc/cgi-bin/viewvc.cgi/svn)</TD>
</TR>
<TR>
<TD>ViewVC Repository:</TD>
<TD><INPUT NAME=viewvc_repository></TD>
<TD>(/svnroot)</TD>
</TR>
<TR>
<TD>ViewVC database driver:</TD>
<TD><INPUT NAME=viewvc_dbdriver></TD>
<TD>(mysql)</TD>
</TR>
<TR>
<TD>ViewVC database host:</TD>
<TD><INPUT NAME=viewvc_dbhost></TD>
<TD>(localhost)</TD>
</TR>
<TR>
<TD>ViewVC database port:</TD>
<TD><INPUT NAME=viewvc_dbport></TD>
<TD>(3306)</TD>
</TR>
<TR>
<TD>ViewVC database name:</TD>
<TD><INPUT NAME=viewvc_dbname></TD>
<TD>(viewvc)</TD>
</TR>
<TR>
<TD>ViewVC database username:</TD>
<TD><INPUT NAME=viewvc_dbuser></TD>
<TD>(viewvc)</TD>
</TR>
<TR>
<TD>ViewVC database password:</TD>
<TD><INPUT NAME=viewvc_dbpasswd TYPE=password></TD>
<TD>(viewvc)</TD>
</TR>
1998-06-16 21:43:24 +00:00
</TABLE>
2000-07-20 23:33:11 +00:00
<B>Password:</B> <INPUT NAME=password TYPE=password>
1998-06-16 21:43:24 +00:00
<INPUT TYPE=SUBMIT VALUE='Create a new Tinderbox page'>
</FORM>
<hr>
1998-09-01 01:14:20 +00:00
";
2006-07-18 01:12:38 +00:00
}
2001-11-09 21:32:41 +00:00
#
# Toggle scraping for builds.
#
if (defined($tree)) {
print "
<B><font size=+1>Turn on log scraping.</font></b><br> Checked builds will have the logs scanned fora token of the form <b>TinderboxPrint:aaa,bbb,ccc</b>. These values will show up as-is in the showbuilds.cgi output.<br>
<FORM method=post action=doadmin.cgi>
<INPUT TYPE=HIDDEN NAME=tree VALUE=$tree>
<INPUT TYPE=HIDDEN NAME=command VALUE=scrape_builds>
";
@names = sort (@$build_names) ;
for $i (@names){
if( $i ne "" ){
$checked = ($scrape_builds->{$i} != 0 ? "CHECKED": "" );
print "<INPUT TYPE=checkbox NAME='build_$i' $checked >";
print "$i<br>\n";
}
}
print "
<B>Password:</B> <INPUT NAME=password TYPE=password>
<INPUT TYPE=SUBMIT VALUE='Scrape only checked builds'>
</FORM>
<hr>
";
}
2000-07-20 23:33:11 +00:00
#
# Turn builds off.
#
1998-09-01 01:14:20 +00:00
if (defined($tree)) {
1998-09-01 01:40:24 +00:00
print "
1998-06-22 21:28:47 +00:00
<B><font size=+1>If builds are behaving badly you can turn them off.</font></b><br> Uncheck
2001-11-09 21:32:41 +00:00
the build that is misbehaving and click the button. Add <b><tt>&noignore=1</tt></b> to
the tinderbox URL to override.<br>
2000-07-20 23:33:11 +00:00
<FORM method=post action=doadmin.cgi>
1998-06-16 21:43:24 +00:00
<INPUT TYPE=HIDDEN NAME=tree VALUE=$tree>
1998-06-22 21:28:47 +00:00
<INPUT TYPE=HIDDEN NAME=command VALUE=disable_builds>
1998-06-16 21:43:24 +00:00
";
1999-10-29 18:52:04 +00:00
@names = sort (@$build_names) ;
1998-06-22 21:28:47 +00:00
1998-09-01 01:40:24 +00:00
for $i (@names){
if( $i ne "" ){
$checked = ($ignore_builds->{$i} != 0 ? "": "CHECKED" );
print "<INPUT TYPE=checkbox NAME='build_$i' $checked >";
print "$i<br>\n";
}
1998-06-22 21:28:47 +00:00
}
1998-06-16 21:43:24 +00:00
1998-09-01 01:40:24 +00:00
print "
2000-07-20 23:33:11 +00:00
<B>Password:</B> <INPUT NAME=password TYPE=password>
1998-06-22 21:28:47 +00:00
<INPUT TYPE=SUBMIT VALUE='Show only checked builds'>
1998-06-16 21:43:24 +00:00
</FORM>
<hr>
";
1998-09-01 01:14:20 +00:00
}
2006-07-24 18:41:23 +00:00
print "</BODY></HTML>\n";