Initial commit
authorJoshua Drake <jd@commandprompt.com>
Sun, 3 Dec 2006 03:12:58 +0000 (03:12 +0000)
committerJoshua Drake <jd@commandprompt.com>
Sun, 3 Dec 2006 03:12:58 +0000 (03:12 +0000)
52 files changed:
cgi-bin/.htaccess [new file with mode: 0644]
cgi-bin/bfschmema [new file with mode: 0644]
cgi-bin/envtest.pl [new file with mode: 0644]
cgi-bin/get_bf_status_soap.pl [new file with mode: 0644]
cgi-bin/newshowstat.pl [new file with mode: 0644]
cgi-bin/pgstatus.pl [new file with mode: 0644]
cgi-bin/register.pl [new file with mode: 0644]
cgi-bin/show_history.pl [new file with mode: 0644]
cgi-bin/show_history2.pl [new file with mode: 0644]
cgi-bin/show_log.pl [new file with mode: 0644]
cgi-bin/show_members.pl [new file with mode: 0644]
cgi-bin/show_stage_log.pl [new file with mode: 0644]
cgi-bin/show_stage_log2.pl [new file with mode: 0644]
cgi-bin/show_status.pl [new file with mode: 0644]
cgi-bin/show_status.pl.save [new file with mode: 0644]
cgi-bin/show_status2.pl [new file with mode: 0644]
cgi-bin/show_status9.pl [new file with mode: 0644]
cgi-bin/show_status_soap.pl [new file with mode: 0644]
cgi-bin/test.pl [new file with mode: 0644]
cgi-bin/upgrade.pl [new file with mode: 0644]
htdocs/bfweb.tgz [new file with mode: 0644]
htdocs/elephant-head_only.gif [new file with mode: 0644]
htdocs/elephant-icon.png [new file with mode: 0644]
htdocs/elephant5.gif [new file with mode: 0644]
htdocs/elephant5a.gif [new file with mode: 0644]
htdocs/img/blank.gif [new file with mode: 0644]
htdocs/img/bug.png [new file with mode: 0644]
htdocs/img/camel.png [new file with mode: 0644]
htdocs/img/cassert.png [new file with mode: 0644]
htdocs/img/days.png [new file with mode: 0644]
htdocs/img/kerberos.png [new file with mode: 0644]
htdocs/img/krb.gif [new file with mode: 0644]
htdocs/img/pam.png [new file with mode: 0644]
htdocs/img/python.png [new file with mode: 0644]
htdocs/img/ssl_icon.gif [new file with mode: 0644]
htdocs/img/tcl.png [new file with mode: 0644]
htdocs/img/threads.gif [new file with mode: 0644]
htdocs/img/translateicon.gif [new file with mode: 0644]
htdocs/inc/b/l.png [new file with mode: 0644]
htdocs/inc/b/r.png [new file with mode: 0644]
htdocs/inc/pgbf.css [new file with mode: 0644]
htdocs/inc/pgbuildfarm-banner.png [new file with mode: 0644]
htdocs/index.html [new file with mode: 0644]
htdocs/register.html [new file with mode: 0644]
htdocs/robots.txt [new file with mode: 0644]
schema/bfwebdb.sql [new file with mode: 0644]
templates/bfwrapper.tt [new file with mode: 0644]
templates/bfwrapper.tt.ttc [new file with mode: 0644]
templates/dashboard.tt [new file with mode: 0644]
templates/dashboard.tt.ttc [new file with mode: 0644]
templates/dyn/history.tt [new file with mode: 0644]
templates/dyn/status.tt [new file with mode: 0644]

diff --git a/cgi-bin/.htaccess b/cgi-bin/.htaccess
new file mode 100644 (file)
index 0000000..ead7338
--- /dev/null
@@ -0,0 +1,2 @@
+SetEnv BFConfDir /home/community/pgbuildfarm
+SetEnv BF_DEBUG on
diff --git a/cgi-bin/bfschmema b/cgi-bin/bfschmema
new file mode 100644 (file)
index 0000000..1af2bcf
--- /dev/null
@@ -0,0 +1,274 @@
+--
+-- PostgreSQL database dump
+--
+
+SET client_encoding = 'SQL_ASCII';
+SET check_function_bodies = false;
+
+SET SESSION AUTHORIZATION 'pgbuildfarm';
+
+SET search_path = public, pg_catalog;
+
+--
+-- TOC entry 21 (OID 46831)
+-- Name: plpgsql_call_handler(); Type: FUNC PROCEDURAL LANGUAGE; Schema: public; Owner: pgbuildfarm
+--
+
+CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler
+    AS '$libdir/plpgsql', 'plpgsql_call_handler'
+    LANGUAGE c;
+
+
+--
+-- TOC entry 22 (OID 46833)
+-- Name: plperl_call_handler(); Type: FUNC PROCEDURAL LANGUAGE; Schema: public; Owner: pgbuildfarm
+--
+
+CREATE FUNCTION plperl_call_handler() RETURNS language_handler
+    AS '$libdir/plperl', 'plperl_call_handler'
+    LANGUAGE c;
+
+
+SET SESSION AUTHORIZATION DEFAULT;
+
+--
+-- TOC entry 16 (OID 46832)
+-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: public; Owner: 
+--
+
+CREATE TRUSTED PROCEDURAL LANGUAGE plpgsql HANDLER plpgsql_call_handler;
+
+
+--
+-- TOC entry 17 (OID 46834)
+-- Name: plperl; Type: PROCEDURAL LANGUAGE; Schema: public; Owner: 
+--
+
+CREATE TRUSTED PROCEDURAL LANGUAGE plperl HANDLER plperl_call_handler;
+
+
+--
+-- TOC entry 18 (OID 46835)
+-- Name: plperlu; Type: PROCEDURAL LANGUAGE; Schema: public; Owner: 
+--
+
+CREATE PROCEDURAL LANGUAGE plperlu HANDLER plperl_call_handler;
+
+
+SET SESSION AUTHORIZATION 'pgbuildfarm';
+
+--
+-- TOC entry 4 (OID 2200)
+-- Name: public; Type: ACL; Schema: -; Owner: pgbuildfarm
+--
+
+REVOKE ALL ON SCHEMA public FROM PUBLIC;
+GRANT ALL ON SCHEMA public TO PUBLIC;
+
+
+SET SESSION AUTHORIZATION 'pgbuildfarm';
+
+--
+-- TOC entry 7 (OID 17150)
+-- Name: buildsystems; Type: TABLE; Schema: public; Owner: pgbuildfarm
+--
+
+CREATE TABLE buildsystems (
+    name text NOT NULL,
+    secret text NOT NULL,
+    operating_system text NOT NULL,
+    os_version text NOT NULL,
+    compiler text NOT NULL,
+    compiler_version text NOT NULL,
+    architecture text NOT NULL,
+    status text NOT NULL,
+    sys_owner text NOT NULL,
+    owner_email text NOT NULL,
+    status_ts timestamp without time zone DEFAULT (('now'::text)::timestamp(6) with time zone)::timestamp without time zone
+);
+
+
+--
+-- TOC entry 8 (OID 17150)
+-- Name: buildsystems; Type: ACL; Schema: public; Owner: pgbuildfarm
+--
+
+REVOKE ALL ON TABLE buildsystems FROM PUBLIC;
+GRANT INSERT,SELECT ON TABLE buildsystems TO pgbfweb;
+
+
+SET SESSION AUTHORIZATION 'pgbuildfarm';
+
+--
+-- TOC entry 9 (OID 17155)
+-- Name: build_status; Type: TABLE; Schema: public; Owner: pgbuildfarm
+--
+
+CREATE TABLE build_status (
+    sysname text NOT NULL,
+    snapshot timestamp without time zone NOT NULL,
+    status integer,
+    stage text,
+    log text,
+    conf_sum text,
+    branch text,
+    changed_this_run text,
+    changed_since_success text,
+    log_archive bytea,
+    log_archive_filenames text[],
+    build_flags text[]
+);
+
+
+--
+-- TOC entry 10 (OID 17155)
+-- Name: build_status; Type: ACL; Schema: public; Owner: pgbuildfarm
+--
+
+REVOKE ALL ON TABLE build_status FROM PUBLIC;
+GRANT INSERT,SELECT ON TABLE build_status TO pgbfweb;
+
+
+SET SESSION AUTHORIZATION 'pgbuildfarm';
+
+--
+-- TOC entry 19 (OID 17160)
+-- Name: approve(text, text); Type: FUNCTION; Schema: public; Owner: pgbuildfarm
+--
+
+CREATE FUNCTION approve(text, text) RETURNS void
+    AS 'update buildsystems set name = $2, status =''approved'' where name = $1 and status = ''pending'''
+    LANGUAGE sql;
+
+
+--
+-- TOC entry 5 (OID 17162)
+-- Name: pending; Type: TYPE; Schema: public; Owner: pgbuildfarm
+--
+
+CREATE TYPE pending AS (
+       name text,
+       operating_system text,
+       os_version text,
+       compiler text,
+       compiler_version text,
+       architecture text,
+       owner_email text
+);
+
+
+--
+-- TOC entry 20 (OID 17164)
+-- Name: approve2(text, text); Type: FUNCTION; Schema: public; Owner: pgbuildfarm
+--
+
+CREATE FUNCTION approve2(text, text) RETURNS text
+    AS ' update buildsystems set name = $2, status = ''approved'' where name = $1 and status = ''pending''; select owner_email || '':'' || name || '':'' || secret from buildsystems where name = $2;'
+    LANGUAGE sql;
+
+
+--
+-- TOC entry 6 (OID 47855)
+-- Name: pending2; Type: TYPE; Schema: public; Owner: pgbuildfarm
+--
+
+CREATE TYPE pending2 AS (
+       name text,
+       operating_system text,
+       os_version text,
+       compiler text,
+       compiler_version text,
+       architecture text,
+       owner_email text,
+       "owner" text,
+       status_ts timestamp without time zone
+);
+
+
+--
+-- TOC entry 23 (OID 47857)
+-- Name: pending(); Type: FUNCTION; Schema: public; Owner: pgbuildfarm
+--
+
+CREATE FUNCTION pending() RETURNS SETOF pending2
+    AS 'select name,operating_system,os_version,compiler,compiler_version,architecture,owner_email, sys_owner, status_ts from buildsystems where status = ''pending'' order by status_ts '
+    LANGUAGE sql;
+
+
+--
+-- TOC entry 11 (OID 49741)
+-- Name: list_subscriptions; Type: TABLE; Schema: public; Owner: pgbuildfarm
+--
+
+CREATE TABLE list_subscriptions (
+    addr text
+);
+
+
+--
+-- TOC entry 24 (OID 55330)
+-- Name: prevstat(text, text, timestamp without time zone); Type: FUNCTION; Schema: public; Owner: pgbuildfarm
+--
+
+CREATE FUNCTION prevstat(text, text, timestamp without time zone) RETURNS text
+    AS '
+   select coalesce((select distinct on (snapshot) stage
+                  from build_status
+                  where sysname = $1 and branch = $2 and snapshot < $3
+                  order by snapshot desc
+                  limit 1), ''NEW'') as prev_status
+'
+    LANGUAGE sql;
+
+
+--
+-- TOC entry 13 (OID 23365)
+-- Name: bs_branch_snapshot_idx; Type: INDEX; Schema: public; Owner: pgbuildfarm
+--
+
+CREATE INDEX bs_branch_snapshot_idx ON build_status USING btree (branch, snapshot);
+
+
+--
+-- TOC entry 14 (OID 23366)
+-- Name: bs_sysname_branch_idx; Type: INDEX; Schema: public; Owner: pgbuildfarm
+--
+
+CREATE INDEX bs_sysname_branch_idx ON build_status USING btree (sysname, branch);
+
+
+--
+-- TOC entry 12 (OID 23367)
+-- Name: buildsystems_pkey; Type: CONSTRAINT; Schema: public; Owner: pgbuildfarm
+--
+
+ALTER TABLE ONLY buildsystems
+    ADD CONSTRAINT buildsystems_pkey PRIMARY KEY (name);
+
+
+--
+-- TOC entry 15 (OID 23369)
+-- Name: build_status_pkey; Type: CONSTRAINT; Schema: public; Owner: pgbuildfarm
+--
+
+ALTER TABLE ONLY build_status
+    ADD CONSTRAINT build_status_pkey PRIMARY KEY (sysname, snapshot);
+
+
+--
+-- TOC entry 25 (OID 23371)
+-- Name: bs_fk; Type: FK CONSTRAINT; Schema: public; Owner: pgbuildfarm
+--
+
+ALTER TABLE ONLY build_status
+    ADD CONSTRAINT bs_fk FOREIGN KEY (sysname) REFERENCES buildsystems(name) ON UPDATE CASCADE ON DELETE CASCADE;
+
+
+--
+-- TOC entry 3 (OID 2200)
+-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: pgbuildfarm
+--
+
+COMMENT ON SCHEMA public IS 'Standard public schema';
+
+
diff --git a/cgi-bin/envtest.pl b/cgi-bin/envtest.pl
new file mode 100644 (file)
index 0000000..6158d18
--- /dev/null
@@ -0,0 +1,15 @@
+#!/usr/bin/perl
+
+print "Contect-Type: text/plain\n\n";
+
+print "Conf: $ENV{BFConfDir}\n";
+
+print `pwd`;
+
+print `id`;
+
+foreach my $key (sort keys %ENV)
+{
+  my $val = $ENV{$key};
+  print "$key=$val\n";
+}
diff --git a/cgi-bin/get_bf_status_soap.pl b/cgi-bin/get_bf_status_soap.pl
new file mode 100644 (file)
index 0000000..02059e7
--- /dev/null
@@ -0,0 +1,30 @@
+#!/usr/bin/perl
+
+use lib "/home/community/pgbuildfarm/lib/lib/perl5/site_perl";
+
+use SOAP::Lite +trace;
+
+my $obj = SOAP::Lite
+    ->uri('http://www.pgbuildfarm.org/PGBuildFarm')
+    ->proxy('http://127.0.0.1/cgi-bin/show_status_soap.pl')
+    ->request->header("Host" => "www.pgbuildfarm.org")
+    ;
+
+my $data = $obj->get_status->result;
+my @fields = qw( branch sysname stage status 
+                                 operating_system os_version
+                                 compiler compiler_version architecture
+                                 when_ago snapshot build_flags
+                );
+
+print "Content-Type: text/plain\n\n";
+
+my $head = join (' | ', @fields);
+print $head,"\n";
+
+foreach my $datum (@$data)
+{
+    my $line = join (' | ', @{$datum}{@fields});
+    print $line,"\n";
+}
+
diff --git a/cgi-bin/newshowstat.pl b/cgi-bin/newshowstat.pl
new file mode 100644 (file)
index 0000000..80d4e62
--- /dev/null
@@ -0,0 +1,33 @@
+#!/usr/bin/perl
+
+use strict;
+
+BEGIN
+{
+    $ENV{BFConfDir} ||= $ENV{HOME};
+    require "$ENV{BFConfDir}/BuildFarmWeb.conf";
+}
+
+use lib $BuildFarmWeb::conf{libdir};
+
+use BuildFarmWeb::Store qw(get_recent_status);
+
+use CGI;
+use Template;
+
+my $template = new Template($BuildFarmWeb::conf{template_options});
+
+my $query = new CGI;
+
+my @members = $query->param('member');
+
+my $statrows = get_recent_status(@members);
+
+my $template_vars = {statrows=>$statrows};
+
+print "Content-Type: text/html\n\n";
+$template->process("dashboard.tt",$template_vars);
+
+
+
+
diff --git a/cgi-bin/pgstatus.pl b/cgi-bin/pgstatus.pl
new file mode 100644 (file)
index 0000000..d3ba72a
--- /dev/null
@@ -0,0 +1,401 @@
+#!/usr/bin/perl
+
+use strict;
+
+use CGI;
+use Digest::SHA1  qw(sha1_hex);
+use MIME::Base64;
+use DBI;
+use DBD::Pg;
+use Data::Dumper;
+use Mail::Send;
+use Safe;
+
+use vars qw($dbhost $dbname $dbuser $dbpass $dbport
+       $all_stat $fail_stat $change_stat $green_stat
+);
+
+require "$ENV{BFConfDir}/BuildFarmWeb.pl";
+
+die "no dbname" unless $dbname;
+die "no dbuser" unless $dbuser;
+
+my $dsn="dbi:Pg:dbname=$dbname";
+$dsn .= ";host=$dbhost" if $dbhost;
+$dsn .= ";port=$dbport" if $dbport;
+
+my $query = new CGI;
+
+my $sig = $query->path_info;
+$sig =~ s!^/!!;
+
+my $stage = $query->param('stage');
+my $ts = $query->param('ts');
+my $animal = $query->param('animal');
+my $log = $query->param('log');
+my $res = $query->param('res');
+my $conf = $query->param('conf');
+my $branch = $query->param('branch');
+my $changed_since_success = $query->param('changed_since_success');
+my $changed_this_run = $query->param('changed_files');
+my $log_archive = $query->param('logtar');
+
+my $content = 
+       "branch=$branch&res=$res&stage=$stage&animal=$animal&".
+       "ts=$ts&log=$log&conf=$conf";
+
+my $extra_content = 
+       "changed_files=$changed_this_run&".
+       "changed_since_success=$changed_since_success&";
+
+unless ($animal && $ts && $stage && $sig)
+{
+       print 
+           "Status: 490 bad parameters\nContent-Type: text/plain\n\n",
+           "bad parameters for request\n";
+       exit;
+       
+}
+
+
+my $db = DBI->connect($dsn,$dbuser,$dbpass);
+
+die $DBI::errstr unless $db;
+
+my $gethost=
+    "select secret from buildsystems where name = ? and status = 'approved'";
+my $sth = $db->prepare($gethost);
+$sth->execute($animal);
+my ($secret)=$sth->fetchrow_array();
+$sth->finish;
+
+my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($ts);
+$year += 1900; $mon +=1;
+my $date=
+    sprintf("%d-%.2d-%.2d_%.2d:%.2d:%.2d",$year,$mon,$mday,$hour,$min,$sec);
+
+if ($ENV{BF_DEBUG} || ($ts > time) || (! $secret) )
+{
+    open(TX,">../buildlogs/$animal.$date");
+    print TX "sig=$sig\nlogtar-len=" , length($log_archive),
+        "\nstatus=$res\nstage=$stage\nconf:\n$conf\n",
+       "changed_this_run:\n$changed_this_run\n",
+       "changed_since_success:\n$changed_since_success\n",
+       "log:\n",$log;
+#    $query->save(\*TX);
+    close(TX);
+}
+
+unless ($ts < time)
+{
+    my $gmt = gmtime($ts);
+    print "Status: 491 bad ts parameter - $ts ($gmt GMT) is in the future.\n",
+    "Context-Type: text/plain\n\n bad ts parameter - $ts ($gmt GMT) is in the future\n";
+       $db->disconnect;
+    exit;
+}
+
+unless ($secret)
+{
+       print 
+           "Status: 495 Unknown System\nContent-Type: text/plain\n\n",
+           "System $animal is unknown\n";
+       $db->disconnect;
+       exit;
+       
+}
+
+
+
+
+my $calc_sig = sha1_hex($content,$secret);
+my $calc_sig2 = sha1_hex($extra_content,$content,$secret);
+
+if ($calc_sig ne $sig && $calc_sig2 ne $sig)
+{
+
+       print "Status: 450 sig mismatch\nContent-Type: text/plain\n\n";
+       print "$sig mismatches $calc_sig($calc_sig2) on content:\n$content";
+       $db->disconnect;
+       exit;
+}
+
+# undo escape-proofing of base64 data and decode it
+map {tr/$@/+=/; $_ = decode_base64($_); } 
+    ($log, $conf,$changed_this_run,$changed_since_success,$log_archive);
+
+($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime($ts);
+$year += 1900; $mon +=1;
+my $dbdate=
+    sprintf("%d-%.2d-%.2d %.2d:%.2d:%.2d",$year,$mon,$mday,$hour,$min,$sec);
+
+my $log_file_names;
+my @log_file_names;
+my $dirname = "../buildlogs/tmp.$$.unpacklogs";
+
+if ($log_archive)
+{
+    my $log_handle;
+    my $archname = "../buildlogs/tmp.$$.tgz";
+    open($log_handle,">$archname");
+    binmode $log_handle;
+    print $log_handle $log_archive;
+    close $log_handle;
+    mkdir $dirname;
+    @log_file_names = `tar -z -C $dirname -xvf $archname 2>/dev/null`;
+    map {s/\s+//g; } @log_file_names;
+    my @qnames = @log_file_names;
+    map { $_ = qq("$_"); } @qnames;
+    $log_file_names = '{' . join(',',@qnames) . '}';
+    # unlink $archname;
+}
+
+my $config_flags;
+my $container = new Safe;
+my $sconf = $conf; 
+unless ($sconf =~ s/.*(\$Script_Config)/$1/ms )
+{
+    $sconf = '$Script_Config={};';
+}
+my $client_conf = $container->reval("$sconf;");
+
+my @config_flags = @{ $client_conf->{config_opts} || [] };
+if (@config_flags)
+{
+    @config_flags = grep {! m/=/ } @config_flags;
+    map {s/\s+//g; $_=qq("$_"); } @config_flags;
+    $config_flags = '{' . join(',',@config_flags) . '}' ;
+}
+
+
+my $logst = <<EOSQL;
+    insert into build_status 
+      (sysname, snapshot,status, stage, log,conf_sum, branch,
+       changed_this_run, changed_since_success, 
+       log_archive_filenames , log_archive, build_flags)
+    values(?,?,?,?,?,?,?,?,?,?,?,?)
+EOSQL
+;
+$sth=$db->prepare($logst);
+
+$sth->bind_param(1,$animal);
+$sth->bind_param(2,$dbdate);
+$sth->bind_param(3,$res);
+$sth->bind_param(4,$stage);
+$sth->bind_param(5,$log);
+$sth->bind_param(6,$conf);
+$sth->bind_param(7,$branch);
+$sth->bind_param(8,$changed_this_run);
+$sth->bind_param(9,$changed_since_success);
+$sth->bind_param(10,$log_file_names);
+$sth->bind_param(11,$log_archive,{ pg_type => DBD::Pg::PG_BYTEA });
+$sth->bind_param(12,$config_flags);
+
+$sth->execute;
+$sth->finish;
+
+my $logst2 = <<EOSQL;
+
+  insert into build_status_log 
+    (sysname, snapshot, branch, log_stage, log_text, stage_duration)
+    values (?, ?, ?, ?, ?, ?)
+
+EOSQL
+    ;
+
+$sth = $db->prepare($logst2);
+
+$/=undef;
+
+my $stage_start = $ts;
+
+foreach my $log_file( @log_file_names )
+{
+  my $handle;
+  open($handle,"$dirname/$log_file");
+  my $mtime = (stat $handle)[9];
+  my $stage_interval = $mtime - $stage_start;
+  $stage_start = $mtime;
+  my $ltext = <$handle>;
+  close($handle);
+  $sth->execute($animal,$dbdate,$branch,$log_file,$ltext, 
+               "$stage_interval seconds");
+}
+
+
+$sth->finish;
+
+my $prevst = <<EOSQL;
+
+  select coalesce((select distinct on (snapshot) stage
+                  from build_status
+                  where sysname = ? and branch = ? and snapshot < ?
+                  order by snapshot desc
+                  limit 1), 'NEW') as prev_status
+  
+EOSQL
+
+$sth=$db->prepare($prevst);
+$sth->execute($animal,$branch,$dbdate);
+my $row=$sth->fetchrow_arrayref;
+my $prev_stat=$row->[0];
+$sth->finish;
+
+my $det_st = <<EOS;
+
+          select operating_system|| ' / ' || os_version as os , 
+                 compiler || ' / ' || compiler_version as compiler, 
+                 architecture as arch
+          from buildsystems 
+          where status = 'approved'
+                and name = ?
+
+EOS
+;
+$sth=$db->prepare($det_st);
+$sth->execute($animal);
+$row=$sth->fetchrow_arrayref;
+my ($os, $compiler,$arch) = @$row;
+$sth->finish;
+
+$db->disconnect;
+
+print "Content-Type: text/plain\n\n";
+print "request was on:\n";
+print "res=$res&stage=$stage&animal=$animal&ts=$ts";
+
+my $client_events = $client_conf->{mail_events};
+
+if ($ENV{BF_DEBUG})
+{
+    open(TX,">>../buildlogs/$animal.$date");
+    print TX "\n",Dumper(\$client_conf),"\n";
+    close(TX);
+}
+
+my $bcc_stat = [];
+my $bcc_chg=[];
+if (ref $client_events)
+{
+    my $cbcc = $client_events->{all};
+    if (ref $cbcc)
+    {
+       push @$bcc_stat, @$cbcc;
+    }
+    elsif (defined $cbcc)
+    {
+       push @$bcc_stat, $cbcc;
+    }
+    if ($stage ne 'OK')
+    {
+       $cbcc = $client_events->{all};
+       if (ref $cbcc)
+       {
+           push @$bcc_stat, @$cbcc;
+       }
+       elsif (defined $cbcc)
+       {
+           push @$bcc_stat, $cbcc;
+       }
+    }
+    $cbcc = $client_events->{change};
+    if (ref $cbcc)
+    {
+       push @$bcc_chg, @$cbcc;
+    }
+    elsif (defined $cbcc)
+    {
+       push @$bcc_chg, $cbcc;
+    }
+    if ($stage eq 'OK' || $prev_stat eq 'OK')
+    {
+       $cbcc = $client_events->{green};
+       if (ref $cbcc)
+       {
+           push @$bcc_chg, @$cbcc;
+       }
+       elsif (defined $cbcc)
+       {
+           push @$bcc_chg, $cbcc;
+       }
+    }
+}
+
+
+my $url = $query->url(-base => 1);
+
+
+my $stat_type = $stage eq 'OK' ? 'Status' : 'Failed at Stage';
+
+my $mailto = [@$all_stat];
+push(@$mailto,@$fail_stat) if $stage ne 'OK';
+
+my $me = `id -un`; chomp $me;
+
+my $host = `hostname`; chomp $host;
+
+my $msg = new Mail::Send;
+
+$msg->set('From',"PG Build Farm <$me\@$host>");
+
+$msg->to(@$mailto);
+$msg->bcc(@$bcc_stat) if (@$bcc_stat);
+$msg->subject("PGBuildfarm member $animal Branch $branch $stat_type $stage");
+my $fh = $msg->open;
+print $fh <<EOMAIL; 
+
+
+The PGBuildfarm member $animal had the following event on branch $branch:
+
+$stat_type: $stage
+
+The snapshot timestamp for the build that triggered this notification is: $dbdate
+
+The specs of this machine are:
+OS:  $os
+Arch: $arch
+Comp: $compiler
+
+For more information, see $url/cgi-bin/show_history.pl?nm=$animal&br=$branch
+
+EOMAIL
+
+$fh->close;
+
+exit if ($stage eq $prev_stat);
+
+$mailto = [@$change_stat];
+push(@$mailto,@$green_stat) if ($stage eq 'OK' || $prev_stat eq 'OK');
+
+$msg = new Mail::Send;
+
+$msg->set('From',"PG Build Farm <$me\@$host>");
+
+$msg->to(@$mailto);
+$msg->bcc(@$bcc_chg) if (@$bcc_chg);
+
+$stat_type = $prev_stat ne 'OK' ? "changed from $prev_stat failure to $stage" :
+    "changed from OK to $stage";
+$stat_type = "New member: $stage" if $prev_stat eq 'NEW';
+$stat_type .= " failure" if $stage ne 'OK';
+
+$msg->subject("PGBuildfarm member $animal Branch $branch Status $stat_type");
+$fh = $msg->open;
+print $fh <<EOMAIL;
+
+The PGBuildfarm member $animal had the following event on branch $branch:
+
+Status $stat_type
+
+The snapshot timestamp for the build that triggered this notification is: $dbdate
+
+The specs of this machine are:
+OS:  $os
+Arch: $arch
+Comp: $compiler
+
+For more information, see $url/cgi-bin/show_history.pl?nm=$animal&br=$branch
+
+EOMAIL
+
+$fh->close;
diff --git a/cgi-bin/register.pl b/cgi-bin/register.pl
new file mode 100644 (file)
index 0000000..dcd3ab9
--- /dev/null
@@ -0,0 +1,154 @@
+#!/usr/bin/perl
+
+use strict;
+use DBI;
+use Template;
+use CGI;
+
+use vars qw($dbhost $dbname $dbuser $dbpass $dbport $notifyapp);
+
+require "$ENV{BFConfDir}/BuildFarmWeb.pl";
+#require "BuildFarmWeb.pl";
+
+my $dsn="dbi:Pg:dbname=$dbname";
+$dsn .= ";host=$dbhost" if $dbhost;
+$dsn .= ";port=$dbport" if $dbport;
+
+my $header = <<EOS;
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+       <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+       <title>PostgreSQL BuildFarm Application</title>
+       <link rel="icon" type="image/png" href="/elephant-icon.png" />
+       <link rel="stylesheet" rev="stylesheet" href="/inc/pgbf.css" charset="utf-8" />
+       <style type="text/css"><!--
+       li#register a { color:rgb(17,45,137); background: url(/inc/b/r.png) no-repeat 100% -20px; } 
+       li#register { background: url(/inc/b/l.png) no-repeat 0% -20px; }
+       --></style>
+</head>
+<body class="application">
+<div id="wrapper">
+<div id="banner">
+<a href="/index.html"><img src="/inc/pgbuildfarm-banner.png" alt="PostgreSQL BuildFarm" width="800" height="73" /></a>
+<div id="nav">
+<ul>
+    <li id="home"><a href="/index.html" title="PostgreSQL BuildFarm Home">Home</a></li>
+    <li id="status"><a href="/cgi-bin/show_status.pl" title="Current results">Status</a></li>
+    <li id="members"><a href="/cgi-bin/show_members.pl" title="Platforms tested">Members</a></li>
+    <li id="register"><a href="/register.html" title="Join PostgreSQL BuildFarm">Register</a></li>
+    <li id="pgfoundry"><a href="http://pgfoundry.org/projects/pgbuildfarm/">PGFoundry</a></li>
+    <li id="postgresql.org"><a href="http://www.postgresql.org">PostgreSQL.org</a></li>
+</ul>
+</div><!-- nav -->
+</div><!-- banner -->
+<div id="main">
+EOS
+
+my $footer = <<EOS;
+</div><!-- main -->
+<hr />
+<p style="text-align: center;">
+Hosting for the PostgreSQL Buildfarm is generously 
+provided by: 
+<a href="http://www.commandprompt.com">CommandPrompt, 
+The PostgreSQL Company</a>
+</p>
+</div><!-- wrapper -->
+</body>
+</html>
+EOS
+
+my $query = new CGI;
+
+my $params = $query->Vars;
+
+my ($os, $osv, $comp, $compv, $arch, $email, $owner) = @{$params}{
+       qw(os osv comp compv arch email owner)};
+
+unless ($os && $osv && $comp && $compv && $arch && $email && $owner)
+{
+       print "Content-Type: text/html\n\n",
+       $header,
+       "<p>You need to complete all the form items. <a href=\"/register.html\">Please try again.</a></p>\n",
+       $footer;
+       exit;
+}
+
+# some idiot has a script that tries to talk to me
+# this should catch and dispose of him
+if (grep {/\@pgbuildfarm\.org|Content-Type:/} $os,$osv,$comp,$compv,$arch,$email,$owner)
+{
+    print 
+       "Status: 403 Forbidden - go away idiot\n",
+       "Content-Type: text/plain\n\n";
+    exit;
+    
+}
+
+my $secret = "";
+my $dummyname=""; # we'll select an animal name when we approve it.
+foreach (1..8)
+{
+       # 8 random chars is enough for the dummy name
+       $secret .= substr("0123456789abcdefghijklmnopqrstuvwxyz",int(rand(36)),1);
+       $dummyname .= substr("0123456789abcdef",int(rand(16)),1);
+}
+foreach (9..32)
+{
+       $secret .= substr("0123456789abcdef",int(rand(16)),1);
+}
+
+my $db = DBI->connect($dsn,$dbuser,$dbpass);
+
+my $statement = <<EOS;
+
+  insert into buildsystems 
+    (name, secret, operating_system, os_version, compiler, compiler_version,
+     architecture, status, sys_owner, owner_email)
+  values(?,?,?,?,?,?,?,'pending',?,?)
+
+EOS
+;
+
+my $sth=$db->prepare($statement);
+my $rv=$sth->execute($dummyname,$secret,$os,$osv,$comp,$compv,
+                         $arch,$owner,$email);
+my $err=$db->errstr;
+print "Content-type: text/html\n\n";
+print $header
+    , "<h1>PostgreSQL BuildFarm Application received</h1>\n"
+    , "<p>Thank you. You should hear from us shortly.</p>"
+    , $footer;
+
+
+$sth->finish;
+$db->disconnect;
+
+
+use Mail::Send;
+
+my $msg = new Mail::Send;
+
+my $me = `id -un`;
+
+my $host = `hostname`;
+
+$msg->set('From',"PG Build Farm <$me\@$host>");
+
+$msg->to(@$notifyapp);
+$msg->subject('New Buildfarm Application');
+my $fh = $msg->open;
+print $fh "\n\nName: $dummyname\n",
+    "OS: $os: $osv\n",
+    "Arch: $arch\n",
+    "Comp: $comp: $compv\n",
+    "Owner: $owner <$email>\n";
+$fh->close;
+
+
+
+
+
+
diff --git a/cgi-bin/show_history.pl b/cgi-bin/show_history.pl
new file mode 100644 (file)
index 0000000..98a8860
--- /dev/null
@@ -0,0 +1,156 @@
+#!/usr/bin/perl
+
+use strict;
+use DBI;
+use Template;
+use CGI;
+
+use vars qw($dbhost $dbname $dbuser $dbpass $dbport);
+
+
+require "$ENV{BFConfDir}/BuildFarmWeb.pl";
+#require "BuildFarmWeb.pl";
+
+die "no dbname" unless $dbname;
+die "no dbuser" unless $dbuser;
+
+my $dsn="dbi:Pg:dbname=$dbname";
+$dsn .= ";host=$dbhost" if $dbhost;
+$dsn .= ";port=$dbport" if $dbport;
+
+my $db = DBI->connect($dsn,$dbuser,$dbpass);
+
+die $DBI::errstr unless $db;
+
+my $query = new CGI;
+my $member = $query->param('nm'); $member =~ s/[^a-zA-Z0-9_ -]//g;
+my $branch = $query->param('br'); $branch =~ s/[^a-zA-Z0-9_ -]//g;
+my $hm = $query->param('hm');  $hm =~ s/[^a-zA-Z0-9_ -]//g;
+$hm = '240' unless $hm =~ /^\d+$/;
+
+# we don't really need to do this join, since we only want
+# one row from buildsystems. but it means we only have to run one
+# query. If it gets heavy we'll split it up and run two
+
+my $statement = <<EOS;
+
+  select (now() at time zone 'GMT')::timestamp(0) - snapshot as when_ago,
+      sysname, snapshot, b.status, stage,
+      operating_system, os_version, compiler, compiler_version, architecture,
+      owner_email
+  from buildsystems s, 
+       build_status b 
+  where name = ?
+        and branch = ?
+        and s.status = 'approved'
+        and name = sysname
+  order by snapshot desc
+  limit $hm
+
+EOS
+;
+
+my $statrows=[];
+my $sth=$db->prepare($statement);
+$sth->execute($member,$branch);
+while (my $row = $sth->fetchrow_hashref)
+{
+    $row->{owner_email} =~ s/\@/ [ a t ] /;
+       push(@$statrows,$row);
+}
+$sth->finish;
+
+$db->disconnect;
+
+my $template = new Template({EVAL_PERL => 1});
+
+print "Content-Type: text/html\n\n";
+
+$template->process(\*DATA,
+                  {statrows=>$statrows, 
+                   branch=>$branch, 
+                   member => $member,
+                   hm => $hm
+                   });
+
+exit;
+
+__DATA__
+[%- BLOCK cl %] class="[% SWITCH bgfor -%]
+  [%- CASE 'OK' %]pass[% CASE 'ContribCheck' %]warn[% CASE [ 'Check' 'InstallCheck' ] %]warnx[% CASE %]fail[% END %]"
+[%- END -%]
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+       <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+    <title>PostgreSQL BuildFarm History</title>
+       <link rel="icon" type="image/png" href="/elephant-icon.png" />
+    <link rel="stylesheet" rev="stylesheet" href="/inc/pgbf.css" charset="utf-8" />
+       <style type="text/css"><!--
+       li#status a { color:rgb(17,45,137); background: url(/inc/b/r.png) no-repeat 100% -20px; } 
+       li#status { background: url(/inc/b/l.png) no-repeat 0% -20px; }
+       --></style>
+</head>
+<body class="history">
+<div id="wrapper">
+<div id="banner">
+<a href="/index.html"><img src="/inc/pgbuildfarm-banner.png" alt="PostgreSQL BuildFarm" width="800" height="73" /></a>
+<div id="nav">
+<ul>
+    <li id="home"><a href="/index.html" title="PostgreSQL BuildFarm Home">Home</a></li>
+    <li id="status"><a href="/cgi-bin/show_status.pl" title="Current results">Status</a></li>
+    <li id="members"><a href="/cgi-bin/show_members.pl" title="Platforms tested">Members</a></li>
+    <li id="register"><a href="/register.html" title="Join PostgreSQL BuildFarm">Register</a></li>
+    <li id="pgfoundry"><a href="http://pgfoundry.org/projects/pgbuildfarm/">PGFoundry</a></li>
+</ul>
+</div><!-- nav -->
+</div><!-- banner -->
+<div id="main">
+<h1>PostgreSQL BuildFarm Status History</h1>
+<table cellspacing="0">
+    <tr><th class="head" colspan="3">System Detail</th></tr>
+    <tr class="member"><th>Farm member</th><td>[% member %]</td></tr>
+    <tr><th>OS</th><td>[% statrows.0.operating_system %] [% statrows.0.os_version %]</td></tr>
+<!--    <tr><th>OS Version</th><td>[% statrows.0.os_version %]</td></tr> -->
+    <tr><th>Compiler</th><td>[% statrows.0.compiler %] [% statrows.0.compiler_version %]</td></tr>
+<!--    <tr><th>Compiler Version</th><td>[% statrows.0.compiler_version %]</td></tr> -->
+    <tr><th>Architecture</th><td>[% statrows.0.architecture %]</td></tr>
+    <tr><th>Owner</th><td>[% statrows.0.owner_email %]</td></tr>
+    </table>
+    <h3>Branch: [% branch %][% IF statrows.size >= hm %] (last [% hm %] entries shown)[% END %]</h3>
+[% BLOCK stdet %]
+<tr [% PROCESS cl bgfor=row.stage %]>
+    <td>[%- row.when_ago | replace('\s','&nbsp;') %]&nbsp;ago&nbsp;</td>
+    <td class="status">[% row.stage -%]</td>
+    <td class="status"><a href="show_log.pl?nm=
+               [%- row.sysname %]&amp;dt=
+               [%- row.snapshot | uri %]">
+                [%- IF row.stage != 'OK' %]Details[% ELSE %]Config[% END -%]</a></td>
+
+</tr>
+[% END %]
+<table border="0"> <tr>
+[% FOREACH offset IN [0,1,2] %][% low = offset * statrows.size / 3 ; high = -1 + (offset + 1) * statrows.size / 3 %] 
+[% TRY %][% PERL %] 
+  use POSIX qw(floor); 
+  $stash->set(low => floor($stash->get('low'))); 
+  $stash->set(high => floor($stash->get('high'))); 
+[% END %][% CATCH %]<!-- [% error.info %] --> [% END %]
+    <td><table cellspacing="0">
+<!--      <tr><th colspan=3>low = [% low %], high = [% high %]</th></tr> -->
+        [% FOREACH xrow IN statrows.slice(low,high) %][% PROCESS stdet row=xrow %][% END %]
+    </table></td>
+[% END %]
+</table>
+    </div><!-- main -->
+<hr />
+<p style="text-align: center;">
+Hosting for the PostgreSQL Buildfarm is generously 
+provided by: 
+<a href="http://www.commandprompt.com">CommandPrompt, 
+The PostgreSQL Company</a>
+</p>
+    </div><!-- wrapper -->
+  </body>
+</html>
diff --git a/cgi-bin/show_history2.pl b/cgi-bin/show_history2.pl
new file mode 100644 (file)
index 0000000..2bf7f13
--- /dev/null
@@ -0,0 +1,69 @@
+#!/usr/bin/perl
+
+use strict;
+use DBI;
+use Template;
+use CGI;
+
+use vars qw($dbhost $dbname $dbuser $dbpass $dbport);
+
+
+require "$ENV{BFConfDir}/BuildFarmWeb.pl";
+#require "BuildFarmWeb.pl";
+
+die "no dbname" unless $dbname;
+die "no dbuser" unless $dbuser;
+
+my $dsn="dbi:Pg:dbname=$dbname";
+$dsn .= ";host=$dbhost" if $dbhost;
+$dsn .= ";port=$dbport" if $dbport;
+
+my $db = DBI->connect($dsn,$dbuser,$dbpass);
+
+die $DBI::errstr unless $db;
+
+my $query = new CGI;
+my $member = $query->param('nm');
+my $branch = $query->param('br');
+
+# we don't really need to do this join, since we only want
+# one row from buildsystems. but it means we only have to run one
+# query. If it gets heavy we'll split it up and run two
+
+my $statement = <<EOS;
+
+  select (now() at time zone 'GMT')::timestamp(0) - snapshot as when_ago,
+      sysname, snapshot, b.status, stage,
+      operating_system, os_version, compiler, compiler_version, architecture 
+  from buildsystems s, 
+       build_status b 
+  where name = ?
+        and branch = ?
+        and s.status = 'approved'
+        and name = sysname
+  order by snapshot desc
+  limit 240
+
+EOS
+;
+
+my $statrows=[];
+my $sth=$db->prepare($statement);
+$sth->execute($member,$branch);
+while (my $row = $sth->fetchrow_hashref)
+{
+       push(@$statrows,$row);
+}
+$sth->finish;
+
+$db->disconnect;
+
+my $template = new Template({EVAL_PERL => 1, 
+                            INCLUDE_PATH => "/home/community/pgbuildfarm/templates",
+                               });
+
+print "Content-Type: text/html\n\n";
+
+$template->process("dyn/history.tt",
+       {statrows=>$statrows, branch=>$branch, member => $member});
+
diff --git a/cgi-bin/show_log.pl b/cgi-bin/show_log.pl
new file mode 100644 (file)
index 0000000..929af0d
--- /dev/null
@@ -0,0 +1,327 @@
+#!/usr/bin/perl
+
+use strict;
+use DBI;
+use Template;
+use CGI;
+use URI::Escape;
+
+use vars qw($dbhost $dbname $dbuser $dbpass $dbport @log_file_names);
+
+
+require "$ENV{BFConfDir}/BuildFarmWeb.pl";
+#require "BuildFarmWeb.pl";
+
+die "no dbname" unless $dbname;
+die "no dbuser" unless $dbuser;
+
+my $dsn="dbi:Pg:dbname=$dbname";
+$dsn .= ";host=$dbhost" if $dbhost;
+$dsn .= ";port=$dbport" if $dbport;
+
+my $query = new CGI;
+
+my $system = $query->param('nm'); $system =~ s/[^a-zA-Z0-9_ -]//g;
+my $logdate = $query->param('dt'); $logdate =~ s/[^a-zA-Z0-9_ -]//g;
+
+my $log = "";
+my $conf = "";
+my ($stage,$changed_this_run,$changed_since_success,$sysinfo,$branch);
+
+use vars qw($info_row);
+
+if ($system && $logdate)
+{
+
+       my $db = DBI->connect($dsn,$dbuser,$dbpass);
+
+       die $DBI::errstr unless $db;
+
+       my $statement = <<EOS;
+
+  select log,conf_sum,stage, changed_this_run, changed_since_success,branch,
+      log_archive_filenames
+  from build_status
+  where sysname = ? and snapshot = ?
+
+EOS
+;
+       my $sth=$db->prepare($statement);
+       $sth->execute($system,$logdate);
+       my $row=$sth->fetchrow_arrayref;
+       $log=$row->[0];
+       $conf=$row->[1] || "not recorded" ;
+       $stage=$row->[2] || "unknown";
+       $changed_this_run = $row->[3];
+       $changed_since_success = $row->[4];
+       $branch = $row->[5];
+       my $log_file_names = $row->[6];
+       $log_file_names =~ s/^\{(.*)\}$/$1/;
+       @log_file_names=split(',',$log_file_names)
+           if $log_file_names;
+       $sth->finish;
+
+       $statement = <<EOS;
+
+          select operating_system, os_version, 
+                 compiler, compiler_version, 
+                 architecture,
+               replace(owner_email,'\@',' [ a t ] ') as owner_email
+          from buildsystems 
+          where status = 'approved'
+                and name = ?
+
+EOS
+;
+       $sth=$db->prepare($statement);
+       $sth->execute($system);
+       $info_row=$sth->fetchrow_hashref;
+        $sysinfo = join(" ",@$row);
+       $sth->finish;
+       $db->disconnect;
+}
+
+foreach my $chgd ($changed_this_run,$changed_since_success)
+{
+    my @lines = split(/!/,$chgd);
+    foreach (@lines)
+    {
+       next unless m!^pgsql/!;
+       s!(^\S+)(\s+)(\S+)!<a href="http://developer.postgresql.org/cvsweb.cgi/$1?rev=$3">$1$2$3</a>!;
+    }
+    $chgd = join("\n",@lines);
+    $chgd ||= 'not recorded';
+       
+}
+
+$conf =~ s/\@/ [ a t ] /g;
+map {s/&/&amp;/g; s/</&lt;/g; s/>/&gt;/g; s/\"/&quot;/g;} ($log,$conf);
+# map {s/!/\n/g} ($changed_this_run,$changed_since_success);
+
+
+use POSIX qw(ceil);
+my $lrfactor = 7;
+my $logrows = ceil(scalar(@log_file_names)/$lrfactor);
+my $logcells = $lrfactor * $logrows;
+
+my $heading_done;
+my $urldt = uri_escape($logdate);
+
+my $cell = 0;
+
+
+
+print "Content-Type: text/html\n\n";
+
+if ($stage eq 'OK')
+{
+       print <<EOHTML;
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+       <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+    <title>PostgreSQL BuildFarm | Configuration summary for system "$system"</title>
+       <link rel="icon" type="image/png" href="/elephant-icon.png" />
+    <link rel="stylesheet" rev="stylesheet" href="/inc/pgbf.css" charset="utf-8" />
+</head>
+<body>
+<div id="wrapper">
+<div id="banner">
+<a href="/index.html"><img src="/inc/pgbuildfarm-banner.png" alt="PostgreSQL BuildFarm" width="800" height="73" /></a>
+<div id="nav">
+<ul>
+    <li id="home"><a href="/index.html" title="PostgreSQL BuildFarm Home">Home</a></li>
+    <li id="status"><a href="/cgi-bin/show_status.pl" title="Current results">Status</a></li>
+    <li id="members"><a href="/cgi-bin/show_members.pl" title="Platforms tested">Members</a></li>
+    <li id="register"><a href="/register.html" title="Join PostgreSQL BuildFarm">Register</a></li>
+    <li id="pgfoundry"><a href="http://pgfoundry.org/projects/pgbuildfarm/">PGFoundry</a></li>
+</ul>
+</div><!-- nav -->
+</div><!-- banner -->
+<div id="main">
+<h1>PostgreSQL Build Farm Log</h1>
+<table align="top" cellspacing="0">
+    <tr>
+        <th class="head" rowspan="2">System Information</th>
+        <th>Farm member</th>
+        <th>Branch</th>
+        <th>OS</th>
+        <th>Compiler</th>
+        <th>Architecture</th>
+        <th>Owner</th>
+    </tr>
+    <tr>
+        <td>$system</td>
+        <td><a href="/cgi-bin/show_history.pl?nm=$system&amp;br=$branch">$branch</a></td>
+        <td>$info_row->{operating_system} $info_row->{os_version}</td>
+        <td>$info_row->{compiler} $info_row->{compiler_version}</td>
+        <td>$info_row->{architecture}</td>
+        <td>$info_row->{owner_email}</td>
+    </tr>
+    </table>
+EOHTML
+
+for my $logstage (@log_file_names)
+{
+    print "<br /> <table><tr><th class='head' rowspan='4'>Stage Logs</th>\n"
+       unless $heading_done;
+    $heading_done = 1;
+    $cell++;
+    $logstage =~ s/\.log$//;
+    print "<tr>\n" if ($cell > 1 && $cell % $lrfactor == 1);
+    print "<td><a href='show_stage_log.pl?nm=$system&amp;dt=$urldt&amp;stg=$logstage'>$logstage</a></td>\n";
+    print "</tr>\n" if ($cell % $lrfactor == 0);
+}
+
+if ($cell)
+{
+    foreach my $rcell ($cell+1 .. $logcells)
+    {
+       print "<tr>\n" if ($rcell > 1 && $rcell % $lrfactor == 1);
+       print "<td>&nbsp;</td>\n";
+       print "</tr>\n" if ($rcell % $lrfactor == 0);
+    }
+    print "</table>\n";
+}
+
+print <<EOHTML;
+</table>
+<h2>Configuration summary for system "$system"</h2>
+<h3>Status 'OK' on snapshot taken $logdate</h3>
+<pre>
+$conf
+</pre>
+<h3>Files changed this run</h3>
+<pre>
+$changed_this_run
+</pre>
+EOHTML
+print <<EOHTML if ($log);
+<h3>Log</h3>
+<pre>
+$log
+</pre>
+EOHTML
+    print <<EOHTML;
+</div><!-- main -->
+<hr />
+<p style="text-align: center;">
+Hosting for the PostgreSQL Buildfarm is generously 
+provided by: 
+<a href="http://www.commandprompt.com">CommandPrompt, 
+The PostgreSQL Company</a>
+</p>
+</div><!-- wrapper -->
+</body>
+</html>
+EOHTML
+;
+
+       exit;
+}
+
+print <<EOHTML;
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+       <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+    <title>PostgreSQL BuildFarm | Log for system "$system" failure on snapshot taken $logdate</title>
+    <link rel="stylesheet" rev="stylesheet" href="/inc/pgbf.css" charset="utf-8" />
+</head>
+<body>
+<div id="wrapper">
+<div id="banner">
+<a href="/index.html"><img src="/inc/pgbuildfarm-banner.png" alt="PostgreSQL BuildFarm" width="800" height="73" /></a>
+<div id="nav">
+<ul>
+    <li id="home"><a href="/index.html" title="PostgreSQL BuildFarm Home">Home</a></li>
+    <li id="status"><a href="/cgi-bin/show_status.pl" title="Status Page">Status</a></li>
+    <li id="members"><a href="/cgi-bin/show_members.pl" title="Status Page">Members</a></li>
+    <li id="register"><a href="/register.html" title="Register">Register</a></li>
+    <li id="pgfoundry"><a href="http://pgfoundry.org/projects/pgbuildfarm/">PGFoundry</a></li>
+</ul>
+</div><!-- nav -->
+</div><!-- banner -->
+<div id="main">
+    <h1>PostgreSQL Build Farm Log</h1>
+<h1>Details for system "$system" failure at stage $stage on snapshot taken $logdate</h1>
+<table cellspacing="0">
+    <tr>
+        <th class="head" rowspan="2">System Information</th>
+        <th>Farm member</th>
+        <th>Branch</th>
+        <th>OS</th>
+        <th>Compiler</th>
+        <th>Architecture</th>
+        <th>Owner</th>
+    </tr>
+    <tr>
+        <td>$system</td>
+        <td><a href="/cgi-bin/show_history.pl?nm=$system&amp;br=$branch">$branch</a></td>
+        <td>$info_row->{operating_system} $info_row->{os_version}</td>
+        <td>$info_row->{compiler} $info_row->{compiler_version}</td>
+        <td>$info_row->{architecture}</td>
+        <td>$info_row->{owner_email}</td>
+    </tr>
+    </table>
+EOHTML
+
+for my $logstage (@log_file_names)
+{
+    print "<br /> <table><tr><th class='head' rowspan='4'>Stage Logs</th>\n"
+       unless $heading_done;
+    $heading_done = 1;
+    $cell++;
+    $logstage =~ s/\.log$//;
+    print "<tr>\n" if ($cell > 1 && $cell % $lrfactor == 1);
+    print "<td><a href='show_stage_log.pl?nm=$system&amp;dt=$urldt&amp;stg=$logstage'>$logstage</a></td>\n";
+    print "</tr>\n" if ($cell % $lrfactor == 0);
+}
+
+if ($cell)
+{
+    foreach my $rcell ($cell+1 .. $logcells)
+    {
+       print "<tr>\n" if ($rcell > 1 && $rcell % $lrfactor == 1);
+       print "<td>&nbsp;</td>\n";
+       print "</tr>\n" if ($rcell % $lrfactor == 0);
+    }
+    print "</table>\n";
+}
+
+print <<EOHTML;
+<h3>Configuration summary</h3>
+<pre>
+$conf
+</pre>
+<h3>Files changed this run</h3>
+<pre>
+$changed_this_run
+</pre>
+<h3>Files changed since last success</h3>
+<pre>
+$changed_since_success
+</pre>
+<h3>Log</h3>
+<pre>
+$log
+</pre>
+</div><!-- main -->
+<hr />
+<p style="text-align: center;">
+Hosting for the PostgreSQL Buildfarm is generously 
+provided by: 
+<a href="http://www.commandprompt.com">CommandPrompt, 
+The PostgreSQL Company</a>
+</p>
+</div><!-- wrapper -->
+</body>
+</html>
+EOHTML
+;
+
+
+
+
diff --git a/cgi-bin/show_members.pl b/cgi-bin/show_members.pl
new file mode 100644 (file)
index 0000000..9846a6e
--- /dev/null
@@ -0,0 +1,163 @@
+#!/usr/bin/perl
+
+use strict;
+use CGI;
+use DBI;
+use Template;
+
+
+
+use vars qw($dbhost $dbname $dbuser $dbpass $dbport $sort_by);
+
+
+require "$ENV{BFConfDir}/BuildFarmWeb.pl";
+#require "BuildFarmWeb.pl";
+
+my $query = new CGI;
+my %sort_ok = ('name' => 'name' , 
+              'owner' => 'lower(owner_email)', 
+              'os' => 'lower(operating_system), os_version', 
+              'compiler' => 'lower(compiler), compiler_version' ,
+              'arch' => 'lower(architecture)' );
+$sort_by = $query->param('sort_by');$sort_by =~ s/[^a-zA-Z0-9_ -]//g;
+$sort_by = $sort_ok{$sort_by} || 'name';
+
+my $dsn="dbi:Pg:dbname=$dbname";
+$dsn .= ";host=$dbhost" if $dbhost;
+$dsn .= ";port=$dbport" if $dbport;
+
+my $db = DBI->connect($dsn,$dbuser,$dbpass);
+
+# there is possibly some redundancy in this query, but it makes
+# a lot of the processing simpler.
+
+my $statement = <<EOS;
+
+  select name, operating_system, os_version, compiler, compiler_version, owner_email, 
+    architecture as arch, ARRAY(
+                               select distinct on (branch <> 'HEAD', branch) 
+                                      branch || ':' || 
+                                      extract(days from now() - snapshot)
+                               from build_status 
+                               where name = sysname
+                               order by branch <> 'HEAD', branch desc, 
+                                        snapshot desc
+                               ) as branches 
+  from buildsystems 
+  where status = 'approved'
+  order by $sort_by
+
+EOS
+;
+
+my $statrows=[];
+my $sth=$db->prepare($statement);
+$sth->execute;
+while (my $row = $sth->fetchrow_hashref)
+{
+    $row->{branches} =~ s/^\{(.*)\}$/$1/;
+    $row->{owner_email} =~ s/\@/ [ a t ] /;
+    push(@$statrows,$row);
+}
+$sth->finish;
+
+
+$db->disconnect;
+
+# use Data::Dumper; print "Content-Type: text/plain\n\n",Dumper($statrows),"VERSION: ",$DBD::Pg::VERSION,"\n"; exit;
+
+
+my $template = new Template({});
+
+print "Content-Type: text/html\n\n";
+
+$template->process(\*DATA,{statrows=>$statrows});
+
+exit;
+
+
+__DATA__
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+       <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+       <title>PostgreSQL BuildFarm Members</title>
+       <link rel="icon" type="image/png" href="/elephant-icon.png" />
+       <link rel="stylesheet" rev="stylesheet" href="/inc/pgbf.css" charset="utf-8" />
+       <style type="text/css"><!--
+       li#members a { color:rgb(17,45,137); background: url(/inc/b/r.png) no-repeat 100% -20px; } 
+       li#members { background: url(/inc/b/l.png) no-repeat 0% -20px; }
+       --></style>
+   </style>
+</head>
+<body class="members">
+<div id="wrapper">
+<div id="banner">
+<a href="/index.html"><img src="/inc/pgbuildfarm-banner.png" alt="PostgreSQL BuildFarm" width="800" height="73" /></a>
+<div id="nav">
+<ul>
+    <li id="home"><a href="/index.html" title="PostgreSQL BuildFarm Home">Home</a></li>
+    <li id="status"><a href="/cgi-bin/show_status.pl" title="Current results">Status</a></li>
+    <li id="members"><a href="/cgi-bin/show_members.pl" title="Platforms tested">Members</a></li>
+    <li id="register"><a href="/register.html" title="Join PostgreSQL BuildFarm">Register</a></li>
+    <li id="pgfoundry"><a href="http://pgfoundry.org/projects/pgbuildfarm/">PGFoundry</a></li>
+</ul>
+</div><!-- nav -->
+</div><!-- banner -->
+<div id="main">
+<h1>PostgreSQL BuildFarm Members</h1>
+    <p>Click branch links to see build history. Click the heading links to resort the list. Select members by checkbox and hit the button at the bottom to create a status custom filter.</p>
+    <form name="filter" method="GET" action="/cgi-bin/show_status.pl">
+    <table cellspacing="0">
+    <tr>
+    <td>&nbsp;</td>
+    <th><a href="/cgi-bin/show_members.pl?sort_by=name">Name</a><br /><a href="/cgi-bin/show_members.pl?sort_by=owner">Owner</a></th>
+    <th><a href="/cgi-bin/show_members.pl?sort_by=os">OS / Version</a></th>
+    <th><a href="/cgi-bin/show_members.pl?sort_by=compiler">Compiler / Version</a></th>
+    <th><a href="/cgi-bin/show_members.pl?sort_by=arch">Arch</a></th>
+    <th>Branches reported on<br />(most recent report)</th>
+    </tr>
+[% alt = true %]
+[% FOREACH row IN statrows %]    <tr [%- IF alt %]class="alt"[% END -%]>
+    [% alt = ! alt %]
+    <td><input type="checkbox" name="member" value="[% row.name %]" /></td>
+    <td>[% row.name %]<br />[% row.owner_email %]</td>
+    <td>[% row.operating_system %]<br />[% row.os_version %]</td>
+    <td>[% row.compiler %]<br />[% row.compiler_version %]</td>
+    <td>[% row.arch %]</td>
+    <td class="branch">[% IF ! row.branches ; '&nbsp;' ; END -%]
+    <ul>
+    [%- 
+       FOREACH branch_days IN row.branches.split(',') ;
+       branch_fields = branch_days.split(':');
+       branch = branch_fields.0;
+       branch_day = branch_fields.1;
+    %]<li><a 
+    href="show_history.pl?nm=[% row.name %]&amp;br=[% branch %]"
+    title="History"
+    >[% branch %]</a>&nbsp;([% branch_day %]&nbsp;days&nbsp;ago)</li>[% END %]</ul></td>
+    </tr>
+[% END %]
+    </table>
+    <input type="submit" value="Make Filter" />
+    </form>
+    </div><!-- main -->
+<hr />
+<p style="text-align: center;">
+Hosting for the PostgreSQL Buildfarm is generously 
+provided by: 
+<a href="http://www.commandprompt.com">CommandPrompt, 
+The PostgreSQL Company</a>
+</p>
+    </div><!-- wrapper -->
+  </body>
+</html>
+
+
+
+
+
+
+
+
diff --git a/cgi-bin/show_stage_log.pl b/cgi-bin/show_stage_log.pl
new file mode 100644 (file)
index 0000000..52c1a37
--- /dev/null
@@ -0,0 +1,95 @@
+#!/usr/bin/perl
+
+use strict;
+use DBI;
+use Template;
+use CGI;
+use File::Temp qw(tempfile);
+
+use vars qw($dbhost $dbname $dbuser $dbpass $dbport @log_file_names);
+
+
+require "$ENV{BFConfDir}/BuildFarmWeb.pl";
+#require "BuildFarmWeb.pl";
+
+die "no dbname" unless $dbname;
+die "no dbuser" unless $dbuser;
+
+my $dsn="dbi:Pg:dbname=$dbname";
+$dsn .= ";host=$dbhost" if $dbhost;
+$dsn .= ";port=$dbport" if $dbport;
+
+my $query = new CGI;
+
+my $system = $query->param('nm'); $system =~ s/[^a-zA-Z0-9_ -]//g;
+my $logdate = $query->param('dt');$logdate =~ s/[^a-zA-Z0-9_ -]//g;
+my $stage = $query->param('stg');$stage =~ s/[^a-zA-Z0-9_ -]//g;
+
+use vars qw($tgz);
+
+if ($system && $logdate)
+{
+
+    my $db = DBI->connect($dsn,$dbuser,$dbpass);
+
+    die $DBI::errstr unless $db;
+
+    my $statement = q(
+
+               select log_archive
+               from build_status
+               where sysname = ? and snapshot = ?
+
+               );
+
+
+    
+    my $sth=$db->prepare($statement);
+    $sth->execute($system,$logdate);
+    my $row=$sth->fetchrow_arrayref;
+    $tgz=$row->[0];
+    $sth->finish;
+    $db->disconnect;
+
+}
+
+unless ($stage)
+{
+
+    print 
+       "Content-Type: application/x-gzip\n", 
+       "Content-Disposition: attachment; filename=buildfarmlog.tgz\n",
+       "\n",
+       $tgz;
+    exit;
+}
+
+my $template = "buildlogXXXXXX";
+my ($fh, $filename) = tempfile($template, UNLINK => 1);
+print $fh $tgz;
+close($fh);
+
+my $output = `tar -z -O -xf $filename $stage.log 2>&1`;
+
+print "Content-Type: text/plain\n\n", $output,
+
+    "-------------------------------------------------\n\n",
+    "Hosting for the PostgreSQL Buildfarm is generously ",
+    "provided by: CommandPrompt, The PostgreSQL Company";
+
+; exit;
+
+# using <pre> like this on huge files can make browsers choke
+
+print "Content-Type: text/html\n\n";
+
+print <<EOHTML;
+<html>
+<body>
+<pre>
+$output
+</pre>
+</body>
+</html>
+
+EOHTML
diff --git a/cgi-bin/show_stage_log2.pl b/cgi-bin/show_stage_log2.pl
new file mode 100644 (file)
index 0000000..c3ef407
--- /dev/null
@@ -0,0 +1,114 @@
+#!/usr/bin/perl
+
+use strict;
+use DBI;
+use Template;
+use CGI;
+use File::Temp qw(tempfile);
+
+use vars qw($dbhost $dbname $dbuser $dbpass $dbport @log_file_names);
+
+
+require "$ENV{BFConfDir}/BuildFarmWeb.pl";
+#require "BuildFarmWeb.pl";
+
+die "no dbname" unless $dbname;
+die "no dbuser" unless $dbuser;
+
+my $dsn="dbi:Pg:dbname=$dbname";
+$dsn .= ";host=$dbhost" if $dbhost;
+$dsn .= ";port=$dbport" if $dbport;
+
+my $query = new CGI;
+
+my $system = $query->param('nm');
+my $logdate = $query->param('dt');
+my $stage = $query->param('stg');
+
+use vars qw($tgz $output);
+
+if ($stage && $system && $logdate)
+{
+    
+}
+
+if ($system && $logdate)
+{
+
+    my $db = DBI->connect($dsn,$dbuser,$dbpass);
+
+    die $DBI::errstr unless $db;
+
+    if ($stage)
+    {
+       my $lst = q(
+                   select log_text
+                   from build_status_log
+                   where sysname = ?
+                      and snapshot = ?
+                      and log_file_name = ?
+                   );
+       
+    }
+
+    my $statement = q(
+
+               select log_archive
+               from build_status
+               where sysname = ? and snapshot = ?
+
+               );
+
+
+    
+    my $sth=$db->prepare($statement);
+    $sth->execute($system,$logdate);
+    my $row=$sth->fetchrow_arrayref;
+    $tgz=$row->[0];
+    $sth->finish;
+    $db->disconnect;
+    $output = `tar -z -O -xf $filename $stage.log 2>&1`
+       if $stage;;
+
+
+
+}
+
+unless ($stage)
+{
+
+    print 
+       "Content-Type: application/x-gzip\n", 
+       "Content-Disposition: attachment; filename=buildfarmlog.tgz\n",
+       "\n",
+       $tgz;
+    exit;
+}
+
+my $template = "buildlogXXXXXX";
+my ($fh, $filename) = tempfile($template, UNLINK => 1);
+print $fh $tgz;
+close($fh);
+
+print "Content-Type: text/plain\n\n", $output,
+
+    "-------------------------------------------------\n\n",
+    "Hosting for the PostgreSQL Buildfarm is generously ",
+    "provided by: CommandPrompt, The PostgreSQL Company";
+
+; exit;
+
+# using <pre> like this on huge files can make browsers choke
+
+print "Content-Type: text/html\n\n";
+
+print <<EOHTML;
+<html>
+<body>
+<pre>
+$output
+</pre>
+</body>
+</html>
+
+EOHTML
diff --git a/cgi-bin/show_status.pl b/cgi-bin/show_status.pl
new file mode 100644 (file)
index 0000000..1e6ea32
--- /dev/null
@@ -0,0 +1,231 @@
+#!/usr/bin/perl
+
+use strict;
+use DBI;
+use Template;
+use CGI;
+
+use vars qw($dbhost $dbname $dbuser $dbpass $dbport);
+
+
+require "$ENV{BFConfDir}/BuildFarmWeb.pl";
+
+my $query = new CGI;
+my @members = $query->param('member');
+map { s/[^a-zA-Z0-9_ -]//g; } @members;
+
+my $dsn="dbi:Pg:dbname=$dbname";
+$dsn .= ";host=$dbhost" if $dbhost;
+$dsn .= ";port=$dbport" if $dbport;
+
+my $db = DBI->connect($dsn,$dbuser,$dbpass) or die("$dsn,$dbuser,$dbpass,$!");
+
+# there is possibly some redundancy in this query, but it makes
+# a lot of the processing simpler.
+
+my $statement = <<EOS;
+
+  select (now() at time zone 'GMT')::timestamp(0) - snapshot as when_ago,
+      sysname, snapshot, b.status, stage, branch, build_flags,
+      operating_system, os_version, compiler, compiler_version, architecture 
+  from buildsystems s, 
+       build_status b
+       natural join 
+       (select sysname, branch, max(snapshot) as snapshot
+        from build_status
+        group by sysname, branch
+       having max(snapshot) > now() - '30 days'::interval
+       ) m
+  where name = sysname
+        and s.status = 'approved'
+  order by branch = 'HEAD' desc, 
+        branch desc, 
+        snapshot desc
+
+EOS
+;
+
+$statement =<<EOS;
+
+
+  select (now() at time zone 'GMT')::timestamp(0) - snapshot as when_ago,
+       sysname, snapshot, b.status, stage, branch, build_flags,
+       operating_system, coalesce(b.os_version,s.os_version) as os_version,
+       compiler, coalesce(b.compiler_version, s.compiler_version) as compiler_version, 
+       architecture 
+  from buildsystems s, 
+        (
+       select distinct on (bs.sysname, bs.branch, bs.report_time) 
+               sysname, snapshot, status, stage, branch, build_flags,
+               report_time ,compiler_version, os_version
+        from build_status bs
+             left join 
+             personality p
+             on (p.name = bs.sysname and p.effective_date <= bs.report_time)
+        order by bs.sysname, bs.branch, bs.report_time, 
+                 p.effective_date is null, p.effective_date desc
+        ) as b
+       natural join 
+               (select sysname, branch, max(snapshot) as snapshot
+        from build_status
+        group by sysname, branch
+       having max(snapshot) > now() - '30 days'::interval
+               ) m
+  where name = sysname
+        and s.status = 'approved'
+  order by branch = 'HEAD' desc, 
+        branch desc, 
+        snapshot desc
+
+
+
+EOS
+;
+
+my $statrows=[];
+my $sth=$db->prepare($statement);
+$sth->execute;
+while (my $row = $sth->fetchrow_hashref)
+{
+    next if (@members && ! grep {$_ eq $row->{sysname} } @members);
+    $row->{build_flags}  =~ s/^\{(.*)\}$/$1/;
+    $row->{build_flags}  =~ s/,/ /g;
+    $row->{build_flags}  =~ s/--((enable|with)-)?//g;
+    $row->{build_flags}  =~ s/\S+=\S+//g;
+    push(@$statrows,$row);
+}
+$sth->finish;
+
+
+$db->disconnect;
+
+my $template = new Template({});
+
+print "Content-Type: text/html\n\n";
+
+$template->process(\*DATA,{statrows=>$statrows});
+
+exit;
+
+=comment
+
+[%- BLOCK img ; flag ; END -%]
+[%- BLOCK imgx ; IF flag_imgs.$flag ; '<img src="' . flag_imgs{flag} . '" alt="' . flag . '" /> ' ; ELSE flag . ' ' ; END ; END -%]
+
+=cut
+
+__DATA__
+[%
+ flag_imgs = {
+     perl = '/img/camel.png',
+     python = '/img/python.png',
+     debug = '/img/bug.png',
+     pam => '/img/pam.png',
+     cassert => '/img/cassert.png',
+     openssl => '/img/ssl_icon.gif',
+     nls => '/img/translateicon.gif',
+     krb5 => '/img/krb.gif',
+     tcl => '/img/tcl.png',
+     'thread-safety' => '/img/threads.gif',
+     'integer-datetimes' = '/img/days.png',
+     }
+-%]
+[%- BLOCK img ; IF flag == 'depend' or flag == 'gnu-ld' ; ; ELSIF flag_imgs.$flag %]<img src="[% flag_imgs.$flag %]" title="[% flag %]" alt="[% flag %]" height="16" width="16" class="inline" align="bottom" />  [% ELSE %][%#
+                                                                                                                                                                                                         flag ; ' '
+%][% END ; END -%]
+[%- BLOCK cl %] class=" [% SWITCH bgfor -%]
+  [%- CASE 'OK' %]pass[% CASE 'ContribCheck' %]warn[% CASE [ 'Check' 'InstallCheck' ] %]warnx[% CASE %]fail[% END %]"
+[%- END -%]
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+       <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+    <title>PostgreSQL BuildFarm Status</title>
+<link rel="icon" type="image/png" href="/elephant-icon.png" /> 
+    <link rel="stylesheet" rev="stylesheet" href="/inc/pgbf.css" charset="utf-8" />
+       <style type="text/css"><!--
+       li#status a { color:rgb(17,45,137); background: url(/inc/b/r.png) no-repeat 100% -20px; } 
+       li#status { background: url(/inc/b/l.png) no-repeat 0% -20px; }
+       --></style>
+</head>
+<body>
+<div id="wrapper">
+<div id="banner">
+<a href="/index.html"><img src="/inc/pgbuildfarm-banner.png" alt="PostgreSQL BuildFarm" width="800" height="73" /></a>
+<div id="nav">
+<ul>
+    <li id="home"><a href="/index.html" title="PostgreSQL BuildFarm Home">Home</a></li>
+    <li id="status"><a href="/cgi-bin/show_status.pl" title="Current results">Status</a></li>
+    <li id="members"><a href="/cgi-bin/show_members.pl" title="Platforms tested">Members</a></li>
+    <li id="register"><a href="/register.html" title="Join PostgreSQL BuildFarm">Register</a></li>
+    <li id="pgfoundry"><a href="http://pgfoundry.org/projects/pgbuildfarm/">PGFoundry</a></li>
+    <li id="postgresql.org"><a href="http://www.postgresql.org">PostgreSQL.org</a></li>
+</ul>
+</div><!-- nav -->
+</div><!-- banner -->
+<div id="main">
+    <h1>PostgreSQL BuildFarm Status</h1>
+    <p>
+      Shown here is the latest status of each farm member 
+      for each branch it has reported on in the last 30 days.
+    </p>
+    <p>
+       Use the farm member link for history of that member 
+       on the relevant branch.
+    </p>
+<table><tr><th class="head" rowspan="2">Legend</th>
+[% FOREACH flagset IN flag_imgs %]
+<td><img src="[% flagset.value %]" title="[% flagset.key %]" alt="[% flagset.key %]" height="16" width="16" class="inline"  align="center"/> =  [% flagset.key %]</td>
+[% IF loop.count == 5 %]</tr><tr>[% END %]
+[% END %]
+</tr></table>
+<br />
+    <table cellspacing="0">
+[% brch = "" %]
+[% FOREACH row IN statrows %]
+[% IF row.branch != brch ; brch = row.branch %]
+<tr><th class="head" colspan="4">Branch: [% brch %]</th></tr>
+<tr><th>Alias</th><th>System</th><th>Status</th><th>Flags</th></tr>
+[% END %]
+<tr [% PROCESS cl bgfor=row.stage %]>
+    <td><a 
+    href="show_history.pl?nm=[% row.sysname %]&amp;br=[% row.branch %]"
+    title="History"
+    >[% row.sysname %]</a></td>
+    <td><span class="opsys">[% row.operating_system %]
+            [% row.os_version %]</span> <span class="compiler">
+            [%- row.compiler %]
+            [% row.compiler_version %]</span> <span class="arch">
+            [%- row.architecture %]</span></td>
+    <td class="status">
+            [%- row.when_ago | replace('\s','&nbsp;') %]&nbsp;ago&nbsp;
+            [% row.stage -%]
+            <a href="show_log.pl?nm=
+               [%- row.sysname %]&amp;dt=
+               [%- row.snapshot | uri %]">
+                [%- IF row.stage != 'OK' %]Details[% ELSE %]Config[% END -%]</a></td>
+
+    <td class="flags">[% FOREACH flag IN row.build_flags.split().sort() ; PROCESS img ; END %]</td>
+</tr>
+[% END %]
+    </table>
+</div><!-- main -->
+<hr />
+<p style="text-align: center;">
+Hosting for the PostgreSQL Buildfarm is generously 
+provided by: 
+<a href="http://www.commandprompt.com">CommandPrompt, 
+The PostgreSQL Company</a>
+</p>
+</div><!-- wrapper -->
+  </body>
+</html>
+
+
+
+
+
+
+
+
diff --git a/cgi-bin/show_status.pl.save b/cgi-bin/show_status.pl.save
new file mode 100644 (file)
index 0000000..0c64b17
--- /dev/null
@@ -0,0 +1,153 @@
+#!/usr/bin/perl
+
+use strict;
+use DBI;
+use Template;
+use CGI;
+
+use vars qw($dbhost $dbname $dbuser $dbpass $dbport);
+
+
+require "$ENV{BFConfDir}/BuildFarmWeb.pl";
+
+my $query = new CGI;
+my @members = $query->param('member');
+
+my $dsn="dbi:Pg:dbname=$dbname";
+$dsn .= ";host=$dbhost" if $dbhost;
+$dsn .= ";port=$dbport" if $dbport;
+
+my $db = DBI->connect($dsn,$dbuser,$dbpass) or die("$dsn,$dbuser,$dbpass,$!");
+
+# there is possibly some redundancy in this query, but it makes
+# a lot of the processing simpler.
+
+my $statement = <<EOS;
+
+  select (now() at time zone 'GMT')::timestamp(0) - snapshot as when_ago,
+      sysname, snapshot, b.status, stage, branch, build_flags,
+      operating_system, os_version, compiler, compiler_version, architecture 
+  from buildsystems s, 
+       build_status b natural join 
+       (select sysname, branch, max(snapshot) as snapshot
+        from build_status
+        group by sysname, branch
+       having max(snapshot) > now() - '30 days'::interval
+       ) m
+  where name = sysname
+        and s.status = 'approved'
+  order by case when branch = 'HEAD' then 0 else 1 end, 
+        branch desc, 
+        snapshot desc
+
+EOS
+;
+
+my $statrows=[];
+my $sth=$db->prepare($statement);
+$sth->execute;
+while (my $row = $sth->fetchrow_hashref)
+{
+    next if (@members && ! grep {$_ eq $row->{sysname} } @members);
+    $row->{build_flags}  =~ s/^\{(.*)\}$/$1/;
+    $row->{build_flags}  =~ s/,/ /g;
+    $row->{build_flags}  =~ s/--((enable|with)-)?//g;
+    $row->{build_flags}  =~ s/\S+=\S+//g;
+    push(@$statrows,$row);
+}
+$sth->finish;
+
+
+$db->disconnect;
+
+my $template = new Template({});
+
+print "Content-Type: text/html\n\n";
+
+$template->process(\*DATA,{statrows=>$statrows});
+
+exit;
+
+
+__DATA__
+[%- BLOCK cl %] class=" [% SWITCH bgfor -%]
+  [%- CASE 'OK' %]pass[% CASE 'ContribCheck' %]warn[% CASE [ 'Check' 'InstallCheck' ] %]warnx[% CASE %]fail[% END %]"
+[%- END -%]
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+       <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+    <title>PostgreSQL BuildFarm Status</title>
+    <link rel="stylesheet" rev="stylesheet" href="/inc/pgbf.css" charset="utf-8" />
+       <style type="text/css"><!--
+       li#status a { color:rgb(17,45,137); background: url(/inc/b/r.png) no-repeat 100% -20px; } 
+       li#status { background: url(/inc/b/l.png) no-repeat 0% -20px; }
+       --></style>
+</head>
+<body>
+<div id="wrapper">
+<div id="banner">
+<a href="/index.html"><img src="/inc/pgbuildfarm-banner.png" alt="PostgreSQL BuildFarm" width="800" height="73" /></a>
+<div id="nav">
+<ul>
+    <li id="home"><a href="/index.html" title="PostgreSQL BuildFarm Home">Home</a></li>
+    <li id="status"><a href="/cgi-bin/show_status.pl" title="Current results">Status</a></li>
+    <li id="members"><a href="/cgi-bin/show_members.pl" title="Platforms tested">Members</a></li>
+    <li id="register"><a href="/register.html" title="Join PostgreSQL BuildFarm">Register</a></li>
+    <li id="pgfoundry"><a href="http://pgfoundry.org/projects/pgbuildfarm/">PGFoundry</a></li>
+    <li id="postgresql.org"><a href="http://www.postgresql.org">PostgreSQL.org</a></li>
+</ul>
+</div><!-- nav -->
+</div><!-- banner -->
+<div id="main">
+    <h1>PostgreSQL BuildFarm Status</h1>
+    <p>
+      Shown here is the latest status of each farm member 
+      for each branch it has reported on in the last 30 days.
+    </p>
+    <p>
+       Use the farm member link for history of that member 
+       on the relevant branch.
+    </p>
+    <table cellspacing="0">
+[% brch = "" %]
+[% FOREACH row IN statrows %]
+[% IF row.branch != brch ; brch = row.branch %]
+<tr><th class="head" colspan="4">Branch: [% brch %]</th></tr>
+<tr><th>Alias</th><th>System</th><th>Status</th><th>Flags</th></tr>
+[% END %]
+<tr [% PROCESS cl bgfor=row.stage %]>
+    <td><a 
+    href="show_history.pl?nm=[% row.sysname %]&amp;br=[% row.branch %]"
+    title="History"
+    >[% row.sysname %]</a></td>
+    <td><span class="opsys">[% row.operating_system %]
+            [% row.os_version %]</span> <span class="compiler">
+            [%- row.compiler %]
+            [% row.compiler_version %]</span> <span class="arch">
+            [%- row.architecture %]</span></td>
+    <td class="status">
+            [%- row.when_ago | replace('\s','&nbsp;') %]&nbsp;ago&nbsp;
+            [% row.stage -%]
+            <a href="show_log.pl?nm=
+               [%- row.sysname %]&amp;dt=
+               [%- row.snapshot | uri %]">
+                [%- IF row.stage != 'OK' %]Details[% ELSE %]Config[% END -%]</a></td>
+
+    <td class="flags">[% row.build_flags %]</td>
+</tr>
+[% END %]
+    </table>
+</div><!-- main -->
+</div><!-- wrapper -->
+  </body>
+</html>
+
+
+
+
+
+
+
+
diff --git a/cgi-bin/show_status2.pl b/cgi-bin/show_status2.pl
new file mode 100644 (file)
index 0000000..a1b1ab1
--- /dev/null
@@ -0,0 +1,64 @@
+#!/usr/bin/perl
+
+use strict;
+use DBI;
+use Template;
+use CGI;
+
+use vars qw($dbhost $dbname $dbuser $dbpass $dbport);
+
+
+require "$ENV{BFConfDir}/BuildFarmWeb.pl";
+
+my $query = new CGI;
+my @members = $query->param('member');
+
+my $dsn="dbi:Pg:dbname=$dbname";
+$dsn .= ";host=$dbhost" if $dbhost;
+$dsn .= ";port=$dbport" if $dbport;
+
+my $db = DBI->connect($dsn,$dbuser,$dbpass) or die("$dsn,$dbuser,$dbpass,$!");
+
+# there is possibly some redundancy in this query, but it makes
+# a lot of the processing simpler.
+
+my $statement = <<EOS;
+
+  select (now() at time zone 'GMT')::timestamp(0) - snapshot as when_ago,
+      sysname, snapshot, b.status, stage, branch,
+      operating_system, os_version, compiler, compiler_version, architecture 
+  from buildsystems s, 
+       build_status b natural join 
+       (select sysname, branch, max(snapshot) as snapshot
+        from build_status
+        group by sysname, branch
+       having max(snapshot) > now() - '30 days'::interval
+       ) m
+  where name = sysname
+        and s.status = 'approved'
+  order by case when branch = 'HEAD' then 0 else 1 end, 
+        branch desc, 
+        snapshot desc
+
+EOS
+;
+
+my $statrows=[];
+my $sth=$db->prepare($statement);
+$sth->execute;
+while (my $row = $sth->fetchrow_hashref)
+{
+    next if (@members && ! grep {$_ eq $row->{sysname} } @members);
+    push(@$statrows,$row);
+}
+$sth->finish;
+
+
+$db->disconnect;
+
+my $template = new Template({INCLUDE_PATH=>"/home/community/pgbuildfarm/templates"});
+
+print "Content-Type: text/html\n\n";
+
+$template->process("dyn/status.tt",{statrows=>$statrows});
+
diff --git a/cgi-bin/show_status9.pl b/cgi-bin/show_status9.pl
new file mode 100644 (file)
index 0000000..54731d7
--- /dev/null
@@ -0,0 +1,193 @@
+#!/usr/bin/perl
+
+use strict;
+use DBI;
+use Template;
+use CGI;
+
+use vars qw($dbhost $dbname $dbuser $dbpass $dbport);
+
+
+require "$ENV{BFConfDir}/BuildFarmWeb.pl";
+
+my $query = new CGI;
+my @members = $query->param('member');
+
+my $dsn="dbi:Pg:dbname=$dbname";
+$dsn .= ";host=$dbhost" if $dbhost;
+$dsn .= ";port=$dbport" if $dbport;
+
+my $db = DBI->connect($dsn,$dbuser,$dbpass) or die("$dsn,$dbuser,$dbpass,$!");
+
+# there is possibly some redundancy in this query, but it makes
+# a lot of the processing simpler.
+
+my $statement = <<EOS;
+
+  select (now() at time zone 'GMT')::timestamp(0) - snapshot as when_ago,
+      sysname, snapshot, b.status, stage, branch, build_flags,
+      operating_system, os_version, compiler, compiler_version, architecture 
+  from buildsystems s, 
+       build_status b natural join 
+       (select sysname, branch, max(snapshot) as snapshot
+        from build_status
+        group by sysname, branch
+       having max(snapshot) > now() - '30 days'::interval
+       ) m
+  where name = sysname
+        and s.status = 'approved'
+  order by case when branch = 'HEAD' then 0 else 1 end, 
+        branch desc, 
+        snapshot desc
+
+EOS
+;
+
+my $statrows=[];
+my $sth=$db->prepare($statement);
+$sth->execute;
+while (my $row = $sth->fetchrow_hashref)
+{
+    next if (@members && ! grep {$_ eq $row->{sysname} } @members);
+    $row->{build_flags}  =~ s/^\{(.*)\}$/$1/;
+    $row->{build_flags}  =~ s/,/ /g;
+    $row->{build_flags}  =~ s/--((enable|with)-)?//g;
+    $row->{build_flags}  =~ s/\S+=\S+//g;
+    push(@$statrows,$row);
+}
+$sth->finish;
+
+
+$db->disconnect;
+
+my $template = new Template({});
+
+print "Content-Type: text/html\n\n";
+
+$template->process(\*DATA,{statrows=>$statrows});
+
+exit;
+
+=comment
+
+[%- BLOCK img ; flag ; END -%]
+[%- BLOCK imgx ; IF flag_imgs.$flag ; '<img src="' . flag_imgs{flag} . '" alt="' . flag . '" /> ' ; ELSE flag . ' ' ; END ; END -%]
+
+=cut
+
+__DATA__
+[%
+ flag_imgs = {
+     perl = '/img/camel.png',
+     python = '/img/python.png',
+     debug = '/img/bug.png',
+     pam => '/img/pam.png',
+     cassert => '/img/cassert.png',
+     openssl => '/img/ssl_icon.gif',
+     nls => '/img/translateicon.gif',
+     krb5 => '/img/krb.gif',
+     tcl => '/img/tcl.png',
+     'thread-safety' => '/img/threads.gif',
+     'integer-datetimes' = '/img/days.png',
+     }
+-%]
+[%- BLOCK img ; IF flag == 'blank' %]<img src="/img/blank.gif" height="16" width="16" class="inline" align="bottom" /> [% ELSIF flag_imgs.$flag %]<img src="[% flag_imgs.$flag %]" title="[% flag %]" alt="[% flag %]" height="16" width="16" class="inline" align="bottom" />  [% ELSE %][%#
+                                                                                                                                                                                                         flag ; ' '
+%][% END ; END -%]
+[%- BLOCK cl %] class=" [% SWITCH bgfor -%]
+  [%- CASE 'OK' %]pass[% CASE 'ContribCheck' %]warn[% CASE [ 'Check' 'InstallCheck' ] %]warnx[% CASE %]fail[% END %]"
+[%- END -%]
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+       <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+    <title>PostgreSQL BuildFarm Status</title>
+    <link rel="stylesheet" rev="stylesheet" href="/inc/pgbf.css" charset="utf-8" />
+       <style type="text/css"><!--
+       li#status a { color:rgb(17,45,137); background: url(/inc/b/r.png) no-repeat 100% -20px; } 
+       li#status { background: url(/inc/b/l.png) no-repeat 0% -20px; }
+       --></style>
+</head>
+<body>
+<div id="wrapper">
+<div id="banner">
+<a href="/index.html"><img src="/inc/pgbuildfarm-banner.png" alt="PostgreSQL BuildFarm" width="800" height="73" /></a>
+<div id="nav">
+<ul>
+    <li id="home"><a href="/index.html" title="PostgreSQL BuildFarm Home">Home</a></li>
+    <li id="status"><a href="/cgi-bin/show_status.pl" title="Current results">Status</a></li>
+    <li id="members"><a href="/cgi-bin/show_members.pl" title="Platforms tested">Members</a></li>
+    <li id="register"><a href="/register.html" title="Join PostgreSQL BuildFarm">Register</a></li>
+    <li id="pgfoundry"><a href="http://pgfoundry.org/projects/pgbuildfarm/">PGFoundry</a></li>
+    <li id="postgresql.org"><a href="http://www.postgresql.org">PostgreSQL.org</a></li>
+</ul>
+</div><!-- nav -->
+</div><!-- banner -->
+<div id="main">
+    <h1>PostgreSQL BuildFarm Status</h1>
+    <p>
+      Shown here is the latest status of each farm member 
+      for each branch it has reported on in the last 30 days.
+    </p>
+    <p>
+       Use the farm member link for history of that member 
+       on the relevant branch.
+    </p>
+<table><tr><th class="head" rowspan="2" cellspacing="0">Legend</th>
+[% FOREACH flagset IN flag_imgs %]
+<td><img src="[% flagset.value %]" title="[% flagset.key %]" alt="[% flagset.key %]" height="16" width="16" class="inline"  align="center"/> =  [% flagset.key %]</td>
+[% IF loop.count == 6 %]</tr><tr>[% END %]
+[% END %]
+</tr></table>
+<br />
+    <table cellspacing="0">
+[% brch = "" %]
+[% FOREACH row IN statrows %]
+[% IF row.branch != brch ; brch = row.branch %]
+<tr><th class="head" colspan="4">Branch: [% brch %]</th></tr>
+<tr><th>Alias</th><th>System</th><th>Status</th><th>Flags</th></tr>
+[% END %]
+<tr [% PROCESS cl bgfor=row.stage %]>
+    <td><a 
+    href="show_history.pl?nm=[% row.sysname %]&amp;br=[% row.branch %]"
+    title="History"
+    >[% row.sysname %]</a></td>
+    <td><span class="opsys">[% row.operating_system %]
+            [% row.os_version %]</span> <span class="compiler">
+            [%- row.compiler %]
+            [% row.compiler_version %]</span> <span class="arch">
+            [%- row.architecture %]</span></td>
+    <td class="status">
+            [%- row.when_ago | replace('\s','&nbsp;') %]&nbsp;ago&nbsp;
+            [% row.stage -%]
+            <a href="show_log.pl?nm=
+               [%- row.sysname %]&amp;dt=
+               [%- row.snapshot | uri %]">
+                [%- IF row.stage != 'OK' %]Details[% ELSE %]Config[% END -%]</a></td>
+
+    <td class="flags">[% 
+                      flags = row.build_flags.split();
+                      FOREACH flagme  IN flag_imgs.keys() ;
+                      IF flags.grep(flagme).size > 0 ;
+                         PROCESS img flag = flagme ; 
+                      ELSE ;
+                         PROCESS img flag = 'blank' ;
+                      END;
+                      END 
+                      %]</td>
+</tr>
+[% END %]
+    </table>
+</div><!-- main -->
+</div><!-- wrapper -->
+  </body>
+</html>
+
+
+
+
+
+
+
+
diff --git a/cgi-bin/show_status_soap.pl b/cgi-bin/show_status_soap.pl
new file mode 100644 (file)
index 0000000..e51db59
--- /dev/null
@@ -0,0 +1,102 @@
+#!/usr/bin/perl
+
+use strict;
+
+
+use vars qw($dbhost $dbname $dbuser $dbpass $dbport);
+
+require "$ENV{BFConfDir}/BuildFarmWeb.pl";
+
+use lib "/home/community/pgbuildfarm/lib/lib/perl5/site_perl";
+
+use SOAP::Transport::HTTP;
+
+SOAP::Transport::HTTP::CGI->dispatch_to('PGBuildFarm')->handle;
+
+exit;
+
+package PGBuildFarm;
+
+use DBI;
+
+sub get_status
+
+{
+    my $class = shift;
+    my @members = @_;
+
+    my $dsn="dbi:Pg:dbname=$::dbname";
+    $dsn .= ";host=$::dbhost" if $::dbhost;
+    $dsn .= ";port=$::dbport" if $::dbport;
+
+    my $db = DBI->connect($dsn,$::dbuser,$::dbpass) or 
+       die("$dsn,$::dbuser,$::dbpass,$!");
+
+    # there is possibly some redundancy in this query, but it makes
+    # a lot of the processing simpler.
+
+    my $statement =<<EOS;
+
+
+    select (now() at time zone 'GMT')::timestamp(0) - snapshot as when_ago,
+       sysname, snapshot, b.status, stage, branch, build_flags,
+       operating_system, coalesce(b.os_version,s.os_version) as os_version,
+       compiler, 
+        coalesce(b.compiler_version, s.compiler_version) as compiler_version, 
+       architecture 
+    from buildsystems s, 
+        (
+       select distinct on (bs.sysname, bs.branch, bs.report_time) 
+               sysname, snapshot, status, stage, branch, build_flags,
+               report_time ,compiler_version, os_version
+        from build_status bs
+             left join 
+             personality p
+             on (p.name = bs.sysname and p.effective_date <= bs.report_time)
+        order by bs.sysname, bs.branch, bs.report_time, 
+                 p.effective_date is null, p.effective_date desc
+        ) as b
+       natural join 
+               (select sysname, branch, max(snapshot) as snapshot
+        from build_status
+        group by sysname, branch
+       having max(snapshot) > now() - '30 days'::interval
+               ) m
+    where name = sysname
+        and s.status = 'approved'
+    order by branch = 'HEAD' desc, 
+        branch desc, 
+        snapshot desc
+
+
+
+EOS
+;
+
+    my $statrows=[];
+    my $sth=$db->prepare($statement);
+    $sth->execute;
+    while (my $row = $sth->fetchrow_hashref)
+    {
+       next if (@members && ! grep {$_ eq $row->{sysname} } @members);
+       $row->{build_flags}  =~ s/^\{(.*)\}$/$1/;
+       $row->{build_flags}  =~ s/,/ /g;
+       $row->{build_flags}  =~ s/--((enable|with)-)?//g;
+       $row->{build_flags}  =~ s/\S+=\S+//g;
+       push(@$statrows,$row);
+    }
+    $sth->finish;
+
+
+    $db->disconnect;
+
+    return $statrows;
+
+}
+
+1;
+
+
+
+
+
diff --git a/cgi-bin/test.pl b/cgi-bin/test.pl
new file mode 100644 (file)
index 0000000..9b179d2
--- /dev/null
@@ -0,0 +1,24 @@
+#!/usr/bin/perl
+
+#print "Content-Type: text/html\n\n";
+#print "<h1>My quick perl hello</h1>";
+
+use CGI;
+
+my $query = new CGI;
+
+my $url = $query->url();
+
+my $base = $query->url(-base=>1);
+
+print <<EOF;
+Content-Type: text/plain
+
+
+url = $url
+
+base = $base
+
+EOF
+
+
diff --git a/cgi-bin/upgrade.pl b/cgi-bin/upgrade.pl
new file mode 100644 (file)
index 0000000..f4cbb99
--- /dev/null
@@ -0,0 +1,149 @@
+#!/usr/bin/perl
+
+use strict;
+
+use CGI;
+use Digest::SHA1  qw(sha1_hex);
+use MIME::Base64;
+use DBI;
+use DBD::Pg;
+use Data::Dumper;
+
+use vars qw($dbhost $dbname $dbuser $dbpass $dbport);
+
+my $query = new CGI;
+
+my $sig = $query->path_info;
+$sig =~ s!^/!!;
+
+my $animal = $query->param('animal');
+my $ts = $query->param('ts');
+my $os_version = $query->param('new_os');
+my $compiler_version = $query->param('new_compiler');
+
+my $content = "animal=$animal\&ts=$ts";
+$content .= "\&new_os=$os_version" if $os_version;
+$content .= "\&new_compiler=$compiler_version" if $compiler_version;
+
+require "$ENV{BFConfDir}/BuildFarmWeb.pl";
+
+die "no dbname" unless $dbname;
+die "no dbuser" unless $dbuser;
+
+my $dsn="dbi:Pg:dbname=$dbname";
+$dsn .= ";host=$dbhost" if $dbhost;
+$dsn .= ";port=$dbport" if $dbport;
+
+unless ($animal && $ts && ($os_version || $compiler_version) && $sig)
+{
+       print 
+           "Status: 490 bad parameters\nContent-Type: text/plain\n\n",
+           "bad parameters for request\n";
+       exit;
+       
+}
+
+
+my $db = DBI->connect($dsn,$dbuser,$dbpass);
+
+die $DBI::errstr unless $db;
+
+my $gethost=
+    "select secret from buildsystems where name = ? and status = 'approved'";
+my $sth = $db->prepare($gethost);
+$sth->execute($animal);
+my ($secret)=$sth->fetchrow_array();
+$sth->finish;
+
+
+unless ($secret)
+{
+       print 
+           "Status: 495 Unknown System\nContent-Type: text/plain\n\n",
+           "System $animal is unknown\n";
+       $db->disconnect;
+       exit;
+       
+}
+
+
+
+
+my $calc_sig = sha1_hex($content,$secret);
+
+if ($calc_sig ne $sig)
+{
+
+       print "Status: 450 sig mismatch\nContent-Type: text/plain\n\n";
+       print "$sig mismatches $calc_sig on content:\n$content";
+       $db->disconnect;
+       exit;
+}
+
+# undo escape-proofing of base64 data and decode it
+map {tr/$@/+=/; $_ = decode_base64($_); } 
+    ($os_version, $compiler_version);
+
+my $get_latest = q{
+
+    select coalesce(b.os_version, a.os_version) as os_version,
+           coalesce(b.compiler_version, a.compiler_version) as compiler_version
+    from buildsystems as a left join
+         (  select distinct on (name) name, compiler_version, os_version
+            from personality
+            order by name, effective_date desc
+         ) as b
+         on (a.name = b.name)
+    where a.name = ?
+          and a.status = 'approved'
+
+};
+
+$sth = $db->prepare($get_latest);
+my $rv = $sth->execute($animal);
+unless($rv)
+{
+       print "Status: 460 old data fetch\nContent-Type: text/plain\n\n";
+       print "error: ",$db->errstr,"\n";
+       $db->disconnect;
+       exit;
+}
+
+my ($old_os,$old_comp)=$sth->fetchrow_array();
+$sth->finish;
+
+
+
+$os_version ||= $old_os;
+$compiler_version ||= $old_comp;
+
+my $new_personality = q{
+
+    insert into personality (name, os_version, compiler_version)
+       values (?,?,?)
+
+}; 
+
+
+$sth = $db->prepare($new_personality);
+$rv = $sth->execute($animal,$os_version, $compiler_version);
+
+unless($rv)
+{
+       print "Status: 470 new data insert\nContent-Type: text/plain\n\n";
+       print "error: $db->errstr\n";
+       $db->disconnect;
+       exit;
+}
+
+$sth->finish;
+
+
+
+$db->disconnect;
+
+print "Content-Type: text/plain\n\n";
+print "request was on:\n$content\n";
+
+
+
diff --git a/htdocs/bfweb.tgz b/htdocs/bfweb.tgz
new file mode 100644 (file)
index 0000000..4ed50ab
Binary files /dev/null and b/htdocs/bfweb.tgz differ
diff --git a/htdocs/elephant-head_only.gif b/htdocs/elephant-head_only.gif
new file mode 100644 (file)
index 0000000..dd791da
Binary files /dev/null and b/htdocs/elephant-head_only.gif differ
diff --git a/htdocs/elephant-icon.png b/htdocs/elephant-icon.png
new file mode 100644 (file)
index 0000000..278bfd8
Binary files /dev/null and b/htdocs/elephant-icon.png differ
diff --git a/htdocs/elephant5.gif b/htdocs/elephant5.gif
new file mode 100644 (file)
index 0000000..cb9da33
Binary files /dev/null and b/htdocs/elephant5.gif differ
diff --git a/htdocs/elephant5a.gif b/htdocs/elephant5a.gif
new file mode 100644 (file)
index 0000000..076cb9d
Binary files /dev/null and b/htdocs/elephant5a.gif differ
diff --git a/htdocs/img/blank.gif b/htdocs/img/blank.gif
new file mode 100644 (file)
index 0000000..448d4c4
Binary files /dev/null and b/htdocs/img/blank.gif differ
diff --git a/htdocs/img/bug.png b/htdocs/img/bug.png
new file mode 100644 (file)
index 0000000..2e92af1
Binary files /dev/null and b/htdocs/img/bug.png differ
diff --git a/htdocs/img/camel.png b/htdocs/img/camel.png
new file mode 100644 (file)
index 0000000..95ca8c5
Binary files /dev/null and b/htdocs/img/camel.png differ
diff --git a/htdocs/img/cassert.png b/htdocs/img/cassert.png
new file mode 100644 (file)
index 0000000..5b9241f
Binary files /dev/null and b/htdocs/img/cassert.png differ
diff --git a/htdocs/img/days.png b/htdocs/img/days.png
new file mode 100644 (file)
index 0000000..ae24849
Binary files /dev/null and b/htdocs/img/days.png differ
diff --git a/htdocs/img/kerberos.png b/htdocs/img/kerberos.png
new file mode 100644 (file)
index 0000000..80a9c46
Binary files /dev/null and b/htdocs/img/kerberos.png differ
diff --git a/htdocs/img/krb.gif b/htdocs/img/krb.gif
new file mode 100644 (file)
index 0000000..c1cfcbf
Binary files /dev/null and b/htdocs/img/krb.gif differ
diff --git a/htdocs/img/pam.png b/htdocs/img/pam.png
new file mode 100644 (file)
index 0000000..a1015e8
Binary files /dev/null and b/htdocs/img/pam.png differ
diff --git a/htdocs/img/python.png b/htdocs/img/python.png
new file mode 100644 (file)
index 0000000..a7ea47b
Binary files /dev/null and b/htdocs/img/python.png differ
diff --git a/htdocs/img/ssl_icon.gif b/htdocs/img/ssl_icon.gif
new file mode 100644 (file)
index 0000000..2d34d76
Binary files /dev/null and b/htdocs/img/ssl_icon.gif differ
diff --git a/htdocs/img/tcl.png b/htdocs/img/tcl.png
new file mode 100644 (file)
index 0000000..957e760
Binary files /dev/null and b/htdocs/img/tcl.png differ
diff --git a/htdocs/img/threads.gif b/htdocs/img/threads.gif
new file mode 100644 (file)
index 0000000..3068767
Binary files /dev/null and b/htdocs/img/threads.gif differ
diff --git a/htdocs/img/translateicon.gif b/htdocs/img/translateicon.gif
new file mode 100644 (file)
index 0000000..104a5ed
Binary files /dev/null and b/htdocs/img/translateicon.gif differ
diff --git a/htdocs/inc/b/l.png b/htdocs/inc/b/l.png
new file mode 100644 (file)
index 0000000..19a036d
Binary files /dev/null and b/htdocs/inc/b/l.png differ
diff --git a/htdocs/inc/b/r.png b/htdocs/inc/b/r.png
new file mode 100644 (file)
index 0000000..640199c
Binary files /dev/null and b/htdocs/inc/b/r.png differ
diff --git a/htdocs/inc/pgbf.css b/htdocs/inc/pgbf.css
new file mode 100644 (file)
index 0000000..a83b2cb
--- /dev/null
@@ -0,0 +1,129 @@
+body { 
+    background: #fff;
+       margin: 0;
+       font-family: helvetica, trebuchet, "Lucida Grande", sans-serif;
+    font-size:small 
+    }
+
+img { display:block; }
+img.inline { display:inline; }
+
+a img { border:none; }
+a:hover img { border: none; }
+
+#wrapper { 
+    margin:0 auto;
+       margin-left: 5px;
+    /* width: 800px; */
+}
+
+#banner img { margin:6px 0; }
+
+#nav {
+   float:left;
+   width:780px;
+   background:#fff;
+   margin:0 10px 10px;
+}
+
+#nav ul {
+   margin:0;
+   padding:0;
+   list-style:none;
+}
+
+#nav li {
+   float:left;
+   margin:0 .5em 0 0;
+   padding:0 0 0 4px;
+   background: url(/inc/b/l.png) no-repeat left top;
+}
+
+#nav li a { 
+    display:block;
+    background:url(/inc/b/r.png) no-repeat right top;
+    padding:0 11px 0 7px;
+    color:#fff;
+    text-decoration:none;
+    line-height:20px;
+}
+
+#nav li a:hover {
+    background: url(/inc/b/r.png) no-repeat 100% -20px;
+    color:rgb(17,45,137); 
+    border: 0;
+}
+
+#nav li:hover { background: url(/inc/b/l.png) no-repeat 0% -20px; } 
+
+#main {
+    clear:both;
+    margin:0 5px;
+}
+
+#main a {
+       text-decoration: none;
+       color: rgb(17,45,137);
+       font-weight: bold;
+       background: inherit;
+}
+
+a:hover, a:active { border-bottom: 1px dotted rgb(17,45,137); }
+p { padding: .3em 0; }
+
+table {
+       font-size: small;
+       border: 1px #aaa solid;
+       border-right: 0;
+       border-bottom: 0;
+}
+
+th, td {
+       white-space: nowrap;
+       border: 1px #aaa solid;
+       border-top: 0;
+       border-left: 0;
+       padding:2px;
+}
+
+body.members td { white-space: normal; }
+
+th {
+       background: #ddd;
+       color: #222;
+       font-size: x-small;
+}
+
+tr.alt td { background: #eef; }
+
+th.head {
+       background: #666;
+       color: #fff;
+       text-align: center !important;
+       letter-spacing: .1em;
+}
+
+.status, .detail { border-bottom: 1px #fff solid; }
+tr.last td { border-bottom: 1px #aaa solid; }
+.pass td.status, .pass td.detail { background: #6f6; }
+.warn td.status, .warn td.detail { background: #fc3; }
+.warnx td.status, .warn td.detail { background: #f99; }
+.fail td.status, .fail td.detail { background: #f66; }
+body.history th { text-align: right; }
+body.application table { margin: 0 auto; }
+body.application th { text-align: right; }
+body.application th.submit { text-align: center; }
+
+td.branch ul { list-style: none; }
+
+td.branch ul, td.branch li {
+       margin: 0;
+       padding: 0;
+}
+
+.opsys { color: black; }
+.compiler { color: navy; }
+.arch { color: purple; }
+
+td.flags { white-space: normal;  font-size: x-small; }
+
diff --git a/htdocs/inc/pgbuildfarm-banner.png b/htdocs/inc/pgbuildfarm-banner.png
new file mode 100644 (file)
index 0000000..4698817
Binary files /dev/null and b/htdocs/inc/pgbuildfarm-banner.png differ
diff --git a/htdocs/index.html b/htdocs/index.html
new file mode 100644 (file)
index 0000000..37545f2
--- /dev/null
@@ -0,0 +1,63 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+       <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+       <title>PostgreSQL BuildFarm</title>
+       <link rel="icon" type="image/png" href="/elephant-icon.png" />
+       <link rel="stylesheet" rev="stylesheet" href="/inc/pgbf.css" charset="utf-8" />
+       <style type="text/css"><!--
+       li#home a { color:rgb(17,45,137); background: url(/inc/b/r.png) no-repeat 100% -20px; } 
+       li#home { background: url(/inc/b/l.png) no-repeat 0% -20px; }
+       --></style>
+</head>
+<body>
+<div id="wrapper">
+<div id="banner">
+<a href="/index.html"><img src="/inc/pgbuildfarm-banner.png" alt="PostgreSQL BuildFarm" width="800" height="73" /></a>
+<div id="nav">
+<ul>
+    <li id="home"><a href="/index.html" title="PostgreSQL BuildFarm Home">Home</a></li>
+    <li id="status"><a href="/cgi-bin/show_status.pl" title="Current results">Status</a></li>
+    <li id="members"><a href="/cgi-bin/show_members.pl" title="Platforms tested">Members</a></li>
+    <li id="register"><a href="/register.html" title="Join PostgreSQL BuildFarm">Register</a></li>
+    <li id="pgfoundry"><a href="http://pgfoundry.org/projects/pgbuildfarm/">PGFoundry</a></li>
+</ul>
+</div><!-- nav -->
+</div><!-- banner -->
+<div id="main">
+<p>
+The PostgreSQL build farm is a distributed system for automatically testing
+changes in the source code for PostgreSQL as they occur, on a wide variety
+of platforms. This server is the central repository for the results of those
+tests.
+</p>
+<p>
+To see the current status of tests on various branches, check the
+<a href="/cgi-bin/show_status.pl" title="Status Page">Status Page</a>.
+</p>
+<p>
+If you are interested in running a member of the build farm, then please visit
+the <a href="/register.html" title="Register">Registration Page</a>.
+We are particularly interested in unusual platforms or combinations of
+architecture, operating system and compiler.
+</p>
+<p>To see what is involved in running a buildfarm member, please visit the
+<a href="http://pgfoundry.org/projects/pgbuildfarm/">project page</a> at 
+<a href="http://pgfoundry.org/">PGFoundry</a> and
+especially read the 
+<a href="http://pgfoundry.org/docman/view.php/1000040/4/PGBuildFarm-HOWTO.txt">HowTo documentation</a>.
+</p>
+<p>The build farm software should run on all platforms that can support PostgreSQL.
+</p>
+</div><!-- main -->
+<hr />
+<p style="text-align: center;">
+Hosting for the PostgreSQL Buildfarm is generously 
+provided by: 
+<a href="http://www.commandprompt.com">CommandPrompt, 
+The PostgreSQL Company</a>
+</p>
+</div><!-- wrapper -->
+</body>
+</html>
diff --git a/htdocs/register.html b/htdocs/register.html
new file mode 100644 (file)
index 0000000..567bfb8
--- /dev/null
@@ -0,0 +1,108 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+       <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+       <title>PostgreSQL BuildFarm Application</title>
+       <link rel="icon" type="image/png" href="/elephant-icon.png" />
+       <link rel="stylesheet" rev="stylesheet" href="/inc/pgbf.css" charset="utf-8" />
+       <style type="text/css"><!--
+       li#register a { color:rgb(17,45,137); background: url(/inc/b/r.png) no-repeat 100% -20px; } 
+       li#register { background: url(/inc/b/l.png) no-repeat 0% -20px; }
+       --></style>
+</head>
+<body class="application">
+<div id="wrapper">
+<div id="banner">
+<a href="/index.html"><img src="/inc/pgbuildfarm-banner.png" alt="PostgreSQL BuildFarm" width="800" height="73" /></a>
+<div id="nav">
+<ul>
+    <li id="home"><a href="/index.html" title="PostgreSQL BuildFarm Home">Home</a></li>
+    <li id="status"><a href="/cgi-bin/show_status.pl" title="Current results">Status</a></li>
+    <li id="members"><a href="/cgi-bin/show_members.pl" title="Platforms tested">Members</a></li>
+    <li id="register"><a href="/register.html" title="Join PostgreSQL BuildFarm">Register</a></li>
+    <li id="pgfoundry"><a href="http://pgfoundry.org/projects/pgbuildfarm/">PGFoundry</a></li>
+</ul>
+</div><!-- nav -->
+</div><!-- banner -->
+<div id="main">
+<h1>Application to join PostgreSQL BuildFarm</h1>
+
+<p>Here is a short description of what is required to join the buildfarm successfully. Please read it carefully
+before submitting this form.</p>
+
+<ul>
+<li> your machine will need to be able to contact <a href="http://www.pgbuildfarm.org">http://www.pgbuildfarm.org</a>
+     either directly or via proxy, and it will need access to a PostgreSQL CVS repository, 
+     either the one at postgresql.org or a mirror (you can set up your own mirror using CSVup on a Linux or FreeBSD machine - 
+     this is recommended).</li>
+<li> have a working Postgresql build environment for your platform 
+     (for Windows this means MSys/MinGW with the libz and libintl stuff,  and ideally native Python and Tcl).</li>
+<li> Windows only: you will need a native perl installed as well as the one in the MSys DTK. The one from ActiveState works fine.</li>
+<li> download and unpack the latest release of client code from 
+     <a href="http://pgfoundry.org/frs/?group_id=1000040">http://pgfoundry.org/frs/?group_id=1000040</a></li>
+<li> read instructions at 
+     <a href="http://pgfoundry.org/docman/view.php/1000040/4/PGBuildFarm-HOWTO.txt">http://pgfoundry.org/docman/view.php/1000040/4/PGBuildFarm-HOWTO.txt</a></li>
+<li> get the software running locally using flags --force --nostatus --nosend</li>
+<li> register your machine on this page</li>
+<li> when you receive credentials, put them in the config file, and schedule regular builds (without those flags) 
+     for the branches you want to support - which should be at least HEAD and the most recent stable branch.</li>
+</ul>
+
+<p>There is also some extra information in this 
+<a href="http://www.onlamp.com/pub/a/onlamp/2005/02/24/pg_buildfarm.html">article about buildfarm</a> on the O'Reilly network.</p>
+
+<hr />
+
+<p>Please complete all items.</p>
+<p>For Linux, please specify the name and version of the <b>Distribution</b> for the Operating Systems items. 
+Do not use the name "Linux". For example, for my test machine the Operating 
+Systems is "Fedora Core" and the version is "4".</p>
+<form method="post" action="/cgi-bin/register.pl">
+<table cellspacing="0">
+<tr>
+  <th>Operating System</th>
+  <td><input type="text" name="os" value="" /></td>
+</tr>
+<tr>
+  <th>OS Version</th>
+  <td><input type="text" name="osv" value="" /></td>
+</tr>
+<tr>
+  <th>Compiler</th>
+  <td><input type="text" name="comp" value="" /></td>
+</tr>
+<tr>
+  <th>Compiler Version</th>
+  <td><input type="text" name="compv" value="" /></td>
+</tr>
+<tr>
+  <th>Architecture</th>
+  <td><input type="text" name="arch" value="" /></td>
+</tr>
+<tr>
+  <th>Your name</th>
+  <td><input type="text" name="owner" value="" /></td>
+</tr>
+<tr>
+  <th>Your email address</th>
+  <td><input type="text" name="email" value="" /></td>
+</tr>
+<tr>
+  <th class="submit" colspan="2"><input type="submit" /></th>
+</tr>
+</table>
+</form>
+</div><!-- main -->
+<hr />
+<p style="text-align: center;">
+Hosting for the PostgreSQL Buildfarm is generously 
+provided by: 
+<a href="http://www.commandprompt.com">CommandPrompt, 
+The PostgreSQL Company</a>
+</p>
+</div><!-- wrapper -->
+</body>
+</html>
+
+
diff --git a/htdocs/robots.txt b/htdocs/robots.txt
new file mode 100644 (file)
index 0000000..1b425ee
--- /dev/null
@@ -0,0 +1,2 @@
+User-agent: *
+Disallow: /cgi-bin/
diff --git a/schema/bfwebdb.sql b/schema/bfwebdb.sql
new file mode 100644 (file)
index 0000000..36f61f3
--- /dev/null
@@ -0,0 +1,450 @@
+--
+-- PostgreSQL database dump
+--
+
+SET client_encoding = 'SQL_ASCII';
+SET check_function_bodies = false;
+SET client_min_messages = warning;
+
+--
+-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: pgbuildfarm
+--
+
+COMMENT ON SCHEMA public IS 'Standard public schema';
+
+
+SET search_path = public, pg_catalog;
+
+--
+-- Name: plperl_call_handler(); Type: FUNCTION; Schema: public; Owner: pgbuildfarm
+--
+
+CREATE FUNCTION plperl_call_handler() RETURNS language_handler
+    AS '$libdir/plperl', 'plperl_call_handler'
+    LANGUAGE c;
+
+
+ALTER FUNCTION public.plperl_call_handler() OWNER TO pgbuildfarm;
+
+--
+-- Name: plperl; Type: PROCEDURAL LANGUAGE; Schema: public; Owner: 
+--
+
+CREATE TRUSTED PROCEDURAL LANGUAGE plperl HANDLER plperl_call_handler;
+
+
+--
+-- Name: plperlu; Type: PROCEDURAL LANGUAGE; Schema: public; Owner: 
+--
+
+CREATE PROCEDURAL LANGUAGE plperlu HANDLER plperl_call_handler;
+
+
+--
+-- Name: plpgsql_call_handler(); Type: FUNCTION; Schema: public; Owner: pgbuildfarm
+--
+
+CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler
+    AS '$libdir/plpgsql', 'plpgsql_call_handler'
+    LANGUAGE c;
+
+
+ALTER FUNCTION public.plpgsql_call_handler() OWNER TO pgbuildfarm;
+
+--
+-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: public; Owner: 
+--
+
+CREATE TRUSTED PROCEDURAL LANGUAGE plpgsql HANDLER plpgsql_call_handler;
+
+
+--
+-- Name: pending; Type: TYPE; Schema: public; Owner: pgbuildfarm
+--
+
+CREATE TYPE pending AS (
+       name text,
+       operating_system text,
+       os_version text,
+       compiler text,
+       compiler_version text,
+       architecture text,
+       owner_email text
+);
+
+
+ALTER TYPE public.pending OWNER TO pgbuildfarm;
+
+--
+-- Name: pending2; Type: TYPE; Schema: public; Owner: pgbuildfarm
+--
+
+CREATE TYPE pending2 AS (
+       name text,
+       operating_system text,
+       os_version text,
+       compiler text,
+       compiler_version text,
+       architecture text,
+       owner_email text,
+       "owner" text,
+       status_ts timestamp without time zone
+);
+
+
+ALTER TYPE public.pending2 OWNER TO pgbuildfarm;
+
+--
+-- Name: approve(text, text); Type: FUNCTION; Schema: public; Owner: pgbuildfarm
+--
+
+CREATE FUNCTION approve(text, text) RETURNS void
+    AS $_$update buildsystems set name = $2, status ='approved' where name = $1 and status = 'pending'$_$
+    LANGUAGE sql;
+
+
+ALTER FUNCTION public.approve(text, text) OWNER TO pgbuildfarm;
+
+--
+-- Name: approve2(text, text); Type: FUNCTION; Schema: public; Owner: pgbuildfarm
+--
+
+CREATE FUNCTION approve2(text, text) RETURNS text
+    AS $_$ update buildsystems set name = $2, status = 'approved' where name = $1 and status = 'pending'; select owner_email || ':' || name || ':' || secret from buildsystems where name = $2;$_$
+    LANGUAGE sql;
+
+
+ALTER FUNCTION public.approve2(text, text) OWNER TO pgbuildfarm;
+
+--
+-- Name: pending(); Type: FUNCTION; Schema: public; Owner: pgbuildfarm
+--
+
+CREATE FUNCTION pending() RETURNS SETOF pending2
+    AS $$select name,operating_system,os_version,compiler,compiler_version,architecture,owner_email, sys_owner, status_ts from buildsystems where status = 'pending' order by status_ts $$
+    LANGUAGE sql;
+
+
+ALTER FUNCTION public.pending() OWNER TO pgbuildfarm;
+
+--
+-- Name: prevstat(text, text, timestamp without time zone); Type: FUNCTION; Schema: public; Owner: pgbuildfarm
+--
+
+CREATE FUNCTION prevstat(text, text, timestamp without time zone) RETURNS text
+    AS $_$
+   select coalesce((select distinct on (snapshot) stage
+                  from build_status
+                  where sysname = $1 and branch = $2 and snapshot < $3
+                  order by snapshot desc
+                  limit 1), 'NEW') as prev_status
+$_$
+    LANGUAGE sql;
+
+
+ALTER FUNCTION public.prevstat(text, text, timestamp without time zone) OWNER TO pgbuildfarm;
+
+SET default_tablespace = '';
+
+SET default_with_oids = true;
+
+--
+-- Name: alerts; Type: TABLE; Schema: public; Owner: pgbuildfarm; Tablespace: 
+--
+
+CREATE TABLE alerts (
+    sysname text NOT NULL,
+    branch text NOT NULL,
+    first_alert timestamp without time zone,
+    last_notification timestamp without time zone
+);
+
+
+ALTER TABLE public.alerts OWNER TO pgbuildfarm;
+
+--
+-- Name: build_status; Type: TABLE; Schema: public; Owner: pgbuildfarm; Tablespace: 
+--
+
+CREATE TABLE build_status (
+    sysname text NOT NULL,
+    snapshot timestamp without time zone NOT NULL,
+    status integer,
+    stage text,
+    log text,
+    conf_sum text,
+    branch text,
+    changed_this_run text,
+    changed_since_success text,
+    log_archive bytea,
+    log_archive_filenames text[],
+    build_flags text[],
+    report_time timestamp with time zone DEFAULT ('now'::text)::timestamp(6) with time zone
+);
+
+
+ALTER TABLE public.build_status OWNER TO pgbuildfarm;
+
+--
+-- Name: build_status_export; Type: VIEW; Schema: public; Owner: pgbuildfarm
+--
+
+CREATE VIEW build_status_export AS
+    SELECT build_status.sysname AS name, build_status.snapshot, build_status.stage, build_status.branch, build_status.build_flags FROM build_status;
+
+
+ALTER TABLE public.build_status_export OWNER TO pgbuildfarm;
+
+--
+-- Name: build_status_log; Type: TABLE; Schema: public; Owner: pgbuildfarm; Tablespace: 
+--
+
+CREATE TABLE build_status_log (
+    sysname text NOT NULL,
+    snapshot timestamp without time zone NOT NULL,
+    branch text NOT NULL,
+    log_stage text NOT NULL,
+    log_text text,
+    stage_duration interval
+);
+
+
+ALTER TABLE public.build_status_log OWNER TO pgbuildfarm;
+
+--
+-- Name: buildsystems; Type: TABLE; Schema: public; Owner: pgbuildfarm; Tablespace: 
+--
+
+CREATE TABLE buildsystems (
+    name text NOT NULL,
+    secret text NOT NULL,
+    operating_system text NOT NULL,
+    os_version text NOT NULL,
+    compiler text NOT NULL,
+    compiler_version text NOT NULL,
+    architecture text NOT NULL,
+    status text NOT NULL,
+    sys_owner text NOT NULL,
+    owner_email text NOT NULL,
+    status_ts timestamp without time zone DEFAULT (('now'::text)::timestamp(6) with time zone)::timestamp without time zone
+);
+
+
+ALTER TABLE public.buildsystems OWNER TO pgbuildfarm;
+
+--
+-- Name: buildsystems_export; Type: VIEW; Schema: public; Owner: pgbuildfarm
+--
+
+CREATE VIEW buildsystems_export AS
+    SELECT buildsystems.name, buildsystems.operating_system, buildsystems.os_version, buildsystems.compiler, buildsystems.compiler_version, buildsystems.architecture FROM buildsystems WHERE (buildsystems.status = 'approved'::text);
+
+
+ALTER TABLE public.buildsystems_export OWNER TO pgbuildfarm;
+
+--
+-- Name: list_subscriptions; Type: TABLE; Schema: public; Owner: pgbuildfarm; Tablespace: 
+--
+
+CREATE TABLE list_subscriptions (
+    addr text
+);
+
+
+ALTER TABLE public.list_subscriptions OWNER TO pgbuildfarm;
+
+--
+-- Name: penguin_save; Type: TABLE; Schema: public; Owner: pgbuildfarm; Tablespace: 
+--
+
+CREATE TABLE penguin_save (
+    branch text,
+    snapshot timestamp without time zone,
+    stage text
+);
+
+
+ALTER TABLE public.penguin_save OWNER TO pgbuildfarm;
+
+--
+-- Name: personality; Type: TABLE; Schema: public; Owner: pgbuildfarm; Tablespace: 
+--
+
+CREATE TABLE personality (
+    name text NOT NULL,
+    os_version text NOT NULL,
+    compiler_version text NOT NULL,
+    effective_date timestamp with time zone DEFAULT ('now'::text)::timestamp(6) with time zone NOT NULL
+);
+
+
+ALTER TABLE public.personality OWNER TO pgbuildfarm;
+
+--
+-- Name: alerts_pkey; Type: CONSTRAINT; Schema: public; Owner: pgbuildfarm; Tablespace: 
+--
+
+ALTER TABLE ONLY alerts
+    ADD CONSTRAINT alerts_pkey PRIMARY KEY (sysname, branch);
+
+
+ALTER INDEX public.alerts_pkey OWNER TO pgbuildfarm;
+
+--
+-- Name: build_status_log_pkey; Type: CONSTRAINT; Schema: public; Owner: pgbuildfarm; Tablespace: 
+--
+
+ALTER TABLE ONLY build_status_log
+    ADD CONSTRAINT build_status_log_pkey PRIMARY KEY (sysname, snapshot, log_stage);
+
+
+ALTER INDEX public.build_status_log_pkey OWNER TO pgbuildfarm;
+
+--
+-- Name: build_status_pkey; Type: CONSTRAINT; Schema: public; Owner: pgbuildfarm; Tablespace: 
+--
+
+ALTER TABLE ONLY build_status
+    ADD CONSTRAINT build_status_pkey PRIMARY KEY (sysname, snapshot);
+
+
+ALTER INDEX public.build_status_pkey OWNER TO pgbuildfarm;
+
+--
+-- Name: buildsystems_pkey; Type: CONSTRAINT; Schema: public; Owner: pgbuildfarm; Tablespace: 
+--
+
+ALTER TABLE ONLY buildsystems
+    ADD CONSTRAINT buildsystems_pkey PRIMARY KEY (name);
+
+
+ALTER INDEX public.buildsystems_pkey OWNER TO pgbuildfarm;
+
+--
+-- Name: personality_pkey; Type: CONSTRAINT; Schema: public; Owner: pgbuildfarm; Tablespace: 
+--
+
+ALTER TABLE ONLY personality
+    ADD CONSTRAINT personality_pkey PRIMARY KEY (name, effective_date);
+
+
+ALTER INDEX public.personality_pkey OWNER TO pgbuildfarm;
+
+--
+-- Name: bs_branch_snapshot_idx; Type: INDEX; Schema: public; Owner: pgbuildfarm; Tablespace: 
+--
+
+CREATE INDEX bs_branch_snapshot_idx ON build_status USING btree (branch, snapshot);
+
+
+ALTER INDEX public.bs_branch_snapshot_idx OWNER TO pgbuildfarm;
+
+--
+-- Name: bs_status_idx; Type: INDEX; Schema: public; Owner: pgbuildfarm; Tablespace: 
+--
+
+CREATE INDEX bs_status_idx ON buildsystems USING btree (status);
+
+
+ALTER INDEX public.bs_status_idx OWNER TO pgbuildfarm;
+
+--
+-- Name: bs_sysname_branch_idx; Type: INDEX; Schema: public; Owner: pgbuildfarm; Tablespace: 
+--
+
+CREATE INDEX bs_sysname_branch_idx ON build_status USING btree (sysname, branch);
+
+
+ALTER INDEX public.bs_sysname_branch_idx OWNER TO pgbuildfarm;
+
+--
+-- Name: bs_sysname_branch_report_idx; Type: INDEX; Schema: public; Owner: pgbuildfarm; Tablespace: 
+--
+
+CREATE INDEX bs_sysname_branch_report_idx ON build_status USING btree (sysname, branch, report_time);
+
+
+ALTER INDEX public.bs_sysname_branch_report_idx OWNER TO pgbuildfarm;
+
+--
+-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: pgbuildfarm
+--
+
+ALTER TABLE ONLY personality
+    ADD CONSTRAINT "$1" FOREIGN KEY (name) REFERENCES buildsystems(name) ON DELETE CASCADE;
+
+
+--
+-- Name: bs_fk; Type: FK CONSTRAINT; Schema: public; Owner: pgbuildfarm
+--
+
+ALTER TABLE ONLY build_status
+    ADD CONSTRAINT bs_fk FOREIGN KEY (sysname) REFERENCES buildsystems(name) ON UPDATE CASCADE ON DELETE CASCADE;
+
+
+--
+-- Name: build_status_log_sysname_fkey; Type: FK CONSTRAINT; Schema: public; Owner: pgbuildfarm
+--
+
+ALTER TABLE ONLY build_status_log
+    ADD CONSTRAINT build_status_log_sysname_fkey FOREIGN KEY (sysname, snapshot) REFERENCES build_status(sysname, snapshot) ON DELETE CASCADE;
+
+
+--
+-- Name: public; Type: ACL; Schema: -; Owner: pgbuildfarm
+--
+
+REVOKE ALL ON SCHEMA public FROM PUBLIC;
+REVOKE ALL ON SCHEMA public FROM pgbuildfarm;
+GRANT ALL ON SCHEMA public TO pgbuildfarm;
+GRANT ALL ON SCHEMA public TO PUBLIC;
+
+
+--
+-- Name: build_status; Type: ACL; Schema: public; Owner: pgbuildfarm
+--
+
+REVOKE ALL ON TABLE build_status FROM PUBLIC;
+REVOKE ALL ON TABLE build_status FROM pgbuildfarm;
+GRANT ALL ON TABLE build_status TO pgbuildfarm;
+GRANT INSERT,SELECT ON TABLE build_status TO pgbfweb;
+GRANT SELECT ON TABLE build_status TO rssfeed;
+
+
+--
+-- Name: build_status_log; Type: ACL; Schema: public; Owner: pgbuildfarm
+--
+
+REVOKE ALL ON TABLE build_status_log FROM PUBLIC;
+REVOKE ALL ON TABLE build_status_log FROM pgbuildfarm;
+GRANT ALL ON TABLE build_status_log TO pgbuildfarm;
+GRANT INSERT,SELECT,UPDATE,DELETE ON TABLE build_status_log TO pgbfweb;
+GRANT SELECT ON TABLE build_status_log TO rssfeed;
+
+
+--
+-- Name: buildsystems; Type: ACL; Schema: public; Owner: pgbuildfarm
+--
+
+REVOKE ALL ON TABLE buildsystems FROM PUBLIC;
+REVOKE ALL ON TABLE buildsystems FROM pgbuildfarm;
+GRANT ALL ON TABLE buildsystems TO pgbuildfarm;
+GRANT INSERT,SELECT ON TABLE buildsystems TO pgbfweb;
+GRANT SELECT ON TABLE buildsystems TO rssfeed;
+
+
+--
+-- Name: personality; Type: ACL; Schema: public; Owner: pgbuildfarm
+--
+
+REVOKE ALL ON TABLE personality FROM PUBLIC;
+REVOKE ALL ON TABLE personality FROM pgbuildfarm;
+GRANT ALL ON TABLE personality TO pgbuildfarm;
+GRANT INSERT,SELECT ON TABLE personality TO pgbfweb;
+GRANT SELECT ON TABLE personality TO rssfeed;
+
+
+--
+-- PostgreSQL database dump complete
+--
+
diff --git a/templates/bfwrapper.tt b/templates/bfwrapper.tt
new file mode 100644 (file)
index 0000000..cb95ef9
--- /dev/null
@@ -0,0 +1,49 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+    <title>PostgreSQL BuildFarm Status</title>
+    <link rel="stylesheet" rev="stylesheet" href="/inc/pgbf.css" charset="utf-8"
+ />
+    <style type="text/css"><!--
+    li#status a { color:rgb(17,45,137); background: url(/inc/b/r.png) no-repeat 
+100% -20px; } 
+    li#status { background: url(/inc/b/l.png) no-repeat 0% -20px; }
+    --></style>
+</head>
+<body>
+<div id="wrapper">
+<div id="banner">
+<a href="/index.html"><img src="/inc/pgbuildfarm-banner.png" alt="PostgreSQL Bui
+ldFarm" width="800" height="73" /></a>
+<div id="nav">
+<ul>
+    <li id="home"><a href="/index.html" title="PostgreSQL BuildFarm Home">Home</
+a></li>
+    <li id="status"><a href="/cgi-bin/show_status.pl" title="Current results">St
+atus</a></li>
+    <li id="members"><a href="/cgi-bin/show_members.pl" title="Platforms tested"
+>Members</a></li>
+    <li id="register"><a href="/register.html" title="Join PostgreSQL BuildFarm"
+>Register</a></li>
+    <li id="pgfoundry"><a href="http://pgfoundry.org/projects/pgbuildfarm/">PGFo
+undry</a></li>
+    <li id="postgresql.org"><a href="http://www.postgresql.org">PostgreSQL.org</
+a></li>
+</ul>
+</div><!-- nav -->
+</div><!-- banner -->
+<div id="main">
+[% content %]
+</div><!-- main -->
+<hr />
+<p style="text-align: center;">
+Hosting for the PostgreSQL Buildfarm is generously 
+provided by: 
+<a href="http://www.commandprompt.com">CommandPrompt, 
+The PostgreSQL Company</a>
+</p>
+</div><!-- wrapper -->
+  </body>
+</html>
diff --git a/templates/bfwrapper.tt.ttc b/templates/bfwrapper.tt.ttc
new file mode 100644 (file)
index 0000000..19faeb3
--- /dev/null
@@ -0,0 +1,32 @@
+#------------------------------------------------------------------------
+# Compiled template generated by the Template Toolkit version 2.14
+#------------------------------------------------------------------------
+
+Template::Document->new({
+    METADATA => {
+        'modtime' => '1107104454',
+        'name' => 'bfwrapper.tt',
+    },
+    BLOCK => sub {
+        my $context = shift || die "template sub called without context\n";
+        my $stash   = $context->stash;
+        my $output  = '';
+        my $error;
+        
+        eval { BLOCK: {
+    $output .=  "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n        \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n<head>\n    <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />\n    <title>PostgreSQL BuildFarm Status</title>\n    <link rel=\"stylesheet\" rev=\"stylesheet\" href=\"/inc/pgbf.css\" charset=\"utf-8\"\n />\n    <style type=\"text/css\"><!--\n    li#status a { color:rgb(17,45,137); background: url(/inc/b/r.png) no-repeat \n100% -20px; } \n    li#status { background: url(/inc/b/l.png) no-repeat 0% -20px; }\n    --></style>\n</head>\n<body>\n<div id=\"wrapper\">\n<div id=\"banner\">\n<a href=\"/index.html\"><img src=\"/inc/pgbuildfarm-banner.png\" alt=\"PostgreSQL Bui\nldFarm\" width=\"800\" height=\"73\" /></a>\n<div id=\"nav\">\n<ul>\n    <li id=\"home\"><a href=\"/index.html\" title=\"PostgreSQL BuildFarm Home\">Home</\na></li>\n    <li id=\"status\"><a href=\"/cgi-bin/show_status.pl\" title=\"Current results\">St\natus</a></li>\n    <li id=\"members\"><a href=\"/cgi-bin/show_members.pl\" title=\"Platforms tested\"\n>Members</a></li>\n    <li id=\"register\"><a href=\"/register.html\" title=\"Join PostgreSQL BuildFarm\"\n>Register</a></li>\n    <li id=\"pgfoundry\"><a href=\"http://pgfoundry.org/projects/pgbuildfarm/\">PGFo\nundry</a></li>\n    <li id=\"postgresql.org\"><a href=\"http://www.postgresql.org\">PostgreSQL.org</\na></li>\n</ul>\n</div><!-- nav -->\n</div><!-- banner -->\n<div id=\"main\">\n";
+    #line 38 "/home/community/pgbuildfarm/templates/bfwrapper.tt"
+    $output .=  $stash->get('content');
+    $output .=  "\n</div><!-- main -->\n</div><!-- wrapper -->\n  </body>\n</html>\n";
+        } };
+        if ($@) {
+            $error = $context->catch($@, \$output);
+            die $error unless $error->type eq 'return';
+        }
+    
+        return $output;
+    },
+    DEFBLOCKS => {
+
+    },
+});
diff --git a/templates/dashboard.tt b/templates/dashboard.tt
new file mode 100644 (file)
index 0000000..e7e7ee0
--- /dev/null
@@ -0,0 +1,77 @@
+[%
+ flag_imgs = {
+     perl = '/img/camel.png',
+     python = '/img/python.png',
+     debug = '/img/bug.png',
+     pam => '/img/pam.png',
+     cassert => '/img/cassert.png',
+     openssl => '/img/ssl_icon.gif',
+     nls => '/img/translateicon.gif',
+     krb5 => '/img/krb.gif',
+     tcl => '/img/tcl.png',
+     'thread-safety' => '/img/threads.gif',
+     'integer-datetimes' = '/img/days.png',
+     }
+-%]
+[%-  BLOCK img ; 
+       IF flag == 'depend' or flag == 'gnu-ld' ; ; 
+       ELSIF flag_imgs.$flag ; 
+          FILTER collapse %]<img src="[% flag_imgs.$flag %]" 
+                               title="[% flag %]" alt="[% flag %]" 
+                               height="16" width="16" class="inline" align="bottom" />  
+       [%  END ;
+        END; 
+     END 
+-%]
+[%- BLOCK cl %] class="[% SWITCH bgfor -%]
+  [%- CASE 'OK' %]pass[% CASE 'ContribCheck' %]warn[% CASE [ 'Check' 'InstallCheck' ] %]warnx[% CASE %]fail[% END %]"
+[%- END -%]
+
+<div id="main">
+    <h1>PostgreSQL BuildFarm Status</h1>
+    <p>
+      Shown here is the latest status of each farm member 
+      for each branch it has reported on in the last 30 days.
+    </p>
+    <p>
+       Use the farm member link for history of that member 
+       on the relevant branch.
+    </p>
+<table><tr><th class="head" rowspan="2">Legend</th>
+[% FOREACH flagset IN flag_imgs %]
+<td><img src="[% flagset.value %]" title="[% flagset.key %]" alt="[% flagset.key %]" height="16" width="16" class="inline"  align="center"/> =  [% flagset.key %]</td>
+[% IF loop.count == 5 %]</tr><tr>[% END %]
+[% END %]
+</tr></table>
+<br />
+    <table cellspacing="0">
+[% brch = "" %]
+[% FOREACH row IN statrows %]
+[% IF row.branch != brch ; brch = row.branch %]
+<tr><th class="head" colspan="4">Branch: [% brch %]</th></tr>
+<tr><th>Alias</th><th>System</th><th>Status</th><th>Flags</th></tr>
+[% END %]
+<tr [% PROCESS cl bgfor=row.stage %]>
+    <td><a 
+    href="show_history.pl?nm=[% row.sysname %]&amp;br=[% row.branch %]"
+    title="History"
+    >[% row.sysname %]</a></td>
+    <td><span class="opsys">[% row.operating_system %]
+            [% row.os_version %]</span> <span class="compiler">
+            [%- row.compiler %]
+            [% row.compiler_version %]</span> <span class="arch">
+            [%- row.architecture %]</span></td>
+    <td class="status">
+            [%- row.when_ago | replace('\s','&nbsp;') %]&nbsp;ago&nbsp;
+            [% row.stage -%]
+            <a href="show_log.pl?nm=
+               [%- row.sysname %]&amp;dt=
+               [%- row.snapshot | uri %]">
+                [%- IF row.stage != 'OK' %]Details[% ELSE %]Config[% END -%]</a></td>
+
+    <td class="flags">[% FOREACH flag IN row.build_flags.split().sort() ; PROCESS img ; END %]</td>
+</tr>
+[% END %]
+    </table>
+</div>
+
diff --git a/templates/dashboard.tt.ttc b/templates/dashboard.tt.ttc
new file mode 100644 (file)
index 0000000..91c772a
--- /dev/null
@@ -0,0 +1,312 @@
+#------------------------------------------------------------------------
+# Compiled template generated by the Template Toolkit version 2.14
+#------------------------------------------------------------------------
+
+Template::Document->new({
+    METADATA => {
+        'modtime' => '1127835909',
+        'name' => 'dashboard.tt',
+    },
+    BLOCK => sub {
+        my $context = shift || die "template sub called without context\n";
+        my $stash   = $context->stash;
+        my $output  = '';
+        my $error;
+        
+        eval { BLOCK: {
+    #line 1 "/home/community/pgbuildfarm/templates/dashboard.tt"
+    $stash->set('flag_imgs', { 'perl' => '/img/camel.png', 'python' => '/img/python.png', 'debug' => '/img/bug.png', 'pam' => '/img/pam.png', 'cassert' => '/img/cassert.png', 'openssl' => '/img/ssl_icon.gif', 'nls' => '/img/translateicon.gif', 'krb5' => '/img/krb.gif', 'tcl' => '/img/tcl.png', 'thread-safety' => '/img/threads.gif', 'integer-datetimes' => '/img/days.png'  });
+    
+    
+    $output .=  "\n<div id=\"main\">\n    <h1>PostgreSQL BuildFarm Status</h1>\n    <p>\n      Shown here is the latest status of each farm member \n      for each branch it has reported on in the last 30 days.\n    </p>\n    <p>\n       Use the farm member link for history of that member \n       on the relevant branch.\n    </p>\n<table><tr><th class=\"head\" rowspan=\"2\">Legend</th>\n";
+    #line 45 "/home/community/pgbuildfarm/templates/dashboard.tt"
+    
+    # FOREACH 
+    do {
+        my ($value, $error, $oldloop);
+        my $list = $stash->get('flag_imgs');
+        
+        unless (UNIVERSAL::isa($list, 'Template::Iterator')) {
+            $list = Template::Config->iterator($list)
+                || die $Template::Config::ERROR, "\n"; 
+        }
+    
+        ($value, $error) = $list->get_first();
+        eval { $oldloop = $stash->get('loop') };
+        $stash->set('loop', $list);
+        eval {
+    LOOP:   while (! $error) {
+                $stash->{'flagset'} = $value;
+    $output .=  "\n<td><img src=\"";
+    #line 43 "/home/community/pgbuildfarm/templates/dashboard.tt"
+    $output .=  $stash->get(['flagset', 0, 'value', 0]);
+    $output .=  "\" title=\"";
+    #line 43 "/home/community/pgbuildfarm/templates/dashboard.tt"
+    $output .=  $stash->get(['flagset', 0, 'key', 0]);
+    $output .=  "\" alt=\"";
+    #line 43 "/home/community/pgbuildfarm/templates/dashboard.tt"
+    $output .=  $stash->get(['flagset', 0, 'key', 0]);
+    $output .=  "\" height=\"16\" width=\"16\" class=\"inline\"  align=\"center\"/> =  ";
+    #line 43 "/home/community/pgbuildfarm/templates/dashboard.tt"
+    $output .=  $stash->get(['flagset', 0, 'key', 0]);
+    $output .=  "</td>\n";
+    #line 44 "/home/community/pgbuildfarm/templates/dashboard.tt"
+    if ($stash->get(['loop', 0, 'count', 0]) eq 5) {
+    $output .=  "</tr><tr>";
+    }
+    
+    $output .=  "\n";;
+                ($value, $error) = $list->get_next();
+            }
+        };
+        $stash->set('loop', $oldloop);
+        die $@ if $@;
+        $error = 0 if $error && $error eq Template::Constants::STATUS_DONE;
+        die $error if $error;
+    };
+    
+    $output .=  "\n</tr></table>\n<br />\n    <table cellspacing=\"0\">\n";
+    #line 49 "/home/community/pgbuildfarm/templates/dashboard.tt"
+    $stash->set('brch', '');
+    $output .=  "\n";
+    #line 81 "/home/community/pgbuildfarm/templates/dashboard.tt"
+    
+    # FOREACH 
+    do {
+        my ($value, $error, $oldloop);
+        my $list = $stash->get('statrows');
+        
+        unless (UNIVERSAL::isa($list, 'Template::Iterator')) {
+            $list = Template::Config->iterator($list)
+                || die $Template::Config::ERROR, "\n"; 
+        }
+    
+        ($value, $error) = $list->get_first();
+        eval { $oldloop = $stash->get('loop') };
+        $stash->set('loop', $list);
+        eval {
+    LOOP:   while (! $error) {
+                $stash->{'row'} = $value;
+    $output .=  "\n";
+    #line 54 "/home/community/pgbuildfarm/templates/dashboard.tt"
+    if ($stash->get(['row', 0, 'branch', 0]) ne $stash->get('brch')) {
+    #line 51 "/home/community/pgbuildfarm/templates/dashboard.tt"
+    $stash->set('brch', $stash->get(['row', 0, 'branch', 0]));
+    $output .=  "\n<tr><th class=\"head\" colspan=\"4\">Branch: ";
+    #line 52 "/home/community/pgbuildfarm/templates/dashboard.tt"
+    $output .=  $stash->get('brch');
+    $output .=  "</th></tr>\n<tr><th>Alias</th><th>System</th><th>Status</th><th>Flags</th></tr>\n";
+    }
+    
+    $output .=  "\n<tr ";
+    #line 55 "/home/community/pgbuildfarm/templates/dashboard.tt"
+    $output .=  $context->process('cl', { 'bgfor' => $stash->get(['row', 0, 'stage', 0]) });
+    $output .=  ">\n    <td><a \n    href=\"show_history.pl?nm=";
+    #line 57 "/home/community/pgbuildfarm/templates/dashboard.tt"
+    $output .=  $stash->get(['row', 0, 'sysname', 0]);
+    $output .=  "&amp;br=";
+    #line 57 "/home/community/pgbuildfarm/templates/dashboard.tt"
+    $output .=  $stash->get(['row', 0, 'branch', 0]);
+    $output .=  "\"\n    title=\"History\"\n    >";
+    #line 59 "/home/community/pgbuildfarm/templates/dashboard.tt"
+    $output .=  $stash->get(['row', 0, 'sysname', 0]);
+    $output .=  "</a></td>\n    <td><span class=\"opsys\">";
+    #line 60 "/home/community/pgbuildfarm/templates/dashboard.tt"
+    $output .=  $stash->get(['row', 0, 'operating_system', 0]);
+    $output .=  "\n            ";
+    #line 61 "/home/community/pgbuildfarm/templates/dashboard.tt"
+    $output .=  $stash->get(['row', 0, 'os_version', 0]);
+    $output .=  "</span> <span class=\"compiler\">";
+    #line 63 "/home/community/pgbuildfarm/templates/dashboard.tt"
+    $output .=  $stash->get(['row', 0, 'compiler', 0]);
+    $output .=  "\n            ";
+    #line 64 "/home/community/pgbuildfarm/templates/dashboard.tt"
+    $output .=  $stash->get(['row', 0, 'compiler_version', 0]);
+    $output .=  "</span> <span class=\"arch\">";
+    #line 66 "/home/community/pgbuildfarm/templates/dashboard.tt"
+    $output .=  $stash->get(['row', 0, 'architecture', 0]);
+    $output .=  "</span></td>\n    <td class=\"status\">";
+    #line 69 "/home/community/pgbuildfarm/templates/dashboard.tt"
+    
+    # FILTER
+    $output .=  do {
+        my $output = '';
+        my $filter = $context->filter('replace', [ '\s', '&nbsp;' ])
+                  || $context->throw($context->error);
+    
+    $output .=  $stash->get(['row', 0, 'when_ago', 0]);
+        
+        &$filter($output);
+    };
+    
+    $output .=  "&nbsp;ago&nbsp;\n            ";
+    #line 70 "/home/community/pgbuildfarm/templates/dashboard.tt"
+    $output .=  $stash->get(['row', 0, 'stage', 0]);
+    $output .=  "            <a href=\"show_log.pl?nm=";
+    #line 73 "/home/community/pgbuildfarm/templates/dashboard.tt"
+    $output .=  $stash->get(['row', 0, 'sysname', 0]);
+    $output .=  "&amp;dt=";
+    #line 75 "/home/community/pgbuildfarm/templates/dashboard.tt"
+    
+    # FILTER
+    $output .=  do {
+        my $output = '';
+        my $filter = $context->filter('uri')
+                  || $context->throw($context->error);
+    
+    $output .=  $stash->get(['row', 0, 'snapshot', 0]);
+        
+        &$filter($output);
+    };
+    
+    $output .=  "\">";
+    #line 77 "/home/community/pgbuildfarm/templates/dashboard.tt"
+    if ($stash->get(['row', 0, 'stage', 0]) ne 'OK') {
+    $output .=  "Details";
+    }
+    else {
+    $output .=  "Config";
+    }
+    
+    $output .=  "</a></td>\n\n    <td class=\"flags\">";
+    #line 79 "/home/community/pgbuildfarm/templates/dashboard.tt"
+    
+    # FOREACH 
+    do {
+        my ($value, $error, $oldloop);
+        my $list = $stash->get(['row', 0, 'build_flags', 0, 'split', 0, 'sort', 0]);
+        
+        unless (UNIVERSAL::isa($list, 'Template::Iterator')) {
+            $list = Template::Config->iterator($list)
+                || die $Template::Config::ERROR, "\n"; 
+        }
+    
+        ($value, $error) = $list->get_first();
+        eval { $oldloop = $stash->get('loop') };
+        $stash->set('loop', $list);
+        eval {
+    LOOP:   while (! $error) {
+                $stash->{'flag'} = $value;
+    #line 79 "/home/community/pgbuildfarm/templates/dashboard.tt"
+    $output .=  $context->process('img');;
+                ($value, $error) = $list->get_next();
+            }
+        };
+        $stash->set('loop', $oldloop);
+        die $@ if $@;
+        $error = 0 if $error && $error eq Template::Constants::STATUS_DONE;
+        die $error if $error;
+    };
+    
+    $output .=  "</td>\n</tr>\n";;
+                ($value, $error) = $list->get_next();
+            }
+        };
+        $stash->set('loop', $oldloop);
+        die $@ if $@;
+        $error = 0 if $error && $error eq Template::Constants::STATUS_DONE;
+        die $error if $error;
+    };
+    
+    $output .=  "\n    </table>\n</div>\n\n";
+        } };
+        if ($@) {
+            $error = $context->catch($@, \$output);
+            die $error unless $error->type eq 'return';
+        }
+    
+        return $output;
+    },
+    DEFBLOCKS => {
+        'cl' => sub {
+            my $context = shift || die "template sub called without context\n";
+            my $stash   = $context->stash;
+            my $output  = '';
+            my $error;
+            
+            eval { BLOCK: {
+        $output .=  " class=\"";
+        #line 27 "/home/community/pgbuildfarm/templates/dashboard.tt"
+        
+        # SWITCH
+        do {
+            my $result = $stash->get('bgfor');
+            my $match;
+            SWITCH: {
+        $match = 'OK';
+        $match = [ $match ] unless ref $match eq 'ARRAY';
+        if (grep(/^$result$/, @$match)) {
+        $output .=  "pass";
+            last SWITCH;
+        }
+        $match = 'ContribCheck';
+        $match = [ $match ] unless ref $match eq 'ARRAY';
+        if (grep(/^$result$/, @$match)) {
+        $output .=  "warn";
+            last SWITCH;
+        }
+        $match = [ 'Check', 'InstallCheck' ];
+        $match = [ $match ] unless ref $match eq 'ARRAY';
+        if (grep(/^$result$/, @$match)) {
+        $output .=  "warnx";
+            last SWITCH;
+        }
+        $output .=  "fail";
+            }
+        };
+        
+        $output .=  "\"";
+            } };
+            if ($@) {
+                $error = $context->catch($@, \$output);
+                die $error unless $error->type eq 'return';
+            }
+        
+            return $output;
+        },
+        'img' => sub {
+            my $context = shift || die "template sub called without context\n";
+            my $stash   = $context->stash;
+            my $output  = '';
+            my $error;
+            
+            eval { BLOCK: {
+        #line 22 "/home/community/pgbuildfarm/templates/dashboard.tt"
+        if ($stash->get('flag') eq 'depend' || $stash->get('flag') eq 'gnu-ld') {
+        
+        }
+        elsif ($stash->get(['flag_imgs', 0, $stash->get('flag'), 0])) {
+        #line 22 "/home/community/pgbuildfarm/templates/dashboard.tt"
+        
+        # FILTER
+        $output .=  do {
+            my $output = '';
+            my $filter = $context->filter('collapse')
+                      || $context->throw($context->error);
+        
+        $output .=  "<img src=\"";
+        #line 19 "/home/community/pgbuildfarm/templates/dashboard.tt"
+        $output .=  $stash->get(['flag_imgs', 0, $stash->get('flag'), 0]);
+        $output .=  "\" \n                             title=\"";
+        #line 20 "/home/community/pgbuildfarm/templates/dashboard.tt"
+        $output .=  $stash->get('flag');
+        $output .=  "\" alt=\"";
+        #line 20 "/home/community/pgbuildfarm/templates/dashboard.tt"
+        $output .=  $stash->get('flag');
+        $output .=  "\" \n                             height=\"16\" width=\"16\" class=\"inline\" align=\"bottom\" />  \n     ";
+            
+            &$filter($output);
+        };
+        
+        }
+        
+            } };
+            if ($@) {
+                $error = $context->catch($@, \$output);
+                die $error unless $error->type eq 'return';
+            }
+        
+            return $output;
+        },
+    },
+});
diff --git a/templates/dyn/history.tt b/templates/dyn/history.tt
new file mode 100644 (file)
index 0000000..402a932
--- /dev/null
@@ -0,0 +1,69 @@
+[%- BLOCK cl %] class="[% SWITCH bgfor -%]
+  [%- CASE 'OK' %]pass[% CASE 'ContribCheck' %]warn[% CASE [ 'Check' 'InstallCheck' ] %]warnx[% CASE %]fail[% END %]"
+[%- END -%]
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+       <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+    <title>PostgreSQL BuildFarm History</title>
+    <link rel="stylesheet" rev="stylesheet" href="/inc/pgbf.css" charset="utf-8" />
+       <style type="text/css"><!--
+       li#status a { color:rgb(17,45,137); background: url(/inc/b/r.png) no-repeat 100% -20px; } 
+       li#status { background: url(/inc/b/l.png) no-repeat 0% -20px; }
+       --></style>
+</head>
+<body class="history">
+<div id="wrapper">
+<div id="banner">
+<a href="/index.html"><img src="/inc/pgbuildfarm-banner.png" alt="PostgreSQL BuildFarm" width="800" height="73" /></a>
+<div id="nav">
+<ul>
+    <li id="home"><a href="/index.html" title="PostgreSQL BuildFarm Home">Home</a></li>
+    <li id="status"><a href="/cgi-bin/show_status.pl" title="Current results">Status</a></li>
+    <li id="members"><a href="/cgi-bin/show_members.pl" title="Platforms tested">Members</a></li>
+    <li id="register"><a href="/register.html" title="Join PostgreSQL BuildFarm">Register</a></li>
+    <li id="pgfoundry"><a href="http://pgfoundry.org/projects/pgbuildfarm/">PGFoundry</a></li>
+</ul>
+</div><!-- nav -->
+</div><!-- banner -->
+<div id="main">
+<h1>PostgreSQL BuildFarm Status History</h1>
+<table cellspacing="0">
+    <tr><th class="head" colspan="3">System Detail</th></tr>
+    <tr class="member"><th>Farm member</th><td>[% member %]</td></tr>
+    <tr><th>OS</th><td>[% statrows.0.operating_system %] [% statrows.0.os_version %]</td></tr>
+<!--    <tr><th>OS Version</th><td>[% statrows.0.os_version %]</td></tr> -->
+    <tr><th>Compiler</th><td>[% statrows.0.compiler %] [% statrows.0.compiler_version %]</td></tr>
+<!--    <tr><th>Compiler Version</th><td>[% statrows.0.compiler_version %]</td></tr> -->
+    <tr><th>Architecture</th><td>[% statrows.0.architecture %]</td></tr>
+    </table>
+    <h3>Branch: [% branch %][% IF statrows.size >= 240 %] (last 240 entries shown)[% END %]</h3>
+[% BLOCK stdet %]
+<tr [% PROCESS cl bgfor=row.stage %]>
+    <td>[%- row.when_ago | replace('\s','&nbsp;') %]&nbsp;ago&nbsp;</td>
+    <td class="status">[% row.stage -%]</td>
+    <td class="status"><a href="show_log.pl?nm=
+               [%- row.sysname %]&amp;dt=
+               [%- row.snapshot | uri %]">
+                [%- IF row.stage != 'OK' %]Details[% ELSE %]Config[% END -%]</a></td>
+
+</tr>
+[% END %]
+<table border="0"> <tr>
+[% FOREACH offset IN [0,1,2] %][% low = offset * statrows.size / 3 ; high = -1 + (offset + 1) * statrows.size / 3 %] 
+[% TRY %][% PERL %] 
+  use POSIX qw(floor); 
+  $stash->set(low => floor($stash->get('low'))); 
+  $stash->set(high => floor($stash->get('high'))); 
+[% END %][% CATCH %]<!-- [% error.info %] --> [% END %]
+    <td><table cellspacing="0">
+<!--      <tr><th colspan=3>low = [% low %], high = [% high %]</th></tr> -->
+        [% FOREACH xrow IN statrows.slice(low,high) %][% PROCESS stdet row=xrow %][% END %]
+    </table></td>
+[% END %]
+</table>
+    </div><!-- main -->
+    </div><!-- wrapper -->
+  </body>
+</html>
diff --git a/templates/dyn/status.tt b/templates/dyn/status.tt
new file mode 100644 (file)
index 0000000..17ee2ac
--- /dev/null
@@ -0,0 +1,80 @@
+[%- BLOCK cl %] class=" [% SWITCH bgfor -%]
+  [%- CASE 'OK' %]pass[% CASE 'ContribCheck' %]warn[% CASE [ 'Check' 'InstallCheck' ] %]warnx[% CASE %]fail[% END %]"
+[%- END -%]
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+       <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+    <title>PostgreSQL BuildFarm Status</title>
+    <link rel="stylesheet" rev="stylesheet" href="/inc/pgbf.css" charset="utf-8" />
+       <style type="text/css"><!--
+       li#status a { color:rgb(17,45,137); background: url(/inc/b/r.png) no-repeat 100% -20px; } 
+       li#status { background: url(/inc/b/l.png) no-repeat 0% -20px; }
+       --></style>
+</head>
+<body>
+<div id="wrapper">
+<div id="banner">
+<a href="/index.html"><img src="/inc/pgbuildfarm-banner.png" alt="PostgreSQL BuildFarm" width="800" height="73" /></a>
+<div id="nav">
+<ul>
+    <li id="home"><a href="/index.html" title="PostgreSQL BuildFarm Home">Home</a></li>
+    <li id="status"><a href="/cgi-bin/show_status.pl" title="Current results">Status</a></li>
+    <li id="members"><a href="/cgi-bin/show_members.pl" title="Platforms tested">Members</a></li>
+    <li id="register"><a href="/register.html" title="Join PostgreSQL BuildFarm">Register</a></li>
+    <li id="pgfoundry"><a href="http://pgfoundry.org/projects/pgbuildfarm/">PGFoundry</a></li>
+    <li id="postgresql.org"><a href="http://www.postgresql.org">PostgreSQL.org</a></li>
+</ul>
+</div><!-- nav -->
+</div><!-- banner -->
+<div id="main">
+    <h1>PostgreSQL BuildFarm Status</h1>
+    <p>
+      Shown here is the latest status of each farm member 
+      for each branch it has reported on in the last 30 days.
+    </p>
+    <p>
+       Use the farm member link for history of that member 
+       on the relevant branch.
+    </p>
+    <table cellspacing="0">
+[% brch = "" %]
+[% FOREACH row IN statrows %]
+[% IF row.branch != brch ; brch = row.branch %]
+<tr><th class="head" colspan="3">Branch: [% brch %]</th></tr>
+<tr><th>Alias</th><th>System</th><th>Status</th></tr>
+[% END %]
+<tr [% PROCESS cl bgfor=row.stage %]>
+    <td><a 
+    href="show_history.pl?nm=[% row.sysname %]&amp;br=[% row.branch %]"
+    title="History"
+    >[% row.sysname %]</a></td>
+    <td><span class="opsys">[% row.operating_system %]
+            [% row.os_version %]</span> <span class="compiler">
+            [%- row.compiler %]
+            [% row.compiler_version %]</span> <span class="arch">
+            [%- row.architecture %]</span></td>
+    <td class="status">
+            [%- row.when_ago | replace('\s','&nbsp;') %]&nbsp;ago&nbsp;
+            [% row.stage -%]
+            <a href="show_log.pl?nm=
+               [%- row.sysname %]&amp;dt=
+               [%- row.snapshot | uri %]">
+                [%- IF row.stage != 'OK' %]Details[% ELSE %]Config[% END -%]</a></td>
+
+</tr>
+[% END %]
+    </table>
+</div><!-- main -->
+</div><!-- wrapper -->
+  </body>
+</html>
+
+
+
+
+
+
+
+