Changes to allow Tinderbox to know how to deal with multiple bonsai setups.

bug 380118, r=bear
patch by cls
This commit is contained in:
bear%code-bear.com 2007-08-25 02:53:16 +00:00
Родитель ef507d7769
Коммит 723fc018c8
9 изменённых файлов: 55 добавлений и 52 удалений

Просмотреть файл

@ -23,8 +23,6 @@
# This Makefile helps you install Tinderbox.
# Set the variables below to their proper locations.
# TINDERBOX_DIR is the full path to where you want to install tinderbox
# BONSAI_DIR is the full path to your local bonsai installation
# BONSAI_URL is the root URL to your bonsai install (e.g. ../bonsai)
# The other variables contain full paths to the utitlies required to
# use tinderbox.
@ -34,10 +32,6 @@
# Begin SERVER_CONFIGURATION
#TINDERBOX_DIR = /var/www/html/tinderbox
#USE_BONSAI = 1
#BONSAI_DIR = /var/www/html/bonsai
#BONSAI_URL = /bonsai
#REGISTRY_URL = /registry
# Set these to the user/group that will run the tinderbox processes
#TINDERBOX_USER = tinderbox
@ -107,21 +101,6 @@ ifeq (,$(strip $(TINDERBOX_GROUP)))
$(error TINDERBOX_GROUP must be set to the group that the tinderbox processes run as)
endif
ifdef USE_BONSAI
ifeq (,$(strip $(BONSAI_DIR)))
$(error BONSAI_DIR must be set for bonsai support to work)
endif
ifeq (,$(strip $(BONSAI_URL)))
$(error BONSAI_URL must be set for bonsai support to work)
endif
ifeq (,$(strip $(REGISTRY_URL)))
$(error REGISTRY_URL must be set for bonsai support to work)
endif
endif
# Avoid warnings in various scripts by setting BONSAI_DIR to a secure default
BONSAI_DIR ?= $(TINDERBOX_DIR)
install:
$(foreach u,$(ALL_UTILS),$(if $($u),,$(error $u must be set to the full path of the utility)))
mkdir -p $(TINDERBOX_DIR)/examples
@ -130,9 +109,6 @@ install:
echo Installing $$I && \
sed -e s#/usr/bonsaitools/bin/perl#$(PERL)#g \
-e s#@CVSROOT@#$(CVSROOT)#g \
-e s#@BONSAI_DIR@#$(BONSAI_DIR)#g \
-e s#@BONSAI_URL@#$(BONSAI_URL)#g \
-e s#@REGISTRY_URL@#$(REGISTRY_URL)#g \
-e s#@TINDERBOX_DIR@#$(TINDERBOX_DIR)#g \
-e s#@SETUID_PATH@#$(SETUID_PATH)#g \
$$I > $(TINDERBOX_DIR)/$$I && \

Просмотреть файл

@ -252,6 +252,21 @@ print "
<TD>(SeaMonkey)</TD>
</TR>
<TR>
<TD>bonsai dir:</TD>
<TD><INPUT NAME=bonsaidir></TD>
<TD>(/var/www/html/bonsai)</TD>
</TR>
<TR>
<TD>bonsai url:</TD>
<TD><INPUT NAME=bonsaiurl></TD>
<TD>(http://bonsai.mozilla.org/)</TD>
</TR>
<TR>
<TD>registry url:</TD>
<TD><INPUT NAME=registryurl></TD>
<TD>(http://bonsai.mozilla.org/registry/)</TD>
</TR>
<TR>
<TD>
<b>ViewVC query options:</b><br>
</TD>

Просмотреть файл

@ -48,11 +48,15 @@ $tree = &trick_taint(shift);
# $cvs_module: The checkout module
# $cvs_branch: The current branch
# $cvs_root: The path to the cvs root
# $bonsai_tree: The data directory for this tree in $::bonsai_dir
# $bonsai_dir: The path to the bonsai installation used by $tree
# $bonsai_tree: The data directory for this tree in $bonsai_dir
# $viewvc_repository: Repository path used by viewvc for this tree
&tb_load_treedata($tree);
my $use_bonsai = $::global_treedata->{$tree}->{use_bonsai};
my $use_viewvc = $::global_treedata->{$tree}->{use_viewvc};
my $bonsai_dir;
# Silence perl compile-time warnings by letting $bonsai_dir have a real default
BEGIN { $bonsai_dir = $::global_treedata->{$tree}->{bonsai_dir} || '@TINDERBOX_DIR@'; }
my $bonsai_tree = $::global_treedata->{$tree}->{bonsai_tree};
my $cvs_module = $::global_treedata->{$tree}->{cvs_module};
my $cvs_branch = $::global_treedata->{$tree}->{cvs_branch};
@ -81,10 +85,10 @@ if ($use_bonsai) {
$::CVS_REPOS_SUFIX = $::CVS_ROOT;
$::CVS_REPOS_SUFIX =~ s/\//_/g;
$::CHECKIN_DATA_FILE = "$::bonsai_dir/data/checkinlog$::CVS_REPOS_SUFIX";
$::CHECKIN_INDEX_FILE = "$::bonsai_dir/data/index$::CVS_REPOS_SUFIX";
$::CHECKIN_DATA_FILE = "$bonsai_dir/data/checkinlog$::CVS_REPOS_SUFIX";
$::CHECKIN_INDEX_FILE = "$bonsai_dir/data/index$::CVS_REPOS_SUFIX";
use lib "@BONSAI_DIR@";
use lib "$bonsai_dir";
require 'cvsquery.pl';
print "cvsroot='$::CVS_ROOT'\n" if $F_DEBUG;
@ -129,7 +133,7 @@ sub build_who {
open(WHOLOG, ">", "$temp_who_file");
if ($use_bonsai) {
chdir $::bonsai_dir;
chdir $bonsai_dir;
$::TreeID = $bonsai_tree;
$result = &query_checkins(%::mod_map);
} elsif ($use_viewvc) {

Просмотреть файл

@ -85,6 +85,9 @@ sub create_tree {
$treedata{cvs_module} = $form{'modulename'};
$treedata{cvs_branch}= $form{'branchname'};
$treedata{bonsai_tree} = $form{'bonsaitreename'};
$treedata{bonsai_dir} = $form{'bonsaidir'};
$treedata{bonsai_url} = $form{'bonsaiurl'};
$treedata{registry_url} = $form{'registryurl'};
$treedata{viewvc_url} = $form{'viewvc_url'};
$treedata{viewvc_repository} = $form{'viewvc_repository'};
$treedata{viewvc_dbdriver} = $form{'viewvc_dbdriver'};
@ -98,15 +101,16 @@ sub create_tree {
my $treename = $tree;
for my $var ( 'cvs_module', 'cvs_branch', 'bonsai_tree') {
$treedata{use_bonsai}++ if (defined($treedata{$var}) &&
"$treedata{$var}" ne "");
for my $var ( 'cvs_module', 'cvs_branch', 'bonsai_tree', 'bonsai_dir',
'bonsai_url', 'registry_url') {
$treedata{use_bonsai} = 1 if (defined($treedata{$var}) &&
"$treedata{$var}" ne "");
}
for my $var ('viewvc_url','viewvc_repository',
'{viewvc_dbdriver', 'viewvc_dbhost', 'viewvc_dbport',
'viewvc_dbname', 'viewvc_user', 'viewvc_passwd') {
$treedata{use_viewvc}++ if (defined($treedata{$var}) &&
"$treedata{$var}" ne "");
$treedata{use_viewvc} = 1 if (defined($treedata{$var}) &&
"$treedata{$var}" ne "");
}
if ($treedata{use_bonsai} && $treedata{use_viewvc}) {
my $errmsg = "Cannot configure tinderbox to use bonsai & viewvc at the same time.";

Просмотреть файл

@ -33,9 +33,6 @@ sub EmitHtmlTitleAndHeader {
if (open(BANNER, "<", "$::data_dir/banner.html")) {
while (<BANNER>) { print; }
close BANNER;
} elsif (open(BANNER, "<", "$::bonsai_dir/data/banner.html")) {
while (<BANNER>) { print; }
close BANNER;
}
print "<TABLE BORDER=0 CELLPADDING=12 CELLSPACING=0 WIDTH=\"100%\">";

Просмотреть файл

@ -574,7 +574,9 @@ sub open_showbuilds_href_target {
$output .= "&who=" . &url_encode($who) if (defined($who) && $who ne '');
$output .= "\">";
} elsif ($::global_treedata->{$td->{name}}->{use_bonsai}) {
$output = "<a href=$::bonsai_url/cvsquery.cgi";
$output = "<a href=" .
$::global_treedata->{$td->{name}}->{bonsai_url} .
"cvsquery.cgi";
$output .= "?module=$td->{cvs_module}";
$output .= "&branch=$td->{cvs_branch}" if $td->{cvs_branch} ne 'HEAD';
$output .= "&branchtype=regexp"
@ -609,7 +611,8 @@ sub open_showbuilds_href_target {
(defined($maxdate));
$ret = "<a href='$qr'>";
} elsif ($::global_treedata->{$td->{name}}->{use_bonsai}) {
$qr = "$::registry_url/who.cgi?email=". &url_encode($who)
$qr = $::global_treedata->{$td->{name}}->{registry_url} .
"/who.cgi?email=". &url_encode($who)
. "&d=$td->{cvs_module}|$treeflag|$td->{cvs_root}|$mindate";
$qr = $qr . "|$maxdate" if defined($maxdate);
$ret = "<a href=\"$qr\" onclick=\"return who(event);\">";
@ -656,17 +659,18 @@ sub open_showbuilds_href_target {
$checked_state{$tree} = 1;
&tb_load_treedata($tree);
my $bonsai_tree = $::global_treedata->{$tree}->{bonsai_tree};
return unless defined $bonsai_tree and $bonsai_tree ne '';
my $bonsai_dir = $::global_treedata->{$tree}->{'bonsai_dir'};
return if ($bonsai_tree =~ m/^$/ || $bonsai_dir =~ m/^$/);
local $_;
$::BatchID='';
eval qq(do "$::bonsai_dir/data/$bonsai_tree/batchid.pl");
eval qq(do "$bonsai_dir/data/$bonsai_tree/batchid.pl");
if ($::BatchID eq '') {
warn "No BatchID in $::bonsai_dir/data/$bonsai_tree/batchid.pl\n";
warn "No BatchID in $bonsai_dir/data/$bonsai_tree/batchid.pl\n";
return;
}
open(BATCH, "<", "$::bonsai_dir/data/$bonsai_tree/batch-$::BatchID.pl")
or warn "Cannot open $::bonsai_dir/data/$bonsai_tree/batch-$::BatchID.pl";
open(BATCH, "<", "$bonsai_dir/data/$bonsai_tree/batch-$::BatchID.pl")
or warn "Cannot open $bonsai_dir/data/$bonsai_tree/batch-$::BatchID.pl";
while (<BATCH>) {
if (/^\$::TreeOpen = '(\d+)';/) {
$treestate{$tree} = $1;

Просмотреть файл

@ -349,7 +349,7 @@ BEGIN {
my $q = quotemeta($out{error_file});
my $goto_line = $out{error_line} > 10 ? $out{error_line} - 10 : 1;
my $cvsblame = $out{error_guess} ? "cvsguess.cgi" : "cvsblame.cgi";
$line =~ s@$q@<a href=$::bonsai_url/$cvsblame?file=$out{error_file_ref}&rev=$::cvs_branch&mark=$out{error_line}#$goto_line>$out{error_file}</a>@
$line =~ s@$q@<a href=$bonsai_url/$cvsblame?file=$out{error_file_ref}&rev=$cvs_branch&mark=$out{error_line}\#$goto_line>$out{error_file}</a>@;
}
if ($has_error) {

Просмотреть файл

@ -54,10 +54,7 @@ $::CI_LOG=11;
#
# Variables set from Makefile
$::bonsai_dir = "@BONSAI_DIR@";
$::bonsai_url = "@BONSAI_URL@";
$::default_cvsroot = "@CVSROOT@";
$::registry_url = "@REGISTRY_URL@";
$::data_dir='data';
@::global_tree_list = ();
@ -98,7 +95,7 @@ my $display_accurate_build_end_times = 1;
# Format version of treedata.pl
# Use Tie::IxHash to keep order of treedata variables
tie %::default_treedata => 'Tie::IxHash',
treedata_version => 1,
treedata_version => 2,
who_days => 14,
use_bonsai => 1,
use_viewvc => 0,
@ -106,6 +103,9 @@ tie %::default_treedata => 'Tie::IxHash',
cvs_branch => '',
cvs_root => '',
bonsai_tree => '',
bonsai_dir => '',
bonsai_url => '',
registry_url => '',
viewvc_url => '',
viewvc_repository => '',
viewvc_dbdriver => '',

Просмотреть файл

@ -104,10 +104,13 @@ my %form;
$tree = &require_only_one_tree($tree);
$form{tree} = $tree;
&tb_load_treedata($tree);
my $bonsai_dir;
# Silence perl compile-time warnings by letting $bonsai_dir have a real default
BEGIN { $bonsai_dir = $::global_treedata->{$tree}->{bonsai_dir} || '@TINDERBOX_DIR@'; }
my $bonsai_url = $::global_treedata->{$tree}->{bonsai_url};
my $cvs_module = $::global_treedata->{$tree}->{cvs_module};
my $cvs_root = $::global_treedata->{$tree}->{cvs_root};
my $source_root = 'mozilla';
my ($exclude_pat, $tag, %bases, %fullpath, %modules, %module_files);
my (%seen, %unblamed, @who_list, @cvs_modules);
@ -494,7 +497,7 @@ sub build_blame {
my ($cvs_root, $tags) = @_;
my ($file, $lines_hash);
use lib "@BONSAI_DIR@";
use lib "$bonsai_dir";
require 'cvsblame.pl';
while (($file, $lines_hash) = each %warnings) {
@ -849,7 +852,7 @@ sub build_url {
sub file_url {
my ($file, $linenum) = @_;
return "$::bonsai_url/cvsblame.cgi"
return "$bonsai_url/cvsblame.cgi"
."?file=mozilla/$file&mark=$linenum#".($linenum-10);
}