head 1.2;
access;
symbols;
locks; strict;
comment @# @;
1.2
date 2005.01.24.15.41.15; author thl; state dead;
branches;
next 1.1;
1.1
date 2005.01.18.08.53.48; author thl; state Exp;
branches;
next ;
desc
@@
1.2
log
@remove build farm utilities from release engineering
@
text
@#!@@l_prefix@@/bin/perl -w
##
## OpenPKG bfui.pl - OpenPKG build farm user interface (used as CGI)
## Copyright (c) 2002-2005 The OpenPKG Project
## Copyright (c) 2002-2005 Ralf S. Engelschall
## Copyright (c) 2002-2005 Cable & Wireless
##
## Permission to use, copy, modify, and distribute this software for
## any purpose with or without fee is hereby granted, provided that
## the above copyright notice and this permission notice appear in all
## copies.
##
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
## SUCH DAMAGE.
##
require 5.008;
use strict;
use OpenPKG::Ctx;
use CGI;
use String::Divert;
use Data::Dumper;
use IO::File;
use DBI;
use DBD::SQLite;
# configure optional debugging
$Data::Dumper::Purity = 1;
$Data::Dumper::Indent = 1;
$Data::Dumper::Terse = 1;
# determine OpenPKG information
my $ctx = new OpenPKG::Ctx;
my $prefix = $ctx->prefix();
# configuration
my $dbfile = "$prefix/var/bfdb.sqlite";
my $verbose = undef;
my $pasture = "/e/openpkg/bf"; # logs expected below $pasture/log/$inst/
# internal handling of fatal errors
BEGIN {
$SIG{__DIE__} = sub {
my ($msg) = @@_;
my $hint = '';
if ($msg =~ m|line\s+(\d+)|) {
my $line = $1;
my $io = new IO::File "<$0";
my @@code = $io->getlines();
$io->close();
my $i = -1;
$hint = join("", map { s/^/sprintf("%d: ", $line+$i++)/se; $_; } @@code[$line-2..$line]);
}
print STDOUT
"Content-Type: text/html; charset=ISO-8859-1\n" .
"\n" .
"\n" .
" \n" .
" GURU MEDITATION\n" .
" \n" .
" \n" .
" \n" .
" \n" .
"
\n" .
"
\n" .
" GURU MEDITATION\n" .
"
\n" .
" \n" .
" $msg \n" .
" \n" .
"
\n$hint
\n" .
"
\n" .
"
\n" .
" \n" .
"\n";
exit(0);
};
}
# catch and hold time
my $time = time();
# create objects
my $cgi = new CGI;
my $dbh = &dbinit($dbfile);
my $html = new String::Divert;
$html->overload(1);
##
## Generate Canvas
##
# generate outer canvas
$html .= "
\n";
}
else {
$html .= "Sorry, the logfile \"$logfile\" does not exist yet or not exist any longer";
}
return $html;
}
sub viewprocessing()
{
my $rv;
my $html;
$rv = $dbh->selectall_hashref("SELECT * FROM processing;", "pr_inst_host");
if (not $rv) {
die "ERROR:$0: SQLite error: ".$dbh->errstr."\n";
}
$html .= "
";
return $html;
}
# open database and check whether important tables exist
sub dbinit ($)
{
my ($dbfile) = @@_;
my $dbh = DBI->connect("dbi:SQLite:dbname=$dbfile", "", "", { RaiseError => 0, AutoCommit => 1 });
if (not defined $dbh) { die "$0: \"cannot open database file \"$dbfile\"\n"; }
my $tables = $dbh->selectall_hashref("SELECT name FROM sqlite_master WHERE type='table' ORDER BY name;", "name");
unless ($tables->{status}) { die "$0: \"status\" table missing in database file \"$dbfile\"\n"; }
unless ($tables->{processing}) { die "$0: \"processing\" table missing in database file \"$dbfile\"\n"; }
unless ($tables->{class}) { die "$0: \"class\" table missing in database file \"$dbfile\"\n"; }
return $dbh;
}
__END__
=pod
=head1 NAME
B - OpenPKG build farm user interface
=head1 SYNOPSIS
used as CGI
=head1 DESCRIPTION
=cut
@
1.1
log
@OpenPKG build farm database and user interface
The build farm master creates Makefiles for the slaves which run them to
build packages and drop resulting binaries (if any) along with logs on a
shared storage. This behavior remains unchanged.
Currently the master picks up logs from preconfigured slaves, creates a
status report through a lengthy process and uploads status and logs to
the primary OpenPKG web server. Disadvantage is the maintenance required
to register the slaves for processing on the master and viewing on
the web server and bad scalability because the workload on the master
increases with every new slave. The delay in status processing does not
provide realtime information. The communcation bandwith, CPU horsepower
and disk space on the primary web server are constantly utilized with
status and logfile updates in addition to serving the resulting status
pages to engineers.
The build farm database does not require registration of slaves, it uses
the security infrastructure which already exists to trigger Makefile
execution and log file writing. In addition, the database and tables are
created on the fly making it virtually maintenance free. All connected
slaves upload status information in realtime using the bfdb.pl shell
interface. Remote shell execution just needs to be plugged into the
Makefile and does not add any new requirements to the slaves software
portfolio. The need for the master to pick up and process logs and
the associated maintenance efforts, scalability problems and realtime
limitations are fully eliminated. A local webserver running on the
master allows access to status and logs in realtime, offloading such
tasks from the primary OpenPKG web server completely.
@
text
@@