#!/usr/bin/perl -- # -*- Mode: perl; indent-tabs-mode: nil -*- # # 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/ # # 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. # # Contributor(s): use strict; require 'tbglobals.pl'; require 'header.pl'; # Process the form arguments my %form = &split_cgi_args(); $|=1; print "Content-type: text/html\n\n"; $form{noignore} = 1; # Force us to load all build info, not # paying any attention to ignore_builds stuff. $form{hours} = 24; # Force us to check the past 24 hrs of builds $form{tree} = &validate_tree($form{tree}); my $treedata = &tb_load_data(\%form); my (@names, $i, $checked); if (defined($treedata)) { my $tree = $treedata->{name}; my $safe_tree = value_encode($tree); EmitHtmlHeader("administer tinderbox", "tree: $safe_tree"); # Sheriff my $current_sheriff = &tb_load_sheriff($tree); $current_sheriff =~ s/\s*$//; # Trim trailing whitespace; # Status message. my $status_message = &tb_load_status($tree); $status_message =~ s/\s*$//; # Trim trailing whitespace; # Tree rules. my $rules_message = &tb_load_rules($tree); $rules_message =~ s/\s*$//; # Trim trailing whitespace; # # Change sheriff # print "

Change sheriff info. (mailto: url, phone number, etc.)

Password:

"; # # Status message # print "

Status message. (Use this for stay-out-of-the-tree warnings, etc.)

Password:

"; # # Rules message. # print "

The tree rules.

Password:

"; # # Trim logs. # # Determine the collective size & age of the build logs opendir(TRIM_DIR, &shell_escape("$::tree_dir/$tree")) || die "opendir($safe_tree): $!"; my @trim_files = grep { /\.(?:gz|brief\.html)$/ && -f "$::tree_dir/$tree/$_" } readdir(TRIM_DIR); close(TRIM_DIR); my $trim_bytes = 0; my $trim_size; 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_dir/$tree/$file"); $trim_bytes += $file_stat[7]; $trim_oldest = $file_stat[9] if ($trim_oldest > $file_stat[9]); } my $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 { $trim_size = (int($trim_bytes / $size_G * 1000)/1000) . " Gb"; } print "
Trim Logs
Trim Logs to days
Tinderbox is configured to show up to $::global_treedata->{$tree}->{who_days} days of log history. Currently, there are $trim_days days of logging taking up $trim_size of space.
Password:

" ; # # Individual tree administration # print "Individual tree administration
"; print "
ActiveOnly checked builds are shown. Add &noignore=1 to the tinderbox URL to override.
ScrapeChecked builds will have the logs scanned for a token of the form TinderboxPrint:aaa,bbb,ccc.
These values will show up as-is in the showbuilds.cgi output.
WarningsChecked builds will have the logs scanned for compiler warning messages.
"; print "
"; @names = sort (@{$treedata->{build_names}}) ; for $i (@names){ if ($i ne "") { my $buildname = &value_encode($i); my $active_check = ($treedata->{ignore_builds}->{$i} != 0 ? "": "CHECKED=1" ); my $scrape_check = ($treedata->{scrape_builds}->{$i} != 0 ? "CHECKED=1" : "" ); my $warning_check = ($treedata->{warning_builds}->{$i} != 0 ? "CHECKED=1": "" ); print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } } print "
BuildActiveScrapeWarnings
$buildname
\n"; print " Password:

"; print "Return to tree\n"; } else { # # Create a new tinderbox page. # EmitHtmlHeader("administer tinderbox", "create a tinderbox page"); print "
Create a new tinderbox page, examples for SeaMonkey shown in parens.
tinderbox tree name: (SeaMonkey)
days of commit history to display: (14)
Bonsai query options:
cvs repository: (/cvsroot)
cvs module name: (MozillaTinderboxAll)
cvs branch: (HEAD)
bonsai tree: (SeaMonkey)
bonsai dir: (/var/www/html/bonsai)
bonsai url: (http://bonsai.mozilla.org/)
Bonsai database driver: (mysql)
Bonsai database host: (localhost)
Bonsai database port: (3306)
Bonsai database name: (bonsai)
Bonsai database username: (bonsai)
Bonsai database password: (bonsai)
registry url: (http://bonsai.mozilla.org/registry/)
ViewVC query options:
ViewVC URL: (http://viewvc/cgi-bin/viewvc.cgi/svn)
ViewVC Repository: (/svnroot)
ViewVC database driver: (mysql)
ViewVC database host: (localhost)
ViewVC database port: (3306)
ViewVC database name: (viewvc)
ViewVC database username: (viewvc)
ViewVC database password: (viewvc)
Password:

"; } print "\n";