From: Andrew Dunstan Date: Tue, 19 Oct 2010 17:22:19 +0000 (+0000) Subject: fix organization X-Git-Url: https://git.exim.org/buildfarm-server.git/commitdiff_plain/de61618de37c2e0b4ed7b972a73ceba0f169fe09 fix organization --- diff --git a/bf-alerts.pl b/bf-alerts.pl deleted file mode 100755 index c118cc4..0000000 --- a/bf-alerts.pl +++ /dev/null @@ -1,272 +0,0 @@ -#!/usr/bin/perl - -use strict; - -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; - -# don't use configged dbuser/dbpass - -$dbuser=""; $dbpass=""; - -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 $clear_old = $db->do(q[ - - DELETE FROM alerts - WHERE sysname IN - (SELECT name FROM buildsystems WHERE no_alerts) - ]); - - -my $sth = $db->prepare(q[ - - SELECT DISTINCT ON (sysname, branch) - sysname, branch, - extract(epoch from snapshot at time zone 'GMT')::int as snapshot, - conf_sum as config - FROM build_status s join buildsystems b on (s.sysname = b.name) - WHERE NOT b.no_alerts and - snapshot > current_timestamp - interval '30 days' - ORDER BY sysname, branch, snapshot desc - - ]); - -$sth->execute; - -my @last_heard; - -while (my $row = $sth->fetchrow_hashref) -{ - push(@last_heard, $row); -} - -$sth->finish; - -my $sql = q[ - - SELECT sysname, branch, - extract(epoch from first_alert) as first_alert, - extract(epoch from last_notification) as last_notification - FROM alerts - - ]; - -my $alerts = $db->selectall_hashref($sql,['sysname','branch']); - -my @need_cleared; -my @need_alerts; - -my $clear_sth = $db->prepare(q[ - - DELETE FROM alerts - WHERE sysname = ? - AND branch = ? - ]); - -my $update_sth = $db->prepare(q[ - - UPDATE alerts - SET last_notification = timestamp '1970-01-01' + ( interval '1 second' * $1) - WHERE sysname = $2 - AND branch = $3 - ]); - -my $insert_sth = $db->prepare(q[ - - INSERT INTO alerts ( sysname, branch, first_alert, last_notification ) - VALUES ($1, $2, - timestamp '1970-01-01' + ( interval '1 second' * $3), - timestamp '1970-01-01' + ( interval '1 second' * $4)) - ]); - - -my $now = time; -my $lts = scalar(localtime); -print "starting alert run: $lts\n"; - -foreach my $sysbranch (@last_heard) -{ - # eval the config in a Safe container to protect ourselves - my $container = new Safe; - my $sconf = $sysbranch->{config}; - unless ($sconf =~ s/.*(\$Script_Config)/$1/ms ) - { - $sconf = '$Script_Config={};'; - } - my $client_conf = $container->reval("$sconf;"); - - my %client_alert_settings = %{ $client_conf->{alerts} || {} }; - my $setting = $client_alert_settings{$sysbranch->{branch}}; - unless ($setting && $setting->{alert_after} && $setting->{alert_every}) - { - # if no valid setting, clear any alert and keep going - if ($alerts->{$sysbranch->{sysname}}->{$sysbranch->{branch}}) - { - $clear_sth->execute($sysbranch->{sysname},$sysbranch->{branch}); - push(@need_cleared,[$sysbranch]); - } - next; - } - # ok, we have valid settings. should the alert be on? - my $hours_since_heard = ($now - $sysbranch->{snapshot}) / 3600; - # yep - print - "have settings for $sysbranch->{sysname}:$sysbranch->{branch} ", - "hours since heard = $hours_since_heard, ", - "setting = $setting->{alert_after} / $setting->{alert_every} \n"; - - if ($hours_since_heard > $setting->{alert_after}) - { - my $known_alert = - $alerts->{$sysbranch->{sysname}}->{$sysbranch->{branch}}; - if ($known_alert && - ($now - (3600 * $setting->{alert_every})) > - $known_alert->{last_notification}) - { - # check if it's too old - 15 days and twice initial seems plenty - if ($hours_since_heard > 360 && - $hours_since_heard > 2 * $setting->{alert_after} ) - { - print "alert is too old ... giving up\n"; - next; - } - - # old alert, but time to alert again - print "alert is on, but time to alert again\n"; - $update_sth->execute($now, - $sysbranch->{sysname}, - $sysbranch->{branch}, - ); - push(@need_alerts,[$sysbranch,$setting]); - print "alert updated\n"; - } - elsif ( ! $known_alert ) - { - # new alert - print "new alert needed\n"; - $insert_sth->execute($sysbranch->{sysname}, - $sysbranch->{branch}, - $now,$now); - print "new record inserted\n"; - push(@need_alerts,[$sysbranch,$setting]); - } - } - # nope, so clear the alert if it exists - elsif ($alerts->{$sysbranch->{sysname}}->{$sysbranch->{branch}}) - { - print "clear exisiting alerts"; - $clear_sth->execute($sysbranch->{sysname},$sysbranch->{branch}); - push(@need_cleared,[$sysbranch,$setting]); - } - -} - -print "start emails\n"; - -my $addr_sth = $db->prepare(q[ - - SELECT owner_email - FROM buildsystems - WHERE name = ? - ]); - - -my $me = `id -un`; chomp $me; - -my $host = `hostname`; chomp $host; - - - -foreach my $clearme (@need_cleared) -{ - my ($sysbranch, $setting) = @$clearme; - my ($animal, $branch) = ($sysbranch->{sysname},$sysbranch->{branch}); - my $text; - if ($setting) - { - my $hours = sprintf("%.2f",($now - $sysbranch->{snapshot}) / 3600); - $text = "$sysbranch->{sysname} has now reported " . - "on $sysbranch->{branch} $hours hours ago."; - } - else - { - $text = "$sysbranch->{sysname} has lost alarm settings on branch: " . - "$sysbranch->{branch}. Resetting alarm to off."; - } - my $msg = new Mail::Send; - - $msg->set('From',"PG Build Farm <$me\@$host>"); - - $addr_sth->execute($animal); - - my $mailto = $addr_sth->fetchrow_array; - - print "sending clear to $mailto\n"; - - # $sth->finish; - - $msg->to($mailto); - $msg->subject("PGBuildfarm member $animal Branch $branch Alert cleared"); - my $fh = $msg->open; - print $fh "\n\n$text\n"; - $fh->close; - - print "alert cleared $animal $branch\n"; -} - -foreach my $clearme (@need_alerts) -{ - my ($sysbranch, $setting) = @$clearme; - my ($animal, $branch) = ($sysbranch->{sysname},$sysbranch->{branch}); - my $hours = sprintf("%.2f",($now - $sysbranch->{snapshot}) / 3600); - my $text = "$sysbranch->{sysname} has not reported " . - "on $sysbranch->{branch} for $hours hours."; - my $msg = new Mail::Send; - - $msg->set('From',"PG Build Farm <$me\@$host>"); - - $addr_sth->execute($animal); - - my ($mailto) = $addr_sth->fetchrow_array; - - # $sth->finish; - - print "sending alert to $mailto\n"; - - $msg->to($mailto); - - $msg->subject("PGBuildfarm member $animal Branch $branch " . - "Alert notification"); - my $fh = $msg->open; - print $fh "\n\n$text\n"; - $fh->close; - - print "alert sent $animal $branch\n"; -} - - -print "=================================\n"; - - - diff --git a/cgi-bin/.htaccess b/cgi-bin/.htaccess deleted file mode 100644 index ead7338..0000000 --- a/cgi-bin/.htaccess +++ /dev/null @@ -1,2 +0,0 @@ -SetEnv BFConfDir /home/community/pgbuildfarm -SetEnv BF_DEBUG on diff --git a/cgi-bin/addnotes.pl b/cgi-bin/addnotes.pl deleted file mode 100755 index acab114..0000000 --- a/cgi-bin/addnotes.pl +++ /dev/null @@ -1,116 +0,0 @@ -#!/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 $sysnotes = $query->param('sysnotes'); - -my $content = "animal=$animal\&sysnotes=$sysnotes"; - -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 && defined($sysnotes) && $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($_); } - ($sysnotes); - -my $set_notes = q{ - - update buildsystems - set sys_notes = nullif($2,''), - sys_notes_ts = case - when coalesce($2,'') <> '' then now() - else null - end - where name = $1 - and status = 'approved' - -}; - -$sth = $db->prepare($set_notes); -my $rv = $sth->execute($animal,$sysnotes); -unless($rv) -{ - print "Status: 460 old data fetch\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/cgi-bin/envtest.pl b/cgi-bin/envtest.pl deleted file mode 100644 index 6158d18..0000000 --- a/cgi-bin/envtest.pl +++ /dev/null @@ -1,15 +0,0 @@ -#!/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 deleted file mode 100755 index 02059e7..0000000 --- a/cgi-bin/get_bf_status_soap.pl +++ /dev/null @@ -1,30 +0,0 @@ -#!/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/pgstatus.pl b/cgi-bin/pgstatus.pl deleted file mode 100755 index f951aee..0000000 --- a/cgi-bin/pgstatus.pl +++ /dev/null @@ -1,504 +0,0 @@ -#!/usr/bin/perl - -use strict; - -use vars qw($dbhost $dbname $dbuser $dbpass $dbport - $all_stat $fail_stat $change_stat $green_stat - $server_time - $min_script_version $min_web_script_version -); - -# force this before we do anything - even load modules -BEGIN { $server_time = time; } - -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 Time::ParseDate; - -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; - -} - -unless ($branch =~ /^(HEAD|REL\d+_\d+_STABLE)$/) -{ - print - "Status: 492 bad branch parameter $branch\nContent-Type: text/plain\n\n", - "bad branch parameter $branch\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 $tsdiff = time - $ts; - -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) || ($ts + 86400 < time ) || (! $secret) ) -{ - open(TX,">../buildlogs/$animal.$date"); - print TX "sig=$sig\nlogtar-len=" , length($log_archive), - "\nstatus=$res\nstage=$stage\nconf:\n$conf\n", - "tsdiff:$tsdiff\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 + 120) -{ - my $gmt = gmtime($ts); - print "Status: 491 bad ts parameter - $ts ($gmt GMT) is in the future.\n", - "Content-Type: text/plain\n\n bad ts parameter - $ts ($gmt GMT) is in the future\n"; - $db->disconnect; - exit; -} - -unless ($ts + 86400 > time) -{ - my $gmt = gmtime($ts); - print "Status: 491 bad ts parameter - $ts ($gmt GMT) is more than 24 hours ago.\n", - "Content-Type: text/plain\n\n bad ts parameter - $ts ($gmt GMT) is more than 24 hours ago.\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); - - -if ($log =~/Last file mtime in snapshot: (.*)/) -{ - my $snaptime = parsedate($1); - if ($snaptime < (time - (10 * 86400))) - { - print "Status: 493 snapshot too old: $1\nContent-Type: text/plain\n\n"; - print "snapshot to old: $1\n"; - $db->disconnect; - exit; - } -} - -($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;"); - -if ($min_script_version) -{ - $client_conf->{script_version} ||= '0.0'; - my ($minmajor,$minminor) = split(/\./,$min_script_version); - my ($smajor,$sminor) = split(/\./,$client_conf->{script_version}); - if ($minmajor > $smajor || ($minmajor == $smajor && $minminor > $sminor)) - { - print "Status: 460 script version too low\nContent-Type: text/plain\n\n"; - print - "Script version is below minimum required\n", - "Reported version: $client_conf->{script_version},", - "Minumum version required: $min_script_version\n"; - $db->disconnect; - exit; - } -} - -if ($min_web_script_version) -{ - $client_conf->{web_script_version} ||= '0.0'; - my ($minmajor,$minminor) = split(/\./,$min_script_version); - my ($smajor,$sminor) = split(/\./,$client_conf->{script_version}); - if ($minmajor > $smajor || ($minmajor == $smajor && $minminor > $sminor)) - { - print "Status: 461 web script version too low\nContent-Type: text/plain\n\n"; - print - "Web Script version is below minimum required\n", - "Reported version: $client_conf->{web_script_version},", - "Minumum version required: $min_web_script_version\n"; - $db->disconnect; - exit; - } -} - -my @config_flags; -if (not exists $client_conf->{config_opts} ) -{ - @config_flags = (); -} -elsif (ref $client_conf->{config_opts} eq 'HASH') -{ - # leave out keys with false values - @config_flags = grep { $client_conf->{config_opts}->{$_} } - keys %{$client_conf->{config_opts}}; -} -elsif (ref $client_conf->{config_opts} eq 'ARRAY' ) -{ - @config_flags = @{$client_conf->{config_opts}}; -} - -if (@config_flags) -{ - @config_flags = grep {! m/=/ } @config_flags; - map {s/\s+//g; $_=qq("$_"); } @config_flags; - push @config_flags,'git' if $client_conf->{scm} eq 'git'; - $config_flags = '{' . join(',',@config_flags) . '}' ; -} - -my $scm = $client_conf->{scm} || 'cvs'; -my $scmurl = $client_conf->{scm_url}; - -my $logst = <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(11,undef,{ pg_type => DBD::Pg::PG_BYTEA }); -$sth->bind_param(12,$config_flags); -$sth->bind_param(13,$scm); -$sth->bind_param(14,$scmurl); - -$sth->execute; -$sth->finish; - -my $logst2 = <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); - $ltext =~ s/\x00/\\0/g; - $sth->execute($animal,$dbdate,$branch,$log_file,$ltext, - "$stage_interval seconds"); -} - - -$sth->finish; - -my $prevst = <prepare($prevst); -$sth->execute($animal,$branch,$dbdate); -my $row=$sth->fetchrow_arrayref; -my $prev_stat=$row->[0]; -$sth->finish; - -my $det_st = <prepare($det_st); -$sth->execute($animal); -$row=$sth->fetchrow_arrayref; -my ($os, $compiler,$arch) = @$row; -$sth->finish; - -$db->begin_work; -$db->do("delete from dashboard_mat"); -$db->do("insert into dashboard_mat select * from dashboard_mat_data"); -$db->commit; - -$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}) -{ - my $client_time = $client_conf->{current_ts}; - open(TX,">>../buildlogs/$animal.$date"); - print TX "\n",Dumper(\$client_conf),"\n"; - print TX "server time: $server_time, client time: $client_time\n" if $client_time; - 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 <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 <close; diff --git a/cgi-bin/register-form.pl b/cgi-bin/register-form.pl deleted file mode 100755 index cf4621a..0000000 --- a/cgi-bin/register-form.pl +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/perl - -use strict; -use Template; -use Captcha::reCAPTCHA; - -use vars qw( $template_dir $captcha_pubkey ); -require "$ENV{BFConfDir}/BuildFarmWeb.pl"; - - -my $c = Captcha::reCAPTCHA->new; - -my $captcha = $c->get_html($captcha_pubkey); - -my $template_opts = { INCLUDE_PATH => $template_dir }; -my $template = new Template($template_opts); - -print "Content-Type: text/html\n\n"; - - -$template->process('register-form.tt',{captcha => $captcha}); - - - - - diff --git a/cgi-bin/register.pl b/cgi-bin/register.pl deleted file mode 100755 index b15a0e2..0000000 --- a/cgi-bin/register.pl +++ /dev/null @@ -1,146 +0,0 @@ -#!/usr/bin/perl - -use strict; -use DBI; -use Template; -use CGI; -use Template; -use Captcha::reCAPTCHA; - -use vars qw($dbhost $dbname $dbuser $dbpass $dbport $notifyapp $captcha_pubkey $captcha_privkey $template_dir); - -require "$ENV{BFConfDir}/BuildFarmWeb.pl"; - -my $dsn="dbi:Pg:dbname=$dbname"; -$dsn .= ";host=$dbhost" if $dbhost; -$dsn .= ";port=$dbport" if $dbport; - -my $template_opts = { INCLUDE_PATH => $template_dir}; -my $template = new Template($template_opts); -my $query = new CGI; - -my $params = $query->Vars; - -my ($os, $osv, $comp, $compv, $arch, $email, $owner, $challenge, $response ) = @{$params}{ - qw(os osv comp compv arch email owner recaptcha_challenge_field recaptcha_response_field)}; - -my $captcha = Captcha::reCAPTCHA->new; -my $captcha_ok = $captcha->check_answer - ( - $captcha_privkey, - $ENV{'REMOTE_ADDR'}, - $challenge, $response - ); - - -unless ($os && $osv && $comp && $compv && $arch && $email && $owner && $captcha_ok->{is_valid}) -{ - print "Content-Type: text/html\n\n"; - $template->process('register-incomplete.tt'); - exit; -} - -# some idiot has a script that tries to talk to me -# this should catch and dispose of him -if ((grep {/rgergerger|\@pgbuildfarm\.org|Content-Type:|http:|mailto:|href=|None|Unknown/} $os,$osv,$comp,$compv,$arch,$email,$owner) - || ($email =~ /john.*\@aol.com/) ) -{ - print - "Status: 403 Forbidden - go away idiot\n", - "Content-Type: text/plain\n\n"; - exit; -} - -# count transitions to and from upper case -my $trans = 1; -my $counttrans = 0; -foreach (split "" ,"$os$osv$comp$compv$arch$owner") -{ - if (/[A-Z]/) - { - next if $trans; - $trans = 1; - $counttrans++; - } - else - { - next unless $trans; - $trans = 0; - $counttrans++; - } -} - -# reject junk with too many transitions into/outof upper case -if ($counttrans > 20) -{ - 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 = <prepare($statement); -my $rv=$sth->execute($dummyname,$secret,$os,$osv,$comp,$compv, - $arch,$owner,$email); -my $err=$db->errstr; - -# everything looks OK, so tell them so -print "Content-type: text/html\n\n"; -$template->process('register-ok.tt'); - -$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 deleted file mode 100755 index b55c381..0000000 --- a/cgi-bin/show_history.pl +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/perl - -use strict; -use DBI; -use Template; -use CGI; - -use vars qw($dbhost $dbname $dbuser $dbpass $dbport $template_dir); - - -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+$/; - -my $latest_personality = $db->selectrow_arrayref(q{ - select os_version, compiler_version - from personality - where name = ? - order by effective_date desc limit 1 - }, undef, $member); - -# 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 = <prepare($statement); -$sth->execute($member,$branch); -while (my $row = $sth->fetchrow_hashref) -{ - $row->{owner_email} =~ s/\@/ [ a t ] /; - if ($latest_personality) - { - $row->{os_version} = $latest_personality->[0]; - $row->{compiler_version} = $latest_personality->[1]; - } - push(@$statrows,$row); -} - -$sth->finish; - -$db->disconnect; - -my $template_opts = { INCLUDE_PATH => $template_dir, EVAL_PERL => 1 }; -my $template = new Template($template_opts); - -print "Content-Type: text/html\n\n"; - -$template->process('history.tt', - {statrows=>$statrows, - branch=>$branch, - member => $member, - hm => $hm - }); - -exit; diff --git a/cgi-bin/show_log.pl b/cgi-bin/show_log.pl deleted file mode 100755 index 663fc26..0000000 --- a/cgi-bin/show_log.pl +++ /dev/null @@ -1,134 +0,0 @@ -#!/usr/bin/perl - -use strict; -use DBI; -use Template; -use CGI; - -use vars qw($dbhost $dbname $dbuser $dbpass $dbport $template_dir @log_file_names); - -require "$ENV{BFConfDir}/BuildFarmWeb.pl"; - -my $template_opts = { INCLUDE_PATH => $template_dir, EVAL_PERL => 1}; -my $template = new Template($template_opts); - -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,$scmurl); -my $scm; - -use vars qw($info_row); - -if ($system && $logdate) -{ - - my $db = DBI->connect($dsn,$dbuser,$dbpass); - - die $DBI::errstr unless $db; - - my $statement = q{ - - select log,conf_sum,stage, changed_this_run, changed_since_success,branch, - log_archive_filenames, scm, scmurl - from build_status - where sysname = ? and snapshot = ? - - }; - 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]; - $scm = $row->[7]; - $scm ||= 'cvs'; # legacy scripts - $scmurl = $row->[8]; - $log_file_names =~ s/^\{(.*)\}$/$1/; - @log_file_names=split(',',$log_file_names) - if $log_file_names; - $sth->finish; - - $statement = q{ - - select operating_system, os_version, - compiler, compiler_version, - architecture, - replace(owner_email,'\@',' [ a t ] ') as owner_email, - sys_notes_ts::date AS sys_notes_date, sys_notes - from buildsystems - where status = 'approved' - and name = ? - - }; - $sth=$db->prepare($statement); - $sth->execute($system); - $info_row=$sth->fetchrow_hashref; - - my $latest_personality = $db->selectrow_arrayref(q{ - select os_version, compiler_version - from personality - where effective_date < ? - and name = ? - order by effective_date desc limit 1 - }, undef, $logdate, $system); - # $sysinfo = join(" ",@$row); - if ($latest_personality) - { - $info_row->{os_version} = $latest_personality->[0]; - $info_row->{compiler_version} = $latest_personality->[1]; - } - $sth->finish; - $db->disconnect; -} - -foreach my $chgd ($changed_this_run,$changed_since_success) -{ - my $cvsurl = 'http://anoncvs.postgresql.org/cvsweb.cgi'; - my $giturl = $scmurl || 'http://git.postgresql.org/gitweb?p=postgresql.git;a=commit;h='; - my @lines = split(/!/,$chgd); - my $changed_rows = []; - foreach (@lines) - { - next if ($scm eq 'cvs' and ! m!^(pgsql|master|REL\d_\d_STABLE)/!); - push(@$changed_rows,[$1,$3]) if (m!(^\S+)(\s+)(\S+)!); - } - $chgd = $changed_rows; -} - -$conf =~ s/\@/ [ a t ] /g; - -print "Content-Type: text/html\n\n"; - -$template->process('log.tt', - { - scm => $scm, - scmurl => $scmurl, - system => $system, - branch => $branch, - stage => $stage, - urldt => $logdate, - log_file_names => \@log_file_names, - conf => $conf, - log => $log, - changed_this_run => $changed_this_run, - changed_since_success => $changed_since_success, - info_row => $info_row, - - }); - diff --git a/cgi-bin/show_members.pl b/cgi-bin/show_members.pl deleted file mode 100755 index 3bc733c..0000000 --- a/cgi-bin/show_members.pl +++ /dev/null @@ -1,97 +0,0 @@ -#!/usr/bin/perl - -use strict; -use CGI; -use DBI; -use Template; - - - -use vars qw($dbhost $dbname $dbuser $dbpass $dbport $template_dir $sort_by); - - -require "$ENV{BFConfDir}/BuildFarmWeb.pl"; -#require "BuildFarmWeb.pl"; - -my $query = new CGI; -my %sort_ok = ('name' => 'lower(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} || $sort_ok{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 = q{ - - select name, operating_system, os_version, compiler, compiler_version, owner_email, - sys_notes_ts::date AS sys_notes_date, sys_notes, - architecture as arch, ARRAY( - select branch || ':' || - extract(days from now() - l.snapshot) - from latest_snapshot l - where l.sysname = s.name - order by branch <> 'HEAD', branch desc - ) as branches, - ARRAY(select compiler_version || '\t' || os_version || '\t' || effective_date - from personality p - where p.name = s.name - order by effective_date - ) as personalities - from buildsystems s - where status = 'approved' -}; - -$statement .= "order by $sort_by"; - -my $statrows=[]; -my $sth=$db->prepare($statement); -$sth->execute; -while (my $row = $sth->fetchrow_hashref) -{ - $row->{branches} =~ s/^\{(.*)\}$/$1/; - my $personalities = $row->{personalities}; - $personalities =~ s/^\{(.*)\}$/$1/; - my @personalities = split(',',$personalities); - $row->{personalities} = []; - foreach my $personality (@personalities) - { - $personality =~ s/^"(.*)"$/$1/; - $personality =~ s/\\(.)/$1/g; - - my ($compiler_version, $os_version, $effective_date) = split(/\t/,$personality); - $effective_date =~ s/ .*//; - push(@{$row->{personalities}}, {compiler_version => $compiler_version, - os_version => $os_version, - effective_date => $effective_date }); - } - $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_opts = { INCLUDE_PATH => $template_dir}; -my $template = new Template($template_opts); - -print "Content-Type: text/html\n\n"; - -$template->process('members.tt', - {statrows=>$statrows}); - -exit; - diff --git a/cgi-bin/show_stage_log.pl b/cgi-bin/show_stage_log.pl deleted file mode 100755 index 539d5a1..0000000 --- a/cgi-bin/show_stage_log.pl +++ /dev/null @@ -1,71 +0,0 @@ -#!/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 && $stage) -{ - my $db = DBI->connect($dsn,$dbuser,$dbpass); - - die $DBI::errstr unless $db; - - my $statement = q( - - select branch, log_text - from build_status_log - where sysname = ? and snapshot = ? and log_stage = ? || '.log' - - ); - - - - my $sth=$db->prepare($statement); - $sth->execute($system,$logdate,$stage); - my $row=$sth->fetchrow_arrayref; - my ($branch, $logtext) = ("unknown","no log text found"); - if ($row) - { - $branch = $row->[0]; - $logtext =$row->[1]; - } - $sth->finish; - $db->disconnect; - - print "Content-Type: text/plain\n\n", $logtext, - - "-------------------------------------------------\n\n", - "Hosting for the PostgreSQL Buildfarm is generously ", - "provided by: CommandPrompt, The PostgreSQL Company"; - -} - -else -{ - print "Status: 460 bad parameters\n", - "Content-Type: text/plain\n\n"; -} - diff --git a/cgi-bin/show_status.pl b/cgi-bin/show_status.pl deleted file mode 100755 index e1a6ef6..0000000 --- a/cgi-bin/show_status.pl +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/perl - -use strict; -use DBI; -use Template; -use CGI; - -use vars qw($dbhost $dbname $dbuser $dbpass $dbport $template_dir); - - -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 $sort_clause = ""; -my $sortby = $query->param('sortby') || 'nosort'; -if ($sortby eq 'name') -{ - $sort_clause = 'lower(sysname),'; -} -elsif ($sortby eq 'os') -{ - $sort_clause = 'lower(operating_system), os_version desc,'; -} -elsif ($sortby eq 'compiler') -{ - $sort_clause = "lower(compiler), compiler_version,"; -} - -my $db = DBI->connect($dsn,$dbuser,$dbpass) or die("$dsn,$dbuser,$dbpass,$!"); - -my $statement =<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; - # enable-integer-datetimes is now the default - if ($row->{branch} eq 'HEAD' || $row->{branch} gt 'REL8_3_STABLE') - { - $row->{build_flags} .= " --enable-integer-datetimes " - unless ($row->{build_flags} =~ /--(en|dis)able-integer-datetimes/); - } - # enable-thread-safety is now the default - if ($row->{branch} eq 'HEAD' || $row->{branch} gt 'REL8_5_STABLE') - { - $row->{build_flags} .= " --enable-thread-safety " - unless ($row->{build_flags} =~ /--(en|dis)able-thread-safety/); - } - $row->{build_flags} =~ s/--((enable|with)-)?//g; - $row->{build_flags} =~ s/libxml/xml/; - $row->{build_flags} =~ s/\S+=\S+//g; - push(@$statrows,$row); -} -$sth->finish; - - -$db->disconnect; - - -my $template_opts = { INCLUDE_PATH => $template_dir }; -my $template = new Template($template_opts); - -print "Content-Type: text/html\n\n"; - -$template->process('status.tt', - {statrows=>$statrows}); - -exit; - diff --git a/cgi-bin/show_status_soap.pl b/cgi-bin/show_status_soap.pl deleted file mode 100755 index 5d12800..0000000 --- a/cgi-bin/show_status_soap.pl +++ /dev/null @@ -1,78 +0,0 @@ -#!/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 =<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 deleted file mode 100755 index 9b179d2..0000000 --- a/cgi-bin/test.pl +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/perl - -#print "Content-Type: text/html\n\n"; -#print "

My quick perl hello

"; - -use CGI; - -my $query = new CGI; - -my $url = $query->url(); - -my $base = $query->url(-base=>1); - -print <connect($dsn,$dbuser,$dbpass) or die("$dsn,$dbuser,$dbpass,$!"); - -my %words; - -my $sql = q{ - select sysname, max(snapshot) as snapshot - from build_status_log - where branch = 'HEAD' and - log_stage = 'typedefs.log' and - snapshot > current_date::timestamp - interval '30 days' - group by sysname -}; -my $builds = $dbh->selectall_arrayref($sql, { Slice => {} }); - - -if ($query->param('show_list')) -{ - print "Content-Type: text/html\n\n", - "Typedefs URLs\n", - "

Typdefs URLs

\n", - "\n"; - - foreach my $build (@$builds) - { - print "\n"; - } - print "
member
$build->{sysname}
\n"; - exit; -} - -$sql = q{ - select log_text - from build_status_log - where sysname = ? - and snapshot = ? - and log_stage = 'typedefs.log' - and branch = 'HEAD' - }; - -my $sth = $dbh->prepare($sql); - -foreach my $build (@$builds) -{ - $sth->execute($build->{sysname},$build->{snapshot}); - my @row = $sth->fetchrow; - my @typedefs = split(/\s+/,$row[0]); - @words{@typedefs} = 1 x @typedefs; -} - -print "Content-Type: text/plain\n\n", - join("\n",sort keys %words), - "\n"; diff --git a/cgi-bin/upgrade.pl b/cgi-bin/upgrade.pl deleted file mode 100755 index f4cbb99..0000000 --- a/cgi-bin/upgrade.pl +++ /dev/null @@ -1,149 +0,0 @@ -#!/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 deleted file mode 100644 index 4ed50ab..0000000 Binary files a/htdocs/bfweb.tgz and /dev/null differ diff --git a/htdocs/elephant-head_only.gif b/htdocs/elephant-head_only.gif deleted file mode 100644 index dd791da..0000000 Binary files a/htdocs/elephant-head_only.gif and /dev/null differ diff --git a/htdocs/elephant-icon.png b/htdocs/elephant-icon.png deleted file mode 100644 index 278bfd8..0000000 Binary files a/htdocs/elephant-icon.png and /dev/null differ diff --git a/htdocs/elephant5.gif b/htdocs/elephant5.gif deleted file mode 100644 index cb9da33..0000000 Binary files a/htdocs/elephant5.gif and /dev/null differ diff --git a/htdocs/elephant5a.gif b/htdocs/elephant5a.gif deleted file mode 100644 index 076cb9d..0000000 Binary files a/htdocs/elephant5a.gif and /dev/null differ diff --git a/htdocs/img/blank.gif b/htdocs/img/blank.gif deleted file mode 100644 index 448d4c4..0000000 Binary files a/htdocs/img/blank.gif and /dev/null differ diff --git a/htdocs/img/bug.png b/htdocs/img/bug.png deleted file mode 100644 index 2e92af1..0000000 Binary files a/htdocs/img/bug.png and /dev/null differ diff --git a/htdocs/img/camel.png b/htdocs/img/camel.png deleted file mode 100644 index 95ca8c5..0000000 Binary files a/htdocs/img/camel.png and /dev/null differ diff --git a/htdocs/img/cassert.png b/htdocs/img/cassert.png deleted file mode 100644 index 5b9241f..0000000 Binary files a/htdocs/img/cassert.png and /dev/null differ diff --git a/htdocs/img/days.png b/htdocs/img/days.png deleted file mode 100644 index ae24849..0000000 Binary files a/htdocs/img/days.png and /dev/null differ diff --git a/htdocs/img/git.png b/htdocs/img/git.png deleted file mode 100644 index de637c0..0000000 Binary files a/htdocs/img/git.png and /dev/null differ diff --git a/htdocs/img/info.gif b/htdocs/img/info.gif deleted file mode 100644 index ef510fa..0000000 Binary files a/htdocs/img/info.gif and /dev/null differ diff --git a/htdocs/img/kerberos.png b/htdocs/img/kerberos.png deleted file mode 100644 index 80a9c46..0000000 Binary files a/htdocs/img/kerberos.png and /dev/null differ diff --git a/htdocs/img/krb.gif b/htdocs/img/krb.gif deleted file mode 100644 index c1cfcbf..0000000 Binary files a/htdocs/img/krb.gif and /dev/null differ diff --git a/htdocs/img/notes.png b/htdocs/img/notes.png deleted file mode 100644 index c6e4133..0000000 Binary files a/htdocs/img/notes.png and /dev/null differ diff --git a/htdocs/img/pam.png b/htdocs/img/pam.png deleted file mode 100644 index a1015e8..0000000 Binary files a/htdocs/img/pam.png and /dev/null differ diff --git a/htdocs/img/python.png b/htdocs/img/python.png deleted file mode 100644 index a7ea47b..0000000 Binary files a/htdocs/img/python.png and /dev/null differ diff --git a/htdocs/img/ssl_icon.gif b/htdocs/img/ssl_icon.gif deleted file mode 100644 index 2d34d76..0000000 Binary files a/htdocs/img/ssl_icon.gif and /dev/null differ diff --git a/htdocs/img/tcl.png b/htdocs/img/tcl.png deleted file mode 100644 index 957e760..0000000 Binary files a/htdocs/img/tcl.png and /dev/null differ diff --git a/htdocs/img/threads.gif b/htdocs/img/threads.gif deleted file mode 100644 index 3068767..0000000 Binary files a/htdocs/img/threads.gif and /dev/null differ diff --git a/htdocs/img/translateicon.gif b/htdocs/img/translateicon.gif deleted file mode 100644 index 104a5ed..0000000 Binary files a/htdocs/img/translateicon.gif and /dev/null differ diff --git a/htdocs/img/vpath.png b/htdocs/img/vpath.png deleted file mode 100644 index 9859b01..0000000 Binary files a/htdocs/img/vpath.png and /dev/null differ diff --git a/htdocs/img/xml.png b/htdocs/img/xml.png deleted file mode 100644 index 8b16889..0000000 Binary files a/htdocs/img/xml.png and /dev/null differ diff --git a/htdocs/inc/b/l.png b/htdocs/inc/b/l.png deleted file mode 100644 index 19a036d..0000000 Binary files a/htdocs/inc/b/l.png and /dev/null differ diff --git a/htdocs/inc/b/r.png b/htdocs/inc/b/r.png deleted file mode 100644 index 640199c..0000000 Binary files a/htdocs/inc/b/r.png and /dev/null differ diff --git a/htdocs/inc/pgbf.css b/htdocs/inc/pgbf.css deleted file mode 100644 index 0873d6d..0000000 --- a/htdocs/inc/pgbf.css +++ /dev/null @@ -1,129 +0,0 @@ -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; - -} - -#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 deleted file mode 100644 index 4698817..0000000 Binary files a/htdocs/inc/pgbuildfarm-banner.png and /dev/null differ diff --git a/htdocs/index.html b/htdocs/index.html deleted file mode 100644 index b17ceb2..0000000 --- a/htdocs/index.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - - PostgreSQL BuildFarm - - - - - -
- -
- - -

-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. -

-

-To see the current status of tests on various branches, check the -Status Page. -

-

-If you are interested in running a member of the build farm, then please visit -the Registration Page. -We are particularly interested in unusual platforms or combinations of -architecture, operating system and compiler. -

-

To see what is involved in running a buildfarm member, please -read http://wiki.postgresql.org/wiki/PostgreSQL_Buildfarm_Howto. -The client code can be found at the -project page at -PGFoundry. -

-

The build farm software should run on all platforms that can support PostgreSQL. -

- -
-
-

- Hosting for the PostgreSQL Buildfarm is generously - provided by: - CommandPrompt, The PostgreSQL Company -

-
- - - diff --git a/htdocs/robots.txt b/htdocs/robots.txt deleted file mode 100644 index 1b425ee..0000000 --- a/htdocs/robots.txt +++ /dev/null @@ -1,2 +0,0 @@ -User-agent: * -Disallow: /cgi-bin/ diff --git a/schema/bfwebdb.sql b/schema/bfwebdb.sql deleted file mode 100644 index 2e575b0..0000000 --- a/schema/bfwebdb.sql +++ /dev/null @@ -1,708 +0,0 @@ --- --- 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; - --- --- Name: set_latest(); Type: FUNCTION; Schema: public; Owner: pgbuildfarm --- - -CREATE FUNCTION set_latest() RETURNS "trigger" - AS $$ - - begin - update latest_snapshot - set snapshot = - (case when snapshot > NEW.snapshot then snapshot else NEW.snapshot end) - where sysname = NEW.sysname and - branch = NEW.branch; - if not found then - insert into latest_snapshot - values(NEW.sysname, NEW.branch, NEW.snapshot); - end if; - return NEW; - end; -$$ - LANGUAGE plpgsql; - - -ALTER FUNCTION public.set_latest() OWNER TO pgbuildfarm; - --- --- Name: target(text); Type: FUNCTION; Schema: public; Owner: pgbuildfarm --- - -CREATE FUNCTION target(t text) RETURNS text - AS $_$ my $log = shift; $log =~ s/.*(Target:[^\n]*).*/$1/s; return $log; $_$ - LANGUAGE plperl; - - -ALTER FUNCTION public.target(t text) OWNER TO pgbuildfarm; - --- --- Name: transitions(text, text, text, text, text, text); Type: FUNCTION; Schema: public; Owner: pgbuildfarm --- - -CREATE FUNCTION transitions(text, text, text, text, text, text) RETURNS integer - AS $_$ - -my ($os,$osv,$comp,$compv,$arch,$owner) = @_; -# count transitions to and from upper case -my $trans = 1; -my $counttrans = 0; -foreach (split "" ,"$os$osv$comp$compv$arch$owner") -{ - if (/[A-Z]/) - { - next if $trans; - $trans = 1; - $counttrans++; - } - else - { - next unless $trans; - $trans = 0; - $counttrans++; - } -} - -return $counttrans; - -$_$ - LANGUAGE plperl; - - -ALTER FUNCTION public.transitions(text, text, text, text, text, text) 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, - scm text, - scmurl text -); - - -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, - no_alerts boolean DEFAULT false, - sys_notes text, - sys_notes_ts timestamp with 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: latest_snapshot; Type: TABLE; Schema: public; Owner: pgbuildfarm; Tablespace: --- - -CREATE TABLE latest_snapshot ( - sysname text NOT NULL, - branch text NOT NULL, - snapshot timestamp without time zone NOT NULL -); - - -ALTER TABLE public.latest_snapshot 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: dashboard; Type: VIEW; Schema: public; Owner: pgbuildfarm --- - -CREATE VIEW dashboard AS - SELECT ((timezone('GMT'::text, now()))::timestamp(0) without time zone - b.snapshot) AS when_ago, b.sysname, b.snapshot, b.status, b.stage, b.branch, b.build_flags, s.operating_system, COALESCE(b.os_version, s.os_version) AS os_version, s.compiler, COALESCE(b.compiler_version, s.compiler_version) AS compiler_version, s.architecture FROM buildsystems s, (SELECT DISTINCT ON (bs.sysname, bs.branch, bs.report_time) bs.sysname, bs.snapshot, bs.status, bs.stage, bs.branch, bs.build_flags, bs.report_time, p.compiler_version, p.os_version FROM ((build_status bs NATURAL JOIN latest_snapshot m) LEFT JOIN personality p ON (((p.name = bs.sysname) AND (p.effective_date <= bs.report_time)))) WHERE (m.snapshot > (now() - '30 days'::interval)) ORDER BY bs.sysname, bs.branch, bs.report_time, (p.effective_date IS NULL), p.effective_date DESC) b WHERE ((s.name = b.sysname) AND (s.status = 'approved'::text)); - - -ALTER TABLE public.dashboard OWNER TO pgbuildfarm; - --- --- Name: dashboard_ex; Type: VIEW; Schema: public; Owner: pgbuildfarm --- - -CREATE VIEW dashboard_ex AS - SELECT ((timezone('GMT'::text, now()))::timestamp(0) without time zone - b.snapshot) AS when_ago, b.sysname, b.snapshot, b.status, b.stage, b.branch, b.build_flags, s.operating_system, COALESCE(b.os_version, s.os_version) AS os_version, s.compiler, COALESCE(b.compiler_version, s.compiler_version) AS compiler_version, s.architecture, s.sys_notes, (s.sys_notes_ts)::date AS sys_notes_date FROM buildsystems s, (SELECT DISTINCT ON (bs.sysname, bs.branch, bs.report_time) bs.sysname, bs.snapshot, bs.status, bs.stage, bs.branch, bs.build_flags, bs.report_time, p.compiler_version, p.os_version FROM ((build_status bs NATURAL JOIN latest_snapshot m) LEFT JOIN personality p ON (((p.name = bs.sysname) AND (p.effective_date <= bs.report_time)))) WHERE (m.snapshot > (now() - '30 days'::interval)) ORDER BY bs.sysname, bs.branch, bs.report_time, (p.effective_date IS NULL), p.effective_date DESC) b WHERE ((s.name = b.sysname) AND (s.status = 'approved'::text)); - - -ALTER TABLE public.dashboard_ex OWNER TO pgbuildfarm; - --- --- Name: dashboard_mat; Type: TABLE; Schema: public; Owner: pgbfweb; Tablespace: --- - -CREATE TABLE dashboard_mat ( - sysname text, - snapshot timestamp without time zone, - status integer, - stage text, - branch text, - build_flags text[], - operating_system text, - os_version text, - compiler text, - compiler_version text, - architecture text -); - - -ALTER TABLE public.dashboard_mat OWNER TO pgbfweb; - --- --- Name: dashboard_mat_data; Type: VIEW; Schema: public; Owner: pgbuildfarm --- - -CREATE VIEW dashboard_mat_data AS - SELECT b.sysname, b.snapshot, b.status, b.stage, b.branch, b.build_flags, s.operating_system, COALESCE(b.os_version, s.os_version) AS os_version, s.compiler, COALESCE(b.compiler_version, s.compiler_version) AS compiler_version, s.architecture FROM buildsystems s, (SELECT DISTINCT ON (bs.sysname, bs.branch, bs.report_time) bs.sysname, bs.snapshot, bs.status, bs.stage, bs.branch, bs.build_flags, bs.report_time, p.compiler_version, p.os_version FROM ((build_status bs NATURAL JOIN latest_snapshot m) LEFT JOIN personality p ON (((p.name = bs.sysname) AND (p.effective_date <= bs.report_time)))) WHERE (m.snapshot > (now() - '30 days'::interval)) ORDER BY bs.sysname, bs.branch, bs.report_time, (p.effective_date IS NULL), p.effective_date DESC) b WHERE ((s.name = b.sysname) AND (s.status = 'approved'::text)); - - -ALTER TABLE public.dashboard_mat_data OWNER TO pgbuildfarm; - --- --- Name: dashboard_mat_data2; Type: VIEW; Schema: public; Owner: pgbuildfarm --- - -CREATE VIEW dashboard_mat_data2 AS - SELECT b.sysname, b.snapshot, b.status, b.stage, b.branch, CASE WHEN ((b.conf_sum ~ 'use_vpath'::text) AND (b.conf_sum !~ '''use_vpath'' => undef'::text)) THEN (b.build_flags || 'vpath'::text) ELSE b.build_flags END AS build_flags, s.operating_system, COALESCE(b.os_version, s.os_version) AS os_version, s.compiler, COALESCE(b.compiler_version, s.compiler_version) AS compiler_version, s.architecture FROM buildsystems s, (SELECT DISTINCT ON (bs.sysname, bs.branch, bs.report_time) bs.sysname, bs.snapshot, bs.status, bs.stage, bs.branch, bs.build_flags, bs.conf_sum, bs.report_time, p.compiler_version, p.os_version FROM ((build_status bs NATURAL JOIN latest_snapshot m) LEFT JOIN personality p ON (((p.name = bs.sysname) AND (p.effective_date <= bs.report_time)))) WHERE (m.snapshot > (now() - '30 days'::interval)) ORDER BY bs.sysname, bs.branch, bs.report_time, (p.effective_date IS NULL), p.effective_date DESC) b WHERE ((s.name = b.sysname) AND (s.status = 'approved'::text)); - - -ALTER TABLE public.dashboard_mat_data2 OWNER TO pgbuildfarm; - --- --- Name: failures; Type: VIEW; Schema: public; Owner: pgbuildfarm --- - -CREATE VIEW failures AS - SELECT build_status.sysname, build_status.snapshot, build_status.stage, build_status.conf_sum, build_status.branch, build_status.changed_this_run, build_status.changed_since_success, build_status.log_archive_filenames, build_status.build_flags, build_status.report_time FROM build_status WHERE (((build_status.stage <> 'OK'::text) AND (build_status.stage !~~ 'CVS%'::text)) AND (build_status.report_time IS NOT NULL)); - - -ALTER TABLE public.failures 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: recent_failures; Type: VIEW; Schema: public; Owner: pgbuildfarm --- - -CREATE VIEW recent_failures AS - SELECT build_status.sysname, build_status.snapshot, build_status.stage, build_status.conf_sum, build_status.branch, build_status.changed_this_run, build_status.changed_since_success, build_status.log_archive_filenames, build_status.build_flags, build_status.report_time, build_status.log FROM build_status WHERE ((((build_status.stage <> 'OK'::text) AND (build_status.stage !~~ 'CVS%'::text)) AND (build_status.report_time IS NOT NULL)) AND ((build_status.snapshot + '3 mons'::interval) > ('now'::text)::timestamp(6) with time zone)); - - -ALTER TABLE public.recent_failures 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: latest_snapshot_pkey; Type: CONSTRAINT; Schema: public; Owner: pgbuildfarm; Tablespace: --- - -ALTER TABLE ONLY latest_snapshot - ADD CONSTRAINT latest_snapshot_pkey PRIMARY KEY (sysname, branch); - - -ALTER INDEX public.latest_snapshot_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: build_status_log_snapshot_idx; Type: INDEX; Schema: public; Owner: pgbuildfarm; Tablespace: --- - -CREATE INDEX build_status_log_snapshot_idx ON build_status_log USING btree (snapshot); - - -ALTER INDEX public.build_status_log_snapshot_idx OWNER TO pgbuildfarm; - --- --- Name: set_latest_snapshot; Type: TRIGGER; Schema: public; Owner: pgbuildfarm --- - -CREATE TRIGGER set_latest_snapshot - AFTER INSERT ON build_status - FOR EACH ROW - EXECUTE PROCEDURE set_latest(); - - --- --- 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 UPDATE CASCADE ON DELETE CASCADE; - - --- --- Name: personality_build_systems_name_fk; Type: FK CONSTRAINT; Schema: public; Owner: pgbuildfarm --- - -ALTER TABLE ONLY personality - ADD CONSTRAINT personality_build_systems_name_fk FOREIGN KEY (name) REFERENCES buildsystems(name) ON UPDATE CASCADE 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,UPDATE ON TABLE buildsystems TO pgbfweb; -GRANT SELECT ON TABLE buildsystems TO rssfeed; - - --- --- Name: latest_snapshot; Type: ACL; Schema: public; Owner: pgbuildfarm --- - -REVOKE ALL ON TABLE latest_snapshot FROM PUBLIC; -REVOKE ALL ON TABLE latest_snapshot FROM pgbuildfarm; -GRANT ALL ON TABLE latest_snapshot TO pgbuildfarm; -GRANT INSERT,SELECT,UPDATE,DELETE ON TABLE latest_snapshot TO pgbfweb; - - --- --- 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; - - --- --- Name: dashboard; Type: ACL; Schema: public; Owner: pgbuildfarm --- - -REVOKE ALL ON TABLE dashboard FROM PUBLIC; -REVOKE ALL ON TABLE dashboard FROM pgbuildfarm; -GRANT ALL ON TABLE dashboard TO pgbuildfarm; -GRANT SELECT ON TABLE dashboard TO pgbfweb; - - --- --- Name: dashboard_ex; Type: ACL; Schema: public; Owner: pgbuildfarm --- - -REVOKE ALL ON TABLE dashboard_ex FROM PUBLIC; -REVOKE ALL ON TABLE dashboard_ex FROM pgbuildfarm; -GRANT ALL ON TABLE dashboard_ex TO pgbuildfarm; -GRANT SELECT ON TABLE dashboard_ex TO pgbfweb; - - --- --- Name: dashboard_mat; Type: ACL; Schema: public; Owner: pgbfweb --- - -REVOKE ALL ON TABLE dashboard_mat FROM PUBLIC; -REVOKE ALL ON TABLE dashboard_mat FROM pgbfweb; -GRANT ALL ON TABLE dashboard_mat TO pgbfweb; - - --- --- Name: dashboard_mat_data; Type: ACL; Schema: public; Owner: pgbuildfarm --- - -REVOKE ALL ON TABLE dashboard_mat_data FROM PUBLIC; -REVOKE ALL ON TABLE dashboard_mat_data FROM pgbuildfarm; -GRANT ALL ON TABLE dashboard_mat_data TO pgbuildfarm; -GRANT SELECT ON TABLE dashboard_mat_data TO pgbfweb; - - --- --- Name: dashboard_mat_data2; Type: ACL; Schema: public; Owner: pgbuildfarm --- - -REVOKE ALL ON TABLE dashboard_mat_data2 FROM PUBLIC; -REVOKE ALL ON TABLE dashboard_mat_data2 FROM pgbuildfarm; -GRANT ALL ON TABLE dashboard_mat_data2 TO pgbuildfarm; -GRANT SELECT ON TABLE dashboard_mat_data2 TO pgbfweb; - - --- --- PostgreSQL database dump complete --- - diff --git a/templates/bfwrapper.tt.ttc b/templates/bfwrapper.tt.ttc deleted file mode 100644 index 19faeb3..0000000 --- a/templates/bfwrapper.tt.ttc +++ /dev/null @@ -1,32 +0,0 @@ -#------------------------------------------------------------------------ -# 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 .= "\n\n\n \n PostgreSQL BuildFarm Status\n \n \n\n\n\n \n\n"; - } }; - if ($@) { - $error = $context->catch($@, \$output); - die $error unless $error->type eq 'return'; - } - - return $output; - }, - DEFBLOCKS => { - - }, -}); diff --git a/templates/dashboard.tt.ttc b/templates/dashboard.tt.ttc deleted file mode 100644 index 91c772a..0000000 --- a/templates/dashboard.tt.ttc +++ /dev/null @@ -1,312 +0,0 @@ -#------------------------------------------------------------------------ -# 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
\n

PostgreSQL BuildFarm Status

\n

\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

\n

\n Use the farm member link for history of that member \n on the relevant branch.\n

\n\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\n"; - #line 44 "/home/community/pgbuildfarm/templates/dashboard.tt" - if ($stash->get(['loop', 0, 'count', 0]) eq 5) { - $output .= ""; - } - - $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
Legendget(['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 .= "
\n
\n \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\n\n"; - } - - $output .= "\nprocess('cl', { 'bgfor' => $stash->get(['row', 0, 'stage', 0]) }); - $output .= ">\n \n \n \n\n \n\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
Branch: "; - #line 52 "/home/community/pgbuildfarm/templates/dashboard.tt" - $output .= $stash->get('brch'); - $output .= "
AliasSystemStatusFlags
get(['row', 0, 'sysname', 0]); - $output .= "&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 .= ""; - #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 .= " "; - #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 .= " "; - #line 66 "/home/community/pgbuildfarm/templates/dashboard.tt" - $output .= $stash->get(['row', 0, 'architecture', 0]); - $output .= ""; - #line 69 "/home/community/pgbuildfarm/templates/dashboard.tt" - - # FILTER - $output .= do { - my $output = ''; - my $filter = $context->filter('replace', [ '\s', ' ' ]) - || $context->throw($context->error); - - $output .= $stash->get(['row', 0, 'when_ago', 0]); - - &$filter($output); - }; - - $output .= " ago \n "; - #line 70 "/home/community/pgbuildfarm/templates/dashboard.tt" - $output .= $stash->get(['row', 0, 'stage', 0]); - $output .= " get(['row', 0, 'sysname', 0]); - $output .= "&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 .= ""; - #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 .= "
\n
\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 .= "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 deleted file mode 100644 index 4713047..0000000 --- a/templates/dyn/history.tt +++ /dev/null @@ -1,69 +0,0 @@ -[%- BLOCK cl %] class="[% SWITCH bgfor -%] - [%- CASE 'OK' %]pass[% CASE 'ContribCheck' %]warn[% CASE [ 'Check' 'InstallCheck' ] %]warnx[% CASE %]fail[% END %]" -[%- END -%] - - - - - PostgreSQL BuildFarm History - - - - -
- -
-

PostgreSQL BuildFarm Status History

- - - - - - - - -
System Detail
Farm member[% member %]
OS[% statrows.0.operating_system %] [% statrows.0.os_version %]
Compiler[% statrows.0.compiler %] [% statrows.0.compiler_version %]
Architecture[% statrows.0.architecture %]
-

Branch: [% branch %][% IF statrows.size >= 240 %] (last 240 entries shown)[% END %]

-[% BLOCK stdet %] - - [%- row.when_ago | replace('\s',' ') %] ago  - [% row.stage -%] - - [%- IF row.stage != 'OK' %]Details[% ELSE %]Config[% END -%] - - -[% END %] - -[% 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 %] [% END %] - -[% END %] -
- - [% FOREACH xrow IN statrows.slice(low,high) %][% PROCESS stdet row=xrow %][% END %] -
-
-
- - diff --git a/templates/dyn/status.tt b/templates/dyn/status.tt deleted file mode 100644 index f17e415..0000000 --- a/templates/dyn/status.tt +++ /dev/null @@ -1,80 +0,0 @@ -[%- BLOCK cl %] class=" [% SWITCH bgfor -%] - [%- CASE 'OK' %]pass[% CASE 'ContribCheck' %]warn[% CASE [ 'Check' 'InstallCheck' ] %]warnx[% CASE %]fail[% END %]" -[%- END -%] - - - - - PostgreSQL BuildFarm Status - - - - -
- -
-

PostgreSQL BuildFarm Status

-

- Shown here is the latest status of each farm member - for each branch it has reported on in the last 30 days. -

-

- Use the farm member link for history of that member - on the relevant branch. -

- -[% brch = "" %] -[% FOREACH row IN statrows %] -[% IF row.branch != brch ; brch = row.branch %] - - -[% END %] - - - - - - -[% END %] -
Branch: [% brch %]
AliasSystemStatus
[% row.sysname %][% row.operating_system %] - [% row.os_version %] - [%- row.compiler %] - [% row.compiler_version %] - [%- row.architecture %] - [%- row.when_ago | replace('\s',' ') %] ago  - [% row.stage -%] - - [%- IF row.stage != 'OK' %]Details[% ELSE %]Config[% END -%]
-
-
- - - - - - - - - - diff --git a/templates/history.tt b/templates/history.tt deleted file mode 100644 index dd050ed..0000000 --- a/templates/history.tt +++ /dev/null @@ -1,56 +0,0 @@ -[%- BLOCK cl %] class="[% SWITCH bgfor -%] - [%- CASE 'OK' %]pass[% CASE 'ContribCheck' %]warn[% CASE [ 'Check' 'InstallCheck' ] %]warnx[% CASE %]fail[% END %]" -[%- END -%] -[% WRAPPER 'page.tt' - title = 'PostgreSQL BuildFarm History' - bodyclass = 'history' - pagebutton = 'none' -%] -

PostgreSQL BuildFarm Status History

- - - - - - - -
System Detail
Farm member[% member %]
OS[% statrows.0.operating_system %] [% statrows.0.os_version %]
Compiler[% statrows.0.compiler %] [% statrows.0.compiler_version %]
Architecture[% statrows.0.architecture %]
Owner[% statrows.0.owner_email %]
-[% IF statrows.0.sys_notes %] -
- - - - - - - - - - -
System NotesDateNotes
[% statrows.0.sys_notes_date %][% statrows.0.sys_notes %]
-[% END %] -

Branch: [% branch %][% IF statrows.size >= hm %] (last [% hm %] entries shown)[% END %]

-[% BLOCK stdet %] - - [%- row.when_ago | replace('\s',' ') %] ago  - [% row.stage -%] - - [%- IF row.stage != 'OK' %]Details[% ELSE %]Config[% END -%] - - -[% END %] - - [% 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 %] [% END %] - - [% END %] -
- [% FOREACH xrow IN statrows.slice(low,high) %][% PROCESS stdet row=xrow %][% END %] -
-[% END %] diff --git a/templates/index.tt b/templates/index.tt deleted file mode 100644 index ad99339..0000000 --- a/templates/index.tt +++ /dev/null @@ -1,38 +0,0 @@ -[%# - - Use this template to generate the index page, with something like: - - tpage index.tt > ../htdocs/index.html - --%] -[% WRAPPER 'page.tt' - title = 'PostgreSQL BuildFarm' - bodyclass = 'none' - pagebutton = 'home' -%] - -

-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. -

-

-To see the current status of tests on various branches, check the -Status Page. -

-

-If you are interested in running a member of the build farm, then please visit -the Registration Page. -We are particularly interested in unusual platforms or combinations of -architecture, operating system and compiler. -

-

To see what is involved in running a buildfarm member, please -read http://wiki.postgresql.org/wiki/PostgreSQL_Buildfarm_Howto. -The client code can be found at the -project page at -PGFoundry. -

-

The build farm software should run on all platforms that can support PostgreSQL. -

-[% END %] diff --git a/templates/log.tt b/templates/log.tt deleted file mode 100644 index da255f2..0000000 --- a/templates/log.tt +++ /dev/null @@ -1,103 +0,0 @@ -[% PERL %] - use POSIX qw(ceil); - my $lrfactor = 6; - $stash->set(lrfactor => $lrfactor); - my $rows = $stash->get('log_file_names'); - my $logrows = ceil(scalar(@$rows)/$lrfactor); - my $logcells = $lrfactor * $logrows; - $stash->set( logcells => $logcells); - $stash->set( logrows => $logrows ); -[% END -%] -[% mytitle = BLOCK %]PostgreSQL BuildFarm | [% IF stage != 'OK' %]Log for system "[% system %]" failure on snapshot taken [% urldt ; ELSE %]Configuration summary for system "[% system %]" snapshot taken [% urldt ; END ; END -%] -[% - cvsurl = 'http://anoncvs.postgresql.org/cvsweb.cgi'; - giturl = scmurl || 'http://git.postgresql.org/gitweb?p=postgresql.git;a=commit;h='; --%] -[% WRAPPER 'page.tt' - title = mytitle - bodyclass = 'none' - pagebutton = 'none' -%] -

PostgreSQL Build Farm Log

-

Details for system "[% system %]"[% IF stage != 'OK' %] failure at stage [% stage ; ELSE %], status 'OK'[% END %], snapshot taken [% urldt %]

- - - - - - - - - - - - - - - - - - -
System InformationFarm memberBranchOSCompilerArchitectureOwner
[% system %][% branch %][% info_row.operating_system %] [% info_row.os_version %][% info_row.compiler %] [% info_row.compiler_version %][% info_row.architecture %][% info_row.owner_email %]
-[% IF info_row.sys_notes %] -
- - - - - - - - - - -
System NotesDateNotes
[% info_row.sys_notes_date %][% info_row.sys_notes %]
-[% END %] -[% cell = 0; FOREACH logstage IN log_file_names ; striplog = logstage.replace('\.log$','') ; cell = loop.count %] - [% IF loop.first %] -
- [% END %] - [% IF loop.count > 1 and loop.count % lrfactor == 1 %][% END %] - - [% IF loop.count % lrfactor == 0 %][% END %] -[% END %] - -[% IF cell > 0 ; nrcell = cell + 1; ncells = [ nrcell .. logcells ] ; FOREACH rcell IN ncells %] - [% IF rcell > 1 and rcell % lrfactor == 1 %][% END %] - - [% IF rcell % lrfactor == 0 %][% END %] - [% END %] -
Stage Logs
[% striplog %]
 
-[% END %] - -

Configuration summary

-
-[% conf | html %]
-
-

Files changed this run

-
-[%- IF changed_this_run.0 -%]
-[%- FOREACH changed IN changed_this_run %]
-[% changed.0 ; IF scm == 'cvs'; ' '; changed.1; END %]
-[%- END -%]
-[%- ELSE %]
-not recorded
-[% END -%]
-
-[% IF stage != 'OK' %] -

Files changed since last success

-
-[%- IF changed_since_success.0 %]
-[%- FOREACH changed IN changed_since_success %]
-[% changed.0 ; IF scm == 'cvs'; ' '; changed.1; END %]
-[%- END -%]
-[%- ELSE %]
-not recorded
-[% END -%]
-
-[% END %] -

Log

-
-[% log | html %]
-
-[% END %] diff --git a/templates/members.tt b/templates/members.tt deleted file mode 100644 index d55e7a5..0000000 --- a/templates/members.tt +++ /dev/null @@ -1,70 +0,0 @@ -[% WRAPPER 'page.tt' - title = 'PostgreSQL BuildFarm Members' - bodyclass = 'members' - pagebutton = 'members' -%] -

PostgreSQL BuildFarm Members

-

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.

-
- - - - - - - - - -[% alt = true %] -[% FOREACH row IN statrows ; - have_recent = 0; - FOREACH branch_days IN row.branches.split(',') ; - branch_fields = branch_days.split(':'); - branch_day = branch_fields.1; - IF branch_day < 365 ; have_recent = 1; END; - END; - IF have_recent ; -%] - [% alt = ! alt %] - - - - - - - -[% END; END %] -
 Name
Owner
OS / VersionCompiler / VersionArchBranches reported on
(most recent report)
[% row.name %]
[% row.owner_email %] -[% IF row.sys_notes %] -
- Notes: ([% row.sys_notes_date %]) [% row.sys_notes %] -[% END %] -
[% row.operating_system %]
[% row.os_version %] - [% prev_osver = row.osversion; - FOREACH personality IN row.personalities; - IF personality.os_version != prev_osver - %] -
w.e.f. [% personality.effective_date %]: [% personality.os_version %] - [% prev_osver = personality.os_version; END; END %] -
[% row.compiler %]
[% row.compiler_version %] - [% prev_compver = row.compiler_version; - FOREACH personality IN row.personalities; - IF personality.compiler_version != prev_compver - %] -
w.e.f. [% personality.effective_date %]: [% personality.compiler_version %] - [% prev_compver = personality.compiler_version; END; END %] -
[% row.arch %][% IF ! row.branches ; ' ' ; END -%] -
    - [%- - FOREACH branch_days IN row.branches.split(',') ; - branch_fields = branch_days.split(':'); - branch = branch_fields.0; - branch_day = branch_fields.1; - IF branch_day < 365 ; - %]
  • [% branch %] ([% branch_day %] days ago)
  • [% END; END %]
- -
-[% END %] diff --git a/templates/page.tt b/templates/page.tt deleted file mode 100644 index f00da9b..0000000 --- a/templates/page.tt +++ /dev/null @@ -1,39 +0,0 @@ - - - - - [% title %] - - - - - -
- -
- [% content %] -
-
-

- Hosting for the PostgreSQL Buildfarm is generously - provided by: - CommandPrompt, The PostgreSQL Company -

-
- - diff --git a/templates/register-form.tt b/templates/register-form.tt deleted file mode 100644 index 0f4f82b..0000000 --- a/templates/register-form.tt +++ /dev/null @@ -1,72 +0,0 @@ -[% WRAPPER 'page.tt' - title = 'PostgreSQL BuildFarm Application' - bodyclass = 'application' - pagebutton = 'register' -%] -

Application to join PostgreSQL BuildFarm

- -

Here is a short description of what is required to join the buildfarm successfully. Please read it carefully -before submitting this form.

- -
    -
  • your machine will need to be able to contact http://www.pgbuildfarm.org - 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).
  • -
  • 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).
  • -
  • Windows only: you will need a native perl installed as well as the one in the MSys DTK. The one from ActiveState works fine.
  • -
  • download and unpack the latest release of client code from - http://pgfoundry.org/frs/?group_id=1000040
  • -
  • read instructions at - http://wiki.postgresql.org/wiki/PostgreSQL_Buildfarm_Howto
  • -
  • get the software running locally using flags --force --nostatus --nosend
  • -
  • register your machine on this page
  • -
  • 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.
  • -
-
- -

Please complete all items.

-

For Linux, please specify the name and version of the Distribution 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".

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Operating System
OS Version
Compiler
Compiler Version
Architecture
Your name
Your email address
[% captcha %]
-
-[% END %] diff --git a/templates/register-incomplete.tt b/templates/register-incomplete.tt deleted file mode 100644 index bc73f41..0000000 --- a/templates/register-incomplete.tt +++ /dev/null @@ -1,9 +0,0 @@ -[% WRAPPER 'page.tt' - title = 'PostgreSQL BuildFarm Application' - bodyclass = 'application' - pagebutton = 'none' -%] -

You need to complete all the form items. -Please click here to try again. -

-[% END %] diff --git a/templates/register-ok.tt b/templates/register-ok.tt deleted file mode 100644 index fdfea96..0000000 --- a/templates/register-ok.tt +++ /dev/null @@ -1,8 +0,0 @@ -[% WRAPPER 'page.tt' - title = 'PostgreSQL BuildFarm Application' - bodyclass = 'application' - pagebutton = 'none' -%] -

PostgreSQL BuildFarm Application received

\ -

Thank you. You should hear from us shortly.

-[% END %] diff --git a/templates/status.tt b/templates/status.tt deleted file mode 100644 index 875c988..0000000 --- a/templates/status.tt +++ /dev/null @@ -1,78 +0,0 @@ -[% - 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', - vpath => '/img/vpath.png', - xml => '/img/xml.png', - 'thread-safety' => '/img/threads.gif', - 'integer-datetimes' = '/img/days.png', - git => '/img/git.png', - } --%] -[%- BLOCK img ; IF flag == 'depend' or flag == 'gnu-ld' ; ; ELSIF flag_imgs.$flag %][% flag %] [% ELSE %][%# - flag ; ' ' -%][% END ; END -%] -[%- BLOCK sysnotes ; IF row.sys_notes %] -[%- ELSE %] [% END ; END -%] -[%- BLOCK cl %] class="[% SWITCH bgfor.replace('-.*','') -%] - [%- CASE 'OK' %]pass[% CASE 'ContribCheck' %]warn[% CASE [ 'Check' 'InstallCheck' ] %]warnx[% CASE %]fail[% END %]" -[%- END -%] -[% WRAPPER 'page.tt' - title = 'PostgreSQL BuildFarm Status' - bodyclass = 'none' - pagebutton = 'status' -%] -

PostgreSQL BuildFarm Status

-

- Shown here is the latest status of each farm member - for each branch it has reported on in the last 30 days. -

-

- Use the farm member link for history of that member - on the relevant branch. -

- -[% FOREACH flagset IN flag_imgs %] - -[% IF loop.count == 7 %][% END %] -[% END %] -
Legend[% flagset.key %] = [% flagset.key %]
-
- -[% brch = "" %] -[% FOREACH row IN statrows %] -[% IF row.branch != brch ; brch = row.branch %] - - -[% END %] - - - - - - - - -[% END %] -
Branch: [% brch %]
AliasSystemStatusFlags
[% row.sysname %][% PROCESS sysnotes %][% row.operating_system %] - [% row.os_version %] - [%- row.compiler %] - [% row.compiler_version %] - [%- row.architecture %] - [%- row.when_ago | replace('\s',' ') %] ago  - [% row.stage -%] - - [%- IF row.stage != 'OK' %]Details[% ELSE %]Config[% END -%][% FOREACH flag IN row.build_flags.split().sort() ; PROCESS img ; END %]
-[% END %] diff --git a/trunk/bf-alerts.pl b/trunk/bf-alerts.pl new file mode 100755 index 0000000..c118cc4 --- /dev/null +++ b/trunk/bf-alerts.pl @@ -0,0 +1,272 @@ +#!/usr/bin/perl + +use strict; + +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; + +# don't use configged dbuser/dbpass + +$dbuser=""; $dbpass=""; + +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 $clear_old = $db->do(q[ + + DELETE FROM alerts + WHERE sysname IN + (SELECT name FROM buildsystems WHERE no_alerts) + ]); + + +my $sth = $db->prepare(q[ + + SELECT DISTINCT ON (sysname, branch) + sysname, branch, + extract(epoch from snapshot at time zone 'GMT')::int as snapshot, + conf_sum as config + FROM build_status s join buildsystems b on (s.sysname = b.name) + WHERE NOT b.no_alerts and + snapshot > current_timestamp - interval '30 days' + ORDER BY sysname, branch, snapshot desc + + ]); + +$sth->execute; + +my @last_heard; + +while (my $row = $sth->fetchrow_hashref) +{ + push(@last_heard, $row); +} + +$sth->finish; + +my $sql = q[ + + SELECT sysname, branch, + extract(epoch from first_alert) as first_alert, + extract(epoch from last_notification) as last_notification + FROM alerts + + ]; + +my $alerts = $db->selectall_hashref($sql,['sysname','branch']); + +my @need_cleared; +my @need_alerts; + +my $clear_sth = $db->prepare(q[ + + DELETE FROM alerts + WHERE sysname = ? + AND branch = ? + ]); + +my $update_sth = $db->prepare(q[ + + UPDATE alerts + SET last_notification = timestamp '1970-01-01' + ( interval '1 second' * $1) + WHERE sysname = $2 + AND branch = $3 + ]); + +my $insert_sth = $db->prepare(q[ + + INSERT INTO alerts ( sysname, branch, first_alert, last_notification ) + VALUES ($1, $2, + timestamp '1970-01-01' + ( interval '1 second' * $3), + timestamp '1970-01-01' + ( interval '1 second' * $4)) + ]); + + +my $now = time; +my $lts = scalar(localtime); +print "starting alert run: $lts\n"; + +foreach my $sysbranch (@last_heard) +{ + # eval the config in a Safe container to protect ourselves + my $container = new Safe; + my $sconf = $sysbranch->{config}; + unless ($sconf =~ s/.*(\$Script_Config)/$1/ms ) + { + $sconf = '$Script_Config={};'; + } + my $client_conf = $container->reval("$sconf;"); + + my %client_alert_settings = %{ $client_conf->{alerts} || {} }; + my $setting = $client_alert_settings{$sysbranch->{branch}}; + unless ($setting && $setting->{alert_after} && $setting->{alert_every}) + { + # if no valid setting, clear any alert and keep going + if ($alerts->{$sysbranch->{sysname}}->{$sysbranch->{branch}}) + { + $clear_sth->execute($sysbranch->{sysname},$sysbranch->{branch}); + push(@need_cleared,[$sysbranch]); + } + next; + } + # ok, we have valid settings. should the alert be on? + my $hours_since_heard = ($now - $sysbranch->{snapshot}) / 3600; + # yep + print + "have settings for $sysbranch->{sysname}:$sysbranch->{branch} ", + "hours since heard = $hours_since_heard, ", + "setting = $setting->{alert_after} / $setting->{alert_every} \n"; + + if ($hours_since_heard > $setting->{alert_after}) + { + my $known_alert = + $alerts->{$sysbranch->{sysname}}->{$sysbranch->{branch}}; + if ($known_alert && + ($now - (3600 * $setting->{alert_every})) > + $known_alert->{last_notification}) + { + # check if it's too old - 15 days and twice initial seems plenty + if ($hours_since_heard > 360 && + $hours_since_heard > 2 * $setting->{alert_after} ) + { + print "alert is too old ... giving up\n"; + next; + } + + # old alert, but time to alert again + print "alert is on, but time to alert again\n"; + $update_sth->execute($now, + $sysbranch->{sysname}, + $sysbranch->{branch}, + ); + push(@need_alerts,[$sysbranch,$setting]); + print "alert updated\n"; + } + elsif ( ! $known_alert ) + { + # new alert + print "new alert needed\n"; + $insert_sth->execute($sysbranch->{sysname}, + $sysbranch->{branch}, + $now,$now); + print "new record inserted\n"; + push(@need_alerts,[$sysbranch,$setting]); + } + } + # nope, so clear the alert if it exists + elsif ($alerts->{$sysbranch->{sysname}}->{$sysbranch->{branch}}) + { + print "clear exisiting alerts"; + $clear_sth->execute($sysbranch->{sysname},$sysbranch->{branch}); + push(@need_cleared,[$sysbranch,$setting]); + } + +} + +print "start emails\n"; + +my $addr_sth = $db->prepare(q[ + + SELECT owner_email + FROM buildsystems + WHERE name = ? + ]); + + +my $me = `id -un`; chomp $me; + +my $host = `hostname`; chomp $host; + + + +foreach my $clearme (@need_cleared) +{ + my ($sysbranch, $setting) = @$clearme; + my ($animal, $branch) = ($sysbranch->{sysname},$sysbranch->{branch}); + my $text; + if ($setting) + { + my $hours = sprintf("%.2f",($now - $sysbranch->{snapshot}) / 3600); + $text = "$sysbranch->{sysname} has now reported " . + "on $sysbranch->{branch} $hours hours ago."; + } + else + { + $text = "$sysbranch->{sysname} has lost alarm settings on branch: " . + "$sysbranch->{branch}. Resetting alarm to off."; + } + my $msg = new Mail::Send; + + $msg->set('From',"PG Build Farm <$me\@$host>"); + + $addr_sth->execute($animal); + + my $mailto = $addr_sth->fetchrow_array; + + print "sending clear to $mailto\n"; + + # $sth->finish; + + $msg->to($mailto); + $msg->subject("PGBuildfarm member $animal Branch $branch Alert cleared"); + my $fh = $msg->open; + print $fh "\n\n$text\n"; + $fh->close; + + print "alert cleared $animal $branch\n"; +} + +foreach my $clearme (@need_alerts) +{ + my ($sysbranch, $setting) = @$clearme; + my ($animal, $branch) = ($sysbranch->{sysname},$sysbranch->{branch}); + my $hours = sprintf("%.2f",($now - $sysbranch->{snapshot}) / 3600); + my $text = "$sysbranch->{sysname} has not reported " . + "on $sysbranch->{branch} for $hours hours."; + my $msg = new Mail::Send; + + $msg->set('From',"PG Build Farm <$me\@$host>"); + + $addr_sth->execute($animal); + + my ($mailto) = $addr_sth->fetchrow_array; + + # $sth->finish; + + print "sending alert to $mailto\n"; + + $msg->to($mailto); + + $msg->subject("PGBuildfarm member $animal Branch $branch " . + "Alert notification"); + my $fh = $msg->open; + print $fh "\n\n$text\n"; + $fh->close; + + print "alert sent $animal $branch\n"; +} + + +print "=================================\n"; + + + diff --git a/trunk/cgi-bin/.htaccess b/trunk/cgi-bin/.htaccess new file mode 100644 index 0000000..ead7338 --- /dev/null +++ b/trunk/cgi-bin/.htaccess @@ -0,0 +1,2 @@ +SetEnv BFConfDir /home/community/pgbuildfarm +SetEnv BF_DEBUG on diff --git a/trunk/cgi-bin/addnotes.pl b/trunk/cgi-bin/addnotes.pl new file mode 100755 index 0000000..acab114 --- /dev/null +++ b/trunk/cgi-bin/addnotes.pl @@ -0,0 +1,116 @@ +#!/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 $sysnotes = $query->param('sysnotes'); + +my $content = "animal=$animal\&sysnotes=$sysnotes"; + +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 && defined($sysnotes) && $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($_); } + ($sysnotes); + +my $set_notes = q{ + + update buildsystems + set sys_notes = nullif($2,''), + sys_notes_ts = case + when coalesce($2,'') <> '' then now() + else null + end + where name = $1 + and status = 'approved' + +}; + +$sth = $db->prepare($set_notes); +my $rv = $sth->execute($animal,$sysnotes); +unless($rv) +{ + print "Status: 460 old data fetch\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/trunk/cgi-bin/envtest.pl b/trunk/cgi-bin/envtest.pl new file mode 100644 index 0000000..6158d18 --- /dev/null +++ b/trunk/cgi-bin/envtest.pl @@ -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/trunk/cgi-bin/get_bf_status_soap.pl b/trunk/cgi-bin/get_bf_status_soap.pl new file mode 100755 index 0000000..02059e7 --- /dev/null +++ b/trunk/cgi-bin/get_bf_status_soap.pl @@ -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/trunk/cgi-bin/pgstatus.pl b/trunk/cgi-bin/pgstatus.pl new file mode 100755 index 0000000..f951aee --- /dev/null +++ b/trunk/cgi-bin/pgstatus.pl @@ -0,0 +1,504 @@ +#!/usr/bin/perl + +use strict; + +use vars qw($dbhost $dbname $dbuser $dbpass $dbport + $all_stat $fail_stat $change_stat $green_stat + $server_time + $min_script_version $min_web_script_version +); + +# force this before we do anything - even load modules +BEGIN { $server_time = time; } + +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 Time::ParseDate; + +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; + +} + +unless ($branch =~ /^(HEAD|REL\d+_\d+_STABLE)$/) +{ + print + "Status: 492 bad branch parameter $branch\nContent-Type: text/plain\n\n", + "bad branch parameter $branch\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 $tsdiff = time - $ts; + +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) || ($ts + 86400 < time ) || (! $secret) ) +{ + open(TX,">../buildlogs/$animal.$date"); + print TX "sig=$sig\nlogtar-len=" , length($log_archive), + "\nstatus=$res\nstage=$stage\nconf:\n$conf\n", + "tsdiff:$tsdiff\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 + 120) +{ + my $gmt = gmtime($ts); + print "Status: 491 bad ts parameter - $ts ($gmt GMT) is in the future.\n", + "Content-Type: text/plain\n\n bad ts parameter - $ts ($gmt GMT) is in the future\n"; + $db->disconnect; + exit; +} + +unless ($ts + 86400 > time) +{ + my $gmt = gmtime($ts); + print "Status: 491 bad ts parameter - $ts ($gmt GMT) is more than 24 hours ago.\n", + "Content-Type: text/plain\n\n bad ts parameter - $ts ($gmt GMT) is more than 24 hours ago.\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); + + +if ($log =~/Last file mtime in snapshot: (.*)/) +{ + my $snaptime = parsedate($1); + if ($snaptime < (time - (10 * 86400))) + { + print "Status: 493 snapshot too old: $1\nContent-Type: text/plain\n\n"; + print "snapshot to old: $1\n"; + $db->disconnect; + exit; + } +} + +($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;"); + +if ($min_script_version) +{ + $client_conf->{script_version} ||= '0.0'; + my ($minmajor,$minminor) = split(/\./,$min_script_version); + my ($smajor,$sminor) = split(/\./,$client_conf->{script_version}); + if ($minmajor > $smajor || ($minmajor == $smajor && $minminor > $sminor)) + { + print "Status: 460 script version too low\nContent-Type: text/plain\n\n"; + print + "Script version is below minimum required\n", + "Reported version: $client_conf->{script_version},", + "Minumum version required: $min_script_version\n"; + $db->disconnect; + exit; + } +} + +if ($min_web_script_version) +{ + $client_conf->{web_script_version} ||= '0.0'; + my ($minmajor,$minminor) = split(/\./,$min_script_version); + my ($smajor,$sminor) = split(/\./,$client_conf->{script_version}); + if ($minmajor > $smajor || ($minmajor == $smajor && $minminor > $sminor)) + { + print "Status: 461 web script version too low\nContent-Type: text/plain\n\n"; + print + "Web Script version is below minimum required\n", + "Reported version: $client_conf->{web_script_version},", + "Minumum version required: $min_web_script_version\n"; + $db->disconnect; + exit; + } +} + +my @config_flags; +if (not exists $client_conf->{config_opts} ) +{ + @config_flags = (); +} +elsif (ref $client_conf->{config_opts} eq 'HASH') +{ + # leave out keys with false values + @config_flags = grep { $client_conf->{config_opts}->{$_} } + keys %{$client_conf->{config_opts}}; +} +elsif (ref $client_conf->{config_opts} eq 'ARRAY' ) +{ + @config_flags = @{$client_conf->{config_opts}}; +} + +if (@config_flags) +{ + @config_flags = grep {! m/=/ } @config_flags; + map {s/\s+//g; $_=qq("$_"); } @config_flags; + push @config_flags,'git' if $client_conf->{scm} eq 'git'; + $config_flags = '{' . join(',',@config_flags) . '}' ; +} + +my $scm = $client_conf->{scm} || 'cvs'; +my $scmurl = $client_conf->{scm_url}; + +my $logst = <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(11,undef,{ pg_type => DBD::Pg::PG_BYTEA }); +$sth->bind_param(12,$config_flags); +$sth->bind_param(13,$scm); +$sth->bind_param(14,$scmurl); + +$sth->execute; +$sth->finish; + +my $logst2 = <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); + $ltext =~ s/\x00/\\0/g; + $sth->execute($animal,$dbdate,$branch,$log_file,$ltext, + "$stage_interval seconds"); +} + + +$sth->finish; + +my $prevst = <prepare($prevst); +$sth->execute($animal,$branch,$dbdate); +my $row=$sth->fetchrow_arrayref; +my $prev_stat=$row->[0]; +$sth->finish; + +my $det_st = <prepare($det_st); +$sth->execute($animal); +$row=$sth->fetchrow_arrayref; +my ($os, $compiler,$arch) = @$row; +$sth->finish; + +$db->begin_work; +$db->do("delete from dashboard_mat"); +$db->do("insert into dashboard_mat select * from dashboard_mat_data"); +$db->commit; + +$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}) +{ + my $client_time = $client_conf->{current_ts}; + open(TX,">>../buildlogs/$animal.$date"); + print TX "\n",Dumper(\$client_conf),"\n"; + print TX "server time: $server_time, client time: $client_time\n" if $client_time; + 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 <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 <close; diff --git a/trunk/cgi-bin/register-form.pl b/trunk/cgi-bin/register-form.pl new file mode 100755 index 0000000..cf4621a --- /dev/null +++ b/trunk/cgi-bin/register-form.pl @@ -0,0 +1,26 @@ +#!/usr/bin/perl + +use strict; +use Template; +use Captcha::reCAPTCHA; + +use vars qw( $template_dir $captcha_pubkey ); +require "$ENV{BFConfDir}/BuildFarmWeb.pl"; + + +my $c = Captcha::reCAPTCHA->new; + +my $captcha = $c->get_html($captcha_pubkey); + +my $template_opts = { INCLUDE_PATH => $template_dir }; +my $template = new Template($template_opts); + +print "Content-Type: text/html\n\n"; + + +$template->process('register-form.tt',{captcha => $captcha}); + + + + + diff --git a/trunk/cgi-bin/register.pl b/trunk/cgi-bin/register.pl new file mode 100755 index 0000000..b15a0e2 --- /dev/null +++ b/trunk/cgi-bin/register.pl @@ -0,0 +1,146 @@ +#!/usr/bin/perl + +use strict; +use DBI; +use Template; +use CGI; +use Template; +use Captcha::reCAPTCHA; + +use vars qw($dbhost $dbname $dbuser $dbpass $dbport $notifyapp $captcha_pubkey $captcha_privkey $template_dir); + +require "$ENV{BFConfDir}/BuildFarmWeb.pl"; + +my $dsn="dbi:Pg:dbname=$dbname"; +$dsn .= ";host=$dbhost" if $dbhost; +$dsn .= ";port=$dbport" if $dbport; + +my $template_opts = { INCLUDE_PATH => $template_dir}; +my $template = new Template($template_opts); +my $query = new CGI; + +my $params = $query->Vars; + +my ($os, $osv, $comp, $compv, $arch, $email, $owner, $challenge, $response ) = @{$params}{ + qw(os osv comp compv arch email owner recaptcha_challenge_field recaptcha_response_field)}; + +my $captcha = Captcha::reCAPTCHA->new; +my $captcha_ok = $captcha->check_answer + ( + $captcha_privkey, + $ENV{'REMOTE_ADDR'}, + $challenge, $response + ); + + +unless ($os && $osv && $comp && $compv && $arch && $email && $owner && $captcha_ok->{is_valid}) +{ + print "Content-Type: text/html\n\n"; + $template->process('register-incomplete.tt'); + exit; +} + +# some idiot has a script that tries to talk to me +# this should catch and dispose of him +if ((grep {/rgergerger|\@pgbuildfarm\.org|Content-Type:|http:|mailto:|href=|None|Unknown/} $os,$osv,$comp,$compv,$arch,$email,$owner) + || ($email =~ /john.*\@aol.com/) ) +{ + print + "Status: 403 Forbidden - go away idiot\n", + "Content-Type: text/plain\n\n"; + exit; +} + +# count transitions to and from upper case +my $trans = 1; +my $counttrans = 0; +foreach (split "" ,"$os$osv$comp$compv$arch$owner") +{ + if (/[A-Z]/) + { + next if $trans; + $trans = 1; + $counttrans++; + } + else + { + next unless $trans; + $trans = 0; + $counttrans++; + } +} + +# reject junk with too many transitions into/outof upper case +if ($counttrans > 20) +{ + 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 = <prepare($statement); +my $rv=$sth->execute($dummyname,$secret,$os,$osv,$comp,$compv, + $arch,$owner,$email); +my $err=$db->errstr; + +# everything looks OK, so tell them so +print "Content-type: text/html\n\n"; +$template->process('register-ok.tt'); + +$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/trunk/cgi-bin/show_history.pl b/trunk/cgi-bin/show_history.pl new file mode 100755 index 0000000..b55c381 --- /dev/null +++ b/trunk/cgi-bin/show_history.pl @@ -0,0 +1,91 @@ +#!/usr/bin/perl + +use strict; +use DBI; +use Template; +use CGI; + +use vars qw($dbhost $dbname $dbuser $dbpass $dbport $template_dir); + + +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+$/; + +my $latest_personality = $db->selectrow_arrayref(q{ + select os_version, compiler_version + from personality + where name = ? + order by effective_date desc limit 1 + }, undef, $member); + +# 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 = <prepare($statement); +$sth->execute($member,$branch); +while (my $row = $sth->fetchrow_hashref) +{ + $row->{owner_email} =~ s/\@/ [ a t ] /; + if ($latest_personality) + { + $row->{os_version} = $latest_personality->[0]; + $row->{compiler_version} = $latest_personality->[1]; + } + push(@$statrows,$row); +} + +$sth->finish; + +$db->disconnect; + +my $template_opts = { INCLUDE_PATH => $template_dir, EVAL_PERL => 1 }; +my $template = new Template($template_opts); + +print "Content-Type: text/html\n\n"; + +$template->process('history.tt', + {statrows=>$statrows, + branch=>$branch, + member => $member, + hm => $hm + }); + +exit; diff --git a/trunk/cgi-bin/show_log.pl b/trunk/cgi-bin/show_log.pl new file mode 100755 index 0000000..663fc26 --- /dev/null +++ b/trunk/cgi-bin/show_log.pl @@ -0,0 +1,134 @@ +#!/usr/bin/perl + +use strict; +use DBI; +use Template; +use CGI; + +use vars qw($dbhost $dbname $dbuser $dbpass $dbport $template_dir @log_file_names); + +require "$ENV{BFConfDir}/BuildFarmWeb.pl"; + +my $template_opts = { INCLUDE_PATH => $template_dir, EVAL_PERL => 1}; +my $template = new Template($template_opts); + +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,$scmurl); +my $scm; + +use vars qw($info_row); + +if ($system && $logdate) +{ + + my $db = DBI->connect($dsn,$dbuser,$dbpass); + + die $DBI::errstr unless $db; + + my $statement = q{ + + select log,conf_sum,stage, changed_this_run, changed_since_success,branch, + log_archive_filenames, scm, scmurl + from build_status + where sysname = ? and snapshot = ? + + }; + 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]; + $scm = $row->[7]; + $scm ||= 'cvs'; # legacy scripts + $scmurl = $row->[8]; + $log_file_names =~ s/^\{(.*)\}$/$1/; + @log_file_names=split(',',$log_file_names) + if $log_file_names; + $sth->finish; + + $statement = q{ + + select operating_system, os_version, + compiler, compiler_version, + architecture, + replace(owner_email,'\@',' [ a t ] ') as owner_email, + sys_notes_ts::date AS sys_notes_date, sys_notes + from buildsystems + where status = 'approved' + and name = ? + + }; + $sth=$db->prepare($statement); + $sth->execute($system); + $info_row=$sth->fetchrow_hashref; + + my $latest_personality = $db->selectrow_arrayref(q{ + select os_version, compiler_version + from personality + where effective_date < ? + and name = ? + order by effective_date desc limit 1 + }, undef, $logdate, $system); + # $sysinfo = join(" ",@$row); + if ($latest_personality) + { + $info_row->{os_version} = $latest_personality->[0]; + $info_row->{compiler_version} = $latest_personality->[1]; + } + $sth->finish; + $db->disconnect; +} + +foreach my $chgd ($changed_this_run,$changed_since_success) +{ + my $cvsurl = 'http://anoncvs.postgresql.org/cvsweb.cgi'; + my $giturl = $scmurl || 'http://git.postgresql.org/gitweb?p=postgresql.git;a=commit;h='; + my @lines = split(/!/,$chgd); + my $changed_rows = []; + foreach (@lines) + { + next if ($scm eq 'cvs' and ! m!^(pgsql|master|REL\d_\d_STABLE)/!); + push(@$changed_rows,[$1,$3]) if (m!(^\S+)(\s+)(\S+)!); + } + $chgd = $changed_rows; +} + +$conf =~ s/\@/ [ a t ] /g; + +print "Content-Type: text/html\n\n"; + +$template->process('log.tt', + { + scm => $scm, + scmurl => $scmurl, + system => $system, + branch => $branch, + stage => $stage, + urldt => $logdate, + log_file_names => \@log_file_names, + conf => $conf, + log => $log, + changed_this_run => $changed_this_run, + changed_since_success => $changed_since_success, + info_row => $info_row, + + }); + diff --git a/trunk/cgi-bin/show_members.pl b/trunk/cgi-bin/show_members.pl new file mode 100755 index 0000000..3bc733c --- /dev/null +++ b/trunk/cgi-bin/show_members.pl @@ -0,0 +1,97 @@ +#!/usr/bin/perl + +use strict; +use CGI; +use DBI; +use Template; + + + +use vars qw($dbhost $dbname $dbuser $dbpass $dbport $template_dir $sort_by); + + +require "$ENV{BFConfDir}/BuildFarmWeb.pl"; +#require "BuildFarmWeb.pl"; + +my $query = new CGI; +my %sort_ok = ('name' => 'lower(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} || $sort_ok{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 = q{ + + select name, operating_system, os_version, compiler, compiler_version, owner_email, + sys_notes_ts::date AS sys_notes_date, sys_notes, + architecture as arch, ARRAY( + select branch || ':' || + extract(days from now() - l.snapshot) + from latest_snapshot l + where l.sysname = s.name + order by branch <> 'HEAD', branch desc + ) as branches, + ARRAY(select compiler_version || '\t' || os_version || '\t' || effective_date + from personality p + where p.name = s.name + order by effective_date + ) as personalities + from buildsystems s + where status = 'approved' +}; + +$statement .= "order by $sort_by"; + +my $statrows=[]; +my $sth=$db->prepare($statement); +$sth->execute; +while (my $row = $sth->fetchrow_hashref) +{ + $row->{branches} =~ s/^\{(.*)\}$/$1/; + my $personalities = $row->{personalities}; + $personalities =~ s/^\{(.*)\}$/$1/; + my @personalities = split(',',$personalities); + $row->{personalities} = []; + foreach my $personality (@personalities) + { + $personality =~ s/^"(.*)"$/$1/; + $personality =~ s/\\(.)/$1/g; + + my ($compiler_version, $os_version, $effective_date) = split(/\t/,$personality); + $effective_date =~ s/ .*//; + push(@{$row->{personalities}}, {compiler_version => $compiler_version, + os_version => $os_version, + effective_date => $effective_date }); + } + $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_opts = { INCLUDE_PATH => $template_dir}; +my $template = new Template($template_opts); + +print "Content-Type: text/html\n\n"; + +$template->process('members.tt', + {statrows=>$statrows}); + +exit; + diff --git a/trunk/cgi-bin/show_stage_log.pl b/trunk/cgi-bin/show_stage_log.pl new file mode 100755 index 0000000..539d5a1 --- /dev/null +++ b/trunk/cgi-bin/show_stage_log.pl @@ -0,0 +1,71 @@ +#!/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 && $stage) +{ + my $db = DBI->connect($dsn,$dbuser,$dbpass); + + die $DBI::errstr unless $db; + + my $statement = q( + + select branch, log_text + from build_status_log + where sysname = ? and snapshot = ? and log_stage = ? || '.log' + + ); + + + + my $sth=$db->prepare($statement); + $sth->execute($system,$logdate,$stage); + my $row=$sth->fetchrow_arrayref; + my ($branch, $logtext) = ("unknown","no log text found"); + if ($row) + { + $branch = $row->[0]; + $logtext =$row->[1]; + } + $sth->finish; + $db->disconnect; + + print "Content-Type: text/plain\n\n", $logtext, + + "-------------------------------------------------\n\n", + "Hosting for the PostgreSQL Buildfarm is generously ", + "provided by: CommandPrompt, The PostgreSQL Company"; + +} + +else +{ + print "Status: 460 bad parameters\n", + "Content-Type: text/plain\n\n"; +} + diff --git a/trunk/cgi-bin/show_status.pl b/trunk/cgi-bin/show_status.pl new file mode 100755 index 0000000..e1a6ef6 --- /dev/null +++ b/trunk/cgi-bin/show_status.pl @@ -0,0 +1,91 @@ +#!/usr/bin/perl + +use strict; +use DBI; +use Template; +use CGI; + +use vars qw($dbhost $dbname $dbuser $dbpass $dbport $template_dir); + + +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 $sort_clause = ""; +my $sortby = $query->param('sortby') || 'nosort'; +if ($sortby eq 'name') +{ + $sort_clause = 'lower(sysname),'; +} +elsif ($sortby eq 'os') +{ + $sort_clause = 'lower(operating_system), os_version desc,'; +} +elsif ($sortby eq 'compiler') +{ + $sort_clause = "lower(compiler), compiler_version,"; +} + +my $db = DBI->connect($dsn,$dbuser,$dbpass) or die("$dsn,$dbuser,$dbpass,$!"); + +my $statement =<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; + # enable-integer-datetimes is now the default + if ($row->{branch} eq 'HEAD' || $row->{branch} gt 'REL8_3_STABLE') + { + $row->{build_flags} .= " --enable-integer-datetimes " + unless ($row->{build_flags} =~ /--(en|dis)able-integer-datetimes/); + } + # enable-thread-safety is now the default + if ($row->{branch} eq 'HEAD' || $row->{branch} gt 'REL8_5_STABLE') + { + $row->{build_flags} .= " --enable-thread-safety " + unless ($row->{build_flags} =~ /--(en|dis)able-thread-safety/); + } + $row->{build_flags} =~ s/--((enable|with)-)?//g; + $row->{build_flags} =~ s/libxml/xml/; + $row->{build_flags} =~ s/\S+=\S+//g; + push(@$statrows,$row); +} +$sth->finish; + + +$db->disconnect; + + +my $template_opts = { INCLUDE_PATH => $template_dir }; +my $template = new Template($template_opts); + +print "Content-Type: text/html\n\n"; + +$template->process('status.tt', + {statrows=>$statrows}); + +exit; + diff --git a/trunk/cgi-bin/show_status_soap.pl b/trunk/cgi-bin/show_status_soap.pl new file mode 100755 index 0000000..5d12800 --- /dev/null +++ b/trunk/cgi-bin/show_status_soap.pl @@ -0,0 +1,78 @@ +#!/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 =<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/trunk/cgi-bin/test.pl b/trunk/cgi-bin/test.pl new file mode 100755 index 0000000..9b179d2 --- /dev/null +++ b/trunk/cgi-bin/test.pl @@ -0,0 +1,24 @@ +#!/usr/bin/perl + +#print "Content-Type: text/html\n\n"; +#print "

My quick perl hello

"; + +use CGI; + +my $query = new CGI; + +my $url = $query->url(); + +my $base = $query->url(-base=>1); + +print <connect($dsn,$dbuser,$dbpass) or die("$dsn,$dbuser,$dbpass,$!"); + +my %words; + +my $sql = q{ + select sysname, max(snapshot) as snapshot + from build_status_log + where branch = 'HEAD' and + log_stage = 'typedefs.log' and + snapshot > current_date::timestamp - interval '30 days' + group by sysname +}; +my $builds = $dbh->selectall_arrayref($sql, { Slice => {} }); + + +if ($query->param('show_list')) +{ + print "Content-Type: text/html\n\n", + "Typedefs URLs\n", + "

Typdefs URLs

\n", + "\n"; + + foreach my $build (@$builds) + { + print "\n"; + } + print "
member
$build->{sysname}
\n"; + exit; +} + +$sql = q{ + select log_text + from build_status_log + where sysname = ? + and snapshot = ? + and log_stage = 'typedefs.log' + and branch = 'HEAD' + }; + +my $sth = $dbh->prepare($sql); + +foreach my $build (@$builds) +{ + $sth->execute($build->{sysname},$build->{snapshot}); + my @row = $sth->fetchrow; + my @typedefs = split(/\s+/,$row[0]); + @words{@typedefs} = 1 x @typedefs; +} + +print "Content-Type: text/plain\n\n", + join("\n",sort keys %words), + "\n"; diff --git a/trunk/cgi-bin/upgrade.pl b/trunk/cgi-bin/upgrade.pl new file mode 100755 index 0000000..f4cbb99 --- /dev/null +++ b/trunk/cgi-bin/upgrade.pl @@ -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/trunk/htdocs/bfweb.tgz b/trunk/htdocs/bfweb.tgz new file mode 100644 index 0000000..4ed50ab Binary files /dev/null and b/trunk/htdocs/bfweb.tgz differ diff --git a/trunk/htdocs/elephant-head_only.gif b/trunk/htdocs/elephant-head_only.gif new file mode 100644 index 0000000..dd791da Binary files /dev/null and b/trunk/htdocs/elephant-head_only.gif differ diff --git a/trunk/htdocs/elephant-icon.png b/trunk/htdocs/elephant-icon.png new file mode 100644 index 0000000..278bfd8 Binary files /dev/null and b/trunk/htdocs/elephant-icon.png differ diff --git a/trunk/htdocs/elephant5.gif b/trunk/htdocs/elephant5.gif new file mode 100644 index 0000000..cb9da33 Binary files /dev/null and b/trunk/htdocs/elephant5.gif differ diff --git a/trunk/htdocs/elephant5a.gif b/trunk/htdocs/elephant5a.gif new file mode 100644 index 0000000..076cb9d Binary files /dev/null and b/trunk/htdocs/elephant5a.gif differ diff --git a/trunk/htdocs/img/blank.gif b/trunk/htdocs/img/blank.gif new file mode 100644 index 0000000..448d4c4 Binary files /dev/null and b/trunk/htdocs/img/blank.gif differ diff --git a/trunk/htdocs/img/bug.png b/trunk/htdocs/img/bug.png new file mode 100644 index 0000000..2e92af1 Binary files /dev/null and b/trunk/htdocs/img/bug.png differ diff --git a/trunk/htdocs/img/camel.png b/trunk/htdocs/img/camel.png new file mode 100644 index 0000000..95ca8c5 Binary files /dev/null and b/trunk/htdocs/img/camel.png differ diff --git a/trunk/htdocs/img/cassert.png b/trunk/htdocs/img/cassert.png new file mode 100644 index 0000000..5b9241f Binary files /dev/null and b/trunk/htdocs/img/cassert.png differ diff --git a/trunk/htdocs/img/days.png b/trunk/htdocs/img/days.png new file mode 100644 index 0000000..ae24849 Binary files /dev/null and b/trunk/htdocs/img/days.png differ diff --git a/trunk/htdocs/img/git.png b/trunk/htdocs/img/git.png new file mode 100644 index 0000000..de637c0 Binary files /dev/null and b/trunk/htdocs/img/git.png differ diff --git a/trunk/htdocs/img/info.gif b/trunk/htdocs/img/info.gif new file mode 100644 index 0000000..ef510fa Binary files /dev/null and b/trunk/htdocs/img/info.gif differ diff --git a/trunk/htdocs/img/kerberos.png b/trunk/htdocs/img/kerberos.png new file mode 100644 index 0000000..80a9c46 Binary files /dev/null and b/trunk/htdocs/img/kerberos.png differ diff --git a/trunk/htdocs/img/krb.gif b/trunk/htdocs/img/krb.gif new file mode 100644 index 0000000..c1cfcbf Binary files /dev/null and b/trunk/htdocs/img/krb.gif differ diff --git a/trunk/htdocs/img/notes.png b/trunk/htdocs/img/notes.png new file mode 100644 index 0000000..c6e4133 Binary files /dev/null and b/trunk/htdocs/img/notes.png differ diff --git a/trunk/htdocs/img/pam.png b/trunk/htdocs/img/pam.png new file mode 100644 index 0000000..a1015e8 Binary files /dev/null and b/trunk/htdocs/img/pam.png differ diff --git a/trunk/htdocs/img/python.png b/trunk/htdocs/img/python.png new file mode 100644 index 0000000..a7ea47b Binary files /dev/null and b/trunk/htdocs/img/python.png differ diff --git a/trunk/htdocs/img/ssl_icon.gif b/trunk/htdocs/img/ssl_icon.gif new file mode 100644 index 0000000..2d34d76 Binary files /dev/null and b/trunk/htdocs/img/ssl_icon.gif differ diff --git a/trunk/htdocs/img/tcl.png b/trunk/htdocs/img/tcl.png new file mode 100644 index 0000000..957e760 Binary files /dev/null and b/trunk/htdocs/img/tcl.png differ diff --git a/trunk/htdocs/img/threads.gif b/trunk/htdocs/img/threads.gif new file mode 100644 index 0000000..3068767 Binary files /dev/null and b/trunk/htdocs/img/threads.gif differ diff --git a/trunk/htdocs/img/translateicon.gif b/trunk/htdocs/img/translateicon.gif new file mode 100644 index 0000000..104a5ed Binary files /dev/null and b/trunk/htdocs/img/translateicon.gif differ diff --git a/trunk/htdocs/img/vpath.png b/trunk/htdocs/img/vpath.png new file mode 100644 index 0000000..9859b01 Binary files /dev/null and b/trunk/htdocs/img/vpath.png differ diff --git a/trunk/htdocs/img/xml.png b/trunk/htdocs/img/xml.png new file mode 100644 index 0000000..8b16889 Binary files /dev/null and b/trunk/htdocs/img/xml.png differ diff --git a/trunk/htdocs/inc/b/l.png b/trunk/htdocs/inc/b/l.png new file mode 100644 index 0000000..19a036d Binary files /dev/null and b/trunk/htdocs/inc/b/l.png differ diff --git a/trunk/htdocs/inc/b/r.png b/trunk/htdocs/inc/b/r.png new file mode 100644 index 0000000..640199c Binary files /dev/null and b/trunk/htdocs/inc/b/r.png differ diff --git a/trunk/htdocs/inc/pgbf.css b/trunk/htdocs/inc/pgbf.css new file mode 100644 index 0000000..0873d6d --- /dev/null +++ b/trunk/htdocs/inc/pgbf.css @@ -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; + +} + +#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/trunk/htdocs/inc/pgbuildfarm-banner.png b/trunk/htdocs/inc/pgbuildfarm-banner.png new file mode 100644 index 0000000..4698817 Binary files /dev/null and b/trunk/htdocs/inc/pgbuildfarm-banner.png differ diff --git a/trunk/htdocs/index.html b/trunk/htdocs/index.html new file mode 100644 index 0000000..b17ceb2 --- /dev/null +++ b/trunk/htdocs/index.html @@ -0,0 +1,66 @@ + + + + + PostgreSQL BuildFarm + + + + + +
+ +
+ + +

+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. +

+

+To see the current status of tests on various branches, check the +Status Page. +

+

+If you are interested in running a member of the build farm, then please visit +the Registration Page. +We are particularly interested in unusual platforms or combinations of +architecture, operating system and compiler. +

+

To see what is involved in running a buildfarm member, please +read http://wiki.postgresql.org/wiki/PostgreSQL_Buildfarm_Howto. +The client code can be found at the +project page at +PGFoundry. +

+

The build farm software should run on all platforms that can support PostgreSQL. +

+ +
+
+

+ Hosting for the PostgreSQL Buildfarm is generously + provided by: + CommandPrompt, The PostgreSQL Company +

+
+ + + diff --git a/trunk/htdocs/robots.txt b/trunk/htdocs/robots.txt new file mode 100644 index 0000000..1b425ee --- /dev/null +++ b/trunk/htdocs/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: /cgi-bin/ diff --git a/trunk/schema/bfwebdb.sql b/trunk/schema/bfwebdb.sql new file mode 100644 index 0000000..2e575b0 --- /dev/null +++ b/trunk/schema/bfwebdb.sql @@ -0,0 +1,708 @@ +-- +-- 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; + +-- +-- Name: set_latest(); Type: FUNCTION; Schema: public; Owner: pgbuildfarm +-- + +CREATE FUNCTION set_latest() RETURNS "trigger" + AS $$ + + begin + update latest_snapshot + set snapshot = + (case when snapshot > NEW.snapshot then snapshot else NEW.snapshot end) + where sysname = NEW.sysname and + branch = NEW.branch; + if not found then + insert into latest_snapshot + values(NEW.sysname, NEW.branch, NEW.snapshot); + end if; + return NEW; + end; +$$ + LANGUAGE plpgsql; + + +ALTER FUNCTION public.set_latest() OWNER TO pgbuildfarm; + +-- +-- Name: target(text); Type: FUNCTION; Schema: public; Owner: pgbuildfarm +-- + +CREATE FUNCTION target(t text) RETURNS text + AS $_$ my $log = shift; $log =~ s/.*(Target:[^\n]*).*/$1/s; return $log; $_$ + LANGUAGE plperl; + + +ALTER FUNCTION public.target(t text) OWNER TO pgbuildfarm; + +-- +-- Name: transitions(text, text, text, text, text, text); Type: FUNCTION; Schema: public; Owner: pgbuildfarm +-- + +CREATE FUNCTION transitions(text, text, text, text, text, text) RETURNS integer + AS $_$ + +my ($os,$osv,$comp,$compv,$arch,$owner) = @_; +# count transitions to and from upper case +my $trans = 1; +my $counttrans = 0; +foreach (split "" ,"$os$osv$comp$compv$arch$owner") +{ + if (/[A-Z]/) + { + next if $trans; + $trans = 1; + $counttrans++; + } + else + { + next unless $trans; + $trans = 0; + $counttrans++; + } +} + +return $counttrans; + +$_$ + LANGUAGE plperl; + + +ALTER FUNCTION public.transitions(text, text, text, text, text, text) 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, + scm text, + scmurl text +); + + +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, + no_alerts boolean DEFAULT false, + sys_notes text, + sys_notes_ts timestamp with 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: latest_snapshot; Type: TABLE; Schema: public; Owner: pgbuildfarm; Tablespace: +-- + +CREATE TABLE latest_snapshot ( + sysname text NOT NULL, + branch text NOT NULL, + snapshot timestamp without time zone NOT NULL +); + + +ALTER TABLE public.latest_snapshot 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: dashboard; Type: VIEW; Schema: public; Owner: pgbuildfarm +-- + +CREATE VIEW dashboard AS + SELECT ((timezone('GMT'::text, now()))::timestamp(0) without time zone - b.snapshot) AS when_ago, b.sysname, b.snapshot, b.status, b.stage, b.branch, b.build_flags, s.operating_system, COALESCE(b.os_version, s.os_version) AS os_version, s.compiler, COALESCE(b.compiler_version, s.compiler_version) AS compiler_version, s.architecture FROM buildsystems s, (SELECT DISTINCT ON (bs.sysname, bs.branch, bs.report_time) bs.sysname, bs.snapshot, bs.status, bs.stage, bs.branch, bs.build_flags, bs.report_time, p.compiler_version, p.os_version FROM ((build_status bs NATURAL JOIN latest_snapshot m) LEFT JOIN personality p ON (((p.name = bs.sysname) AND (p.effective_date <= bs.report_time)))) WHERE (m.snapshot > (now() - '30 days'::interval)) ORDER BY bs.sysname, bs.branch, bs.report_time, (p.effective_date IS NULL), p.effective_date DESC) b WHERE ((s.name = b.sysname) AND (s.status = 'approved'::text)); + + +ALTER TABLE public.dashboard OWNER TO pgbuildfarm; + +-- +-- Name: dashboard_ex; Type: VIEW; Schema: public; Owner: pgbuildfarm +-- + +CREATE VIEW dashboard_ex AS + SELECT ((timezone('GMT'::text, now()))::timestamp(0) without time zone - b.snapshot) AS when_ago, b.sysname, b.snapshot, b.status, b.stage, b.branch, b.build_flags, s.operating_system, COALESCE(b.os_version, s.os_version) AS os_version, s.compiler, COALESCE(b.compiler_version, s.compiler_version) AS compiler_version, s.architecture, s.sys_notes, (s.sys_notes_ts)::date AS sys_notes_date FROM buildsystems s, (SELECT DISTINCT ON (bs.sysname, bs.branch, bs.report_time) bs.sysname, bs.snapshot, bs.status, bs.stage, bs.branch, bs.build_flags, bs.report_time, p.compiler_version, p.os_version FROM ((build_status bs NATURAL JOIN latest_snapshot m) LEFT JOIN personality p ON (((p.name = bs.sysname) AND (p.effective_date <= bs.report_time)))) WHERE (m.snapshot > (now() - '30 days'::interval)) ORDER BY bs.sysname, bs.branch, bs.report_time, (p.effective_date IS NULL), p.effective_date DESC) b WHERE ((s.name = b.sysname) AND (s.status = 'approved'::text)); + + +ALTER TABLE public.dashboard_ex OWNER TO pgbuildfarm; + +-- +-- Name: dashboard_mat; Type: TABLE; Schema: public; Owner: pgbfweb; Tablespace: +-- + +CREATE TABLE dashboard_mat ( + sysname text, + snapshot timestamp without time zone, + status integer, + stage text, + branch text, + build_flags text[], + operating_system text, + os_version text, + compiler text, + compiler_version text, + architecture text +); + + +ALTER TABLE public.dashboard_mat OWNER TO pgbfweb; + +-- +-- Name: dashboard_mat_data; Type: VIEW; Schema: public; Owner: pgbuildfarm +-- + +CREATE VIEW dashboard_mat_data AS + SELECT b.sysname, b.snapshot, b.status, b.stage, b.branch, b.build_flags, s.operating_system, COALESCE(b.os_version, s.os_version) AS os_version, s.compiler, COALESCE(b.compiler_version, s.compiler_version) AS compiler_version, s.architecture FROM buildsystems s, (SELECT DISTINCT ON (bs.sysname, bs.branch, bs.report_time) bs.sysname, bs.snapshot, bs.status, bs.stage, bs.branch, bs.build_flags, bs.report_time, p.compiler_version, p.os_version FROM ((build_status bs NATURAL JOIN latest_snapshot m) LEFT JOIN personality p ON (((p.name = bs.sysname) AND (p.effective_date <= bs.report_time)))) WHERE (m.snapshot > (now() - '30 days'::interval)) ORDER BY bs.sysname, bs.branch, bs.report_time, (p.effective_date IS NULL), p.effective_date DESC) b WHERE ((s.name = b.sysname) AND (s.status = 'approved'::text)); + + +ALTER TABLE public.dashboard_mat_data OWNER TO pgbuildfarm; + +-- +-- Name: dashboard_mat_data2; Type: VIEW; Schema: public; Owner: pgbuildfarm +-- + +CREATE VIEW dashboard_mat_data2 AS + SELECT b.sysname, b.snapshot, b.status, b.stage, b.branch, CASE WHEN ((b.conf_sum ~ 'use_vpath'::text) AND (b.conf_sum !~ '''use_vpath'' => undef'::text)) THEN (b.build_flags || 'vpath'::text) ELSE b.build_flags END AS build_flags, s.operating_system, COALESCE(b.os_version, s.os_version) AS os_version, s.compiler, COALESCE(b.compiler_version, s.compiler_version) AS compiler_version, s.architecture FROM buildsystems s, (SELECT DISTINCT ON (bs.sysname, bs.branch, bs.report_time) bs.sysname, bs.snapshot, bs.status, bs.stage, bs.branch, bs.build_flags, bs.conf_sum, bs.report_time, p.compiler_version, p.os_version FROM ((build_status bs NATURAL JOIN latest_snapshot m) LEFT JOIN personality p ON (((p.name = bs.sysname) AND (p.effective_date <= bs.report_time)))) WHERE (m.snapshot > (now() - '30 days'::interval)) ORDER BY bs.sysname, bs.branch, bs.report_time, (p.effective_date IS NULL), p.effective_date DESC) b WHERE ((s.name = b.sysname) AND (s.status = 'approved'::text)); + + +ALTER TABLE public.dashboard_mat_data2 OWNER TO pgbuildfarm; + +-- +-- Name: failures; Type: VIEW; Schema: public; Owner: pgbuildfarm +-- + +CREATE VIEW failures AS + SELECT build_status.sysname, build_status.snapshot, build_status.stage, build_status.conf_sum, build_status.branch, build_status.changed_this_run, build_status.changed_since_success, build_status.log_archive_filenames, build_status.build_flags, build_status.report_time FROM build_status WHERE (((build_status.stage <> 'OK'::text) AND (build_status.stage !~~ 'CVS%'::text)) AND (build_status.report_time IS NOT NULL)); + + +ALTER TABLE public.failures 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: recent_failures; Type: VIEW; Schema: public; Owner: pgbuildfarm +-- + +CREATE VIEW recent_failures AS + SELECT build_status.sysname, build_status.snapshot, build_status.stage, build_status.conf_sum, build_status.branch, build_status.changed_this_run, build_status.changed_since_success, build_status.log_archive_filenames, build_status.build_flags, build_status.report_time, build_status.log FROM build_status WHERE ((((build_status.stage <> 'OK'::text) AND (build_status.stage !~~ 'CVS%'::text)) AND (build_status.report_time IS NOT NULL)) AND ((build_status.snapshot + '3 mons'::interval) > ('now'::text)::timestamp(6) with time zone)); + + +ALTER TABLE public.recent_failures 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: latest_snapshot_pkey; Type: CONSTRAINT; Schema: public; Owner: pgbuildfarm; Tablespace: +-- + +ALTER TABLE ONLY latest_snapshot + ADD CONSTRAINT latest_snapshot_pkey PRIMARY KEY (sysname, branch); + + +ALTER INDEX public.latest_snapshot_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: build_status_log_snapshot_idx; Type: INDEX; Schema: public; Owner: pgbuildfarm; Tablespace: +-- + +CREATE INDEX build_status_log_snapshot_idx ON build_status_log USING btree (snapshot); + + +ALTER INDEX public.build_status_log_snapshot_idx OWNER TO pgbuildfarm; + +-- +-- Name: set_latest_snapshot; Type: TRIGGER; Schema: public; Owner: pgbuildfarm +-- + +CREATE TRIGGER set_latest_snapshot + AFTER INSERT ON build_status + FOR EACH ROW + EXECUTE PROCEDURE set_latest(); + + +-- +-- 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 UPDATE CASCADE ON DELETE CASCADE; + + +-- +-- Name: personality_build_systems_name_fk; Type: FK CONSTRAINT; Schema: public; Owner: pgbuildfarm +-- + +ALTER TABLE ONLY personality + ADD CONSTRAINT personality_build_systems_name_fk FOREIGN KEY (name) REFERENCES buildsystems(name) ON UPDATE CASCADE 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,UPDATE ON TABLE buildsystems TO pgbfweb; +GRANT SELECT ON TABLE buildsystems TO rssfeed; + + +-- +-- Name: latest_snapshot; Type: ACL; Schema: public; Owner: pgbuildfarm +-- + +REVOKE ALL ON TABLE latest_snapshot FROM PUBLIC; +REVOKE ALL ON TABLE latest_snapshot FROM pgbuildfarm; +GRANT ALL ON TABLE latest_snapshot TO pgbuildfarm; +GRANT INSERT,SELECT,UPDATE,DELETE ON TABLE latest_snapshot TO pgbfweb; + + +-- +-- 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; + + +-- +-- Name: dashboard; Type: ACL; Schema: public; Owner: pgbuildfarm +-- + +REVOKE ALL ON TABLE dashboard FROM PUBLIC; +REVOKE ALL ON TABLE dashboard FROM pgbuildfarm; +GRANT ALL ON TABLE dashboard TO pgbuildfarm; +GRANT SELECT ON TABLE dashboard TO pgbfweb; + + +-- +-- Name: dashboard_ex; Type: ACL; Schema: public; Owner: pgbuildfarm +-- + +REVOKE ALL ON TABLE dashboard_ex FROM PUBLIC; +REVOKE ALL ON TABLE dashboard_ex FROM pgbuildfarm; +GRANT ALL ON TABLE dashboard_ex TO pgbuildfarm; +GRANT SELECT ON TABLE dashboard_ex TO pgbfweb; + + +-- +-- Name: dashboard_mat; Type: ACL; Schema: public; Owner: pgbfweb +-- + +REVOKE ALL ON TABLE dashboard_mat FROM PUBLIC; +REVOKE ALL ON TABLE dashboard_mat FROM pgbfweb; +GRANT ALL ON TABLE dashboard_mat TO pgbfweb; + + +-- +-- Name: dashboard_mat_data; Type: ACL; Schema: public; Owner: pgbuildfarm +-- + +REVOKE ALL ON TABLE dashboard_mat_data FROM PUBLIC; +REVOKE ALL ON TABLE dashboard_mat_data FROM pgbuildfarm; +GRANT ALL ON TABLE dashboard_mat_data TO pgbuildfarm; +GRANT SELECT ON TABLE dashboard_mat_data TO pgbfweb; + + +-- +-- Name: dashboard_mat_data2; Type: ACL; Schema: public; Owner: pgbuildfarm +-- + +REVOKE ALL ON TABLE dashboard_mat_data2 FROM PUBLIC; +REVOKE ALL ON TABLE dashboard_mat_data2 FROM pgbuildfarm; +GRANT ALL ON TABLE dashboard_mat_data2 TO pgbuildfarm; +GRANT SELECT ON TABLE dashboard_mat_data2 TO pgbfweb; + + +-- +-- PostgreSQL database dump complete +-- + diff --git a/trunk/templates/bfwrapper.tt.ttc b/trunk/templates/bfwrapper.tt.ttc new file mode 100644 index 0000000..19faeb3 --- /dev/null +++ b/trunk/templates/bfwrapper.tt.ttc @@ -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 .= "\n\n\n \n PostgreSQL BuildFarm Status\n \n \n\n\n\n \n\n"; + } }; + if ($@) { + $error = $context->catch($@, \$output); + die $error unless $error->type eq 'return'; + } + + return $output; + }, + DEFBLOCKS => { + + }, +}); diff --git a/trunk/templates/dashboard.tt.ttc b/trunk/templates/dashboard.tt.ttc new file mode 100644 index 0000000..91c772a --- /dev/null +++ b/trunk/templates/dashboard.tt.ttc @@ -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
\n

PostgreSQL BuildFarm Status

\n

\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

\n

\n Use the farm member link for history of that member \n on the relevant branch.\n

\n\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\n"; + #line 44 "/home/community/pgbuildfarm/templates/dashboard.tt" + if ($stash->get(['loop', 0, 'count', 0]) eq 5) { + $output .= ""; + } + + $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
Legendget(['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 .= "
\n
\n \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\n\n"; + } + + $output .= "\nprocess('cl', { 'bgfor' => $stash->get(['row', 0, 'stage', 0]) }); + $output .= ">\n \n \n \n\n \n\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
Branch: "; + #line 52 "/home/community/pgbuildfarm/templates/dashboard.tt" + $output .= $stash->get('brch'); + $output .= "
AliasSystemStatusFlags
get(['row', 0, 'sysname', 0]); + $output .= "&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 .= ""; + #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 .= " "; + #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 .= " "; + #line 66 "/home/community/pgbuildfarm/templates/dashboard.tt" + $output .= $stash->get(['row', 0, 'architecture', 0]); + $output .= ""; + #line 69 "/home/community/pgbuildfarm/templates/dashboard.tt" + + # FILTER + $output .= do { + my $output = ''; + my $filter = $context->filter('replace', [ '\s', ' ' ]) + || $context->throw($context->error); + + $output .= $stash->get(['row', 0, 'when_ago', 0]); + + &$filter($output); + }; + + $output .= " ago \n "; + #line 70 "/home/community/pgbuildfarm/templates/dashboard.tt" + $output .= $stash->get(['row', 0, 'stage', 0]); + $output .= " get(['row', 0, 'sysname', 0]); + $output .= "&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 .= ""; + #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 .= "
\n
\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 .= "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/trunk/templates/dyn/history.tt b/trunk/templates/dyn/history.tt new file mode 100644 index 0000000..4713047 --- /dev/null +++ b/trunk/templates/dyn/history.tt @@ -0,0 +1,69 @@ +[%- BLOCK cl %] class="[% SWITCH bgfor -%] + [%- CASE 'OK' %]pass[% CASE 'ContribCheck' %]warn[% CASE [ 'Check' 'InstallCheck' ] %]warnx[% CASE %]fail[% END %]" +[%- END -%] + + + + + PostgreSQL BuildFarm History + + + + +
+ +
+

PostgreSQL BuildFarm Status History

+ + + + + + + + +
System Detail
Farm member[% member %]
OS[% statrows.0.operating_system %] [% statrows.0.os_version %]
Compiler[% statrows.0.compiler %] [% statrows.0.compiler_version %]
Architecture[% statrows.0.architecture %]
+

Branch: [% branch %][% IF statrows.size >= 240 %] (last 240 entries shown)[% END %]

+[% BLOCK stdet %] + + [%- row.when_ago | replace('\s',' ') %] ago  + [% row.stage -%] + + [%- IF row.stage != 'OK' %]Details[% ELSE %]Config[% END -%] + + +[% END %] + +[% 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 %] [% END %] + +[% END %] +
+ + [% FOREACH xrow IN statrows.slice(low,high) %][% PROCESS stdet row=xrow %][% END %] +
+
+
+ + diff --git a/trunk/templates/dyn/status.tt b/trunk/templates/dyn/status.tt new file mode 100644 index 0000000..f17e415 --- /dev/null +++ b/trunk/templates/dyn/status.tt @@ -0,0 +1,80 @@ +[%- BLOCK cl %] class=" [% SWITCH bgfor -%] + [%- CASE 'OK' %]pass[% CASE 'ContribCheck' %]warn[% CASE [ 'Check' 'InstallCheck' ] %]warnx[% CASE %]fail[% END %]" +[%- END -%] + + + + + PostgreSQL BuildFarm Status + + + + +
+ +
+

PostgreSQL BuildFarm Status

+

+ Shown here is the latest status of each farm member + for each branch it has reported on in the last 30 days. +

+

+ Use the farm member link for history of that member + on the relevant branch. +

+ +[% brch = "" %] +[% FOREACH row IN statrows %] +[% IF row.branch != brch ; brch = row.branch %] + + +[% END %] + + + + + + +[% END %] +
Branch: [% brch %]
AliasSystemStatus
[% row.sysname %][% row.operating_system %] + [% row.os_version %] + [%- row.compiler %] + [% row.compiler_version %] + [%- row.architecture %] + [%- row.when_ago | replace('\s',' ') %] ago  + [% row.stage -%] + + [%- IF row.stage != 'OK' %]Details[% ELSE %]Config[% END -%]
+
+
+ + + + + + + + + + diff --git a/trunk/templates/history.tt b/trunk/templates/history.tt new file mode 100644 index 0000000..dd050ed --- /dev/null +++ b/trunk/templates/history.tt @@ -0,0 +1,56 @@ +[%- BLOCK cl %] class="[% SWITCH bgfor -%] + [%- CASE 'OK' %]pass[% CASE 'ContribCheck' %]warn[% CASE [ 'Check' 'InstallCheck' ] %]warnx[% CASE %]fail[% END %]" +[%- END -%] +[% WRAPPER 'page.tt' + title = 'PostgreSQL BuildFarm History' + bodyclass = 'history' + pagebutton = 'none' +%] +

PostgreSQL BuildFarm Status History

+ + + + + + + +
System Detail
Farm member[% member %]
OS[% statrows.0.operating_system %] [% statrows.0.os_version %]
Compiler[% statrows.0.compiler %] [% statrows.0.compiler_version %]
Architecture[% statrows.0.architecture %]
Owner[% statrows.0.owner_email %]
+[% IF statrows.0.sys_notes %] +
+ + + + + + + + + + +
System NotesDateNotes
[% statrows.0.sys_notes_date %][% statrows.0.sys_notes %]
+[% END %] +

Branch: [% branch %][% IF statrows.size >= hm %] (last [% hm %] entries shown)[% END %]

+[% BLOCK stdet %] + + [%- row.when_ago | replace('\s',' ') %] ago  + [% row.stage -%] + + [%- IF row.stage != 'OK' %]Details[% ELSE %]Config[% END -%] + + +[% END %] + + [% 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 %] [% END %] + + [% END %] +
+ [% FOREACH xrow IN statrows.slice(low,high) %][% PROCESS stdet row=xrow %][% END %] +
+[% END %] diff --git a/trunk/templates/index.tt b/trunk/templates/index.tt new file mode 100644 index 0000000..ad99339 --- /dev/null +++ b/trunk/templates/index.tt @@ -0,0 +1,38 @@ +[%# + + Use this template to generate the index page, with something like: + + tpage index.tt > ../htdocs/index.html + +-%] +[% WRAPPER 'page.tt' + title = 'PostgreSQL BuildFarm' + bodyclass = 'none' + pagebutton = 'home' +%] + +

+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. +

+

+To see the current status of tests on various branches, check the +Status Page. +

+

+If you are interested in running a member of the build farm, then please visit +the Registration Page. +We are particularly interested in unusual platforms or combinations of +architecture, operating system and compiler. +

+

To see what is involved in running a buildfarm member, please +read http://wiki.postgresql.org/wiki/PostgreSQL_Buildfarm_Howto. +The client code can be found at the +project page at +PGFoundry. +

+

The build farm software should run on all platforms that can support PostgreSQL. +

+[% END %] diff --git a/trunk/templates/log.tt b/trunk/templates/log.tt new file mode 100644 index 0000000..da255f2 --- /dev/null +++ b/trunk/templates/log.tt @@ -0,0 +1,103 @@ +[% PERL %] + use POSIX qw(ceil); + my $lrfactor = 6; + $stash->set(lrfactor => $lrfactor); + my $rows = $stash->get('log_file_names'); + my $logrows = ceil(scalar(@$rows)/$lrfactor); + my $logcells = $lrfactor * $logrows; + $stash->set( logcells => $logcells); + $stash->set( logrows => $logrows ); +[% END -%] +[% mytitle = BLOCK %]PostgreSQL BuildFarm | [% IF stage != 'OK' %]Log for system "[% system %]" failure on snapshot taken [% urldt ; ELSE %]Configuration summary for system "[% system %]" snapshot taken [% urldt ; END ; END -%] +[% + cvsurl = 'http://anoncvs.postgresql.org/cvsweb.cgi'; + giturl = scmurl || 'http://git.postgresql.org/gitweb?p=postgresql.git;a=commit;h='; +-%] +[% WRAPPER 'page.tt' + title = mytitle + bodyclass = 'none' + pagebutton = 'none' +%] +

PostgreSQL Build Farm Log

+

Details for system "[% system %]"[% IF stage != 'OK' %] failure at stage [% stage ; ELSE %], status 'OK'[% END %], snapshot taken [% urldt %]

+ + + + + + + + + + + + + + + + + + +
System InformationFarm memberBranchOSCompilerArchitectureOwner
[% system %][% branch %][% info_row.operating_system %] [% info_row.os_version %][% info_row.compiler %] [% info_row.compiler_version %][% info_row.architecture %][% info_row.owner_email %]
+[% IF info_row.sys_notes %] +
+ + + + + + + + + + +
System NotesDateNotes
[% info_row.sys_notes_date %][% info_row.sys_notes %]
+[% END %] +[% cell = 0; FOREACH logstage IN log_file_names ; striplog = logstage.replace('\.log$','') ; cell = loop.count %] + [% IF loop.first %] +
+ [% END %] + [% IF loop.count > 1 and loop.count % lrfactor == 1 %][% END %] + + [% IF loop.count % lrfactor == 0 %][% END %] +[% END %] + +[% IF cell > 0 ; nrcell = cell + 1; ncells = [ nrcell .. logcells ] ; FOREACH rcell IN ncells %] + [% IF rcell > 1 and rcell % lrfactor == 1 %][% END %] + + [% IF rcell % lrfactor == 0 %][% END %] + [% END %] +
Stage Logs
[% striplog %]
 
+[% END %] + +

Configuration summary

+
+[% conf | html %]
+
+

Files changed this run

+
+[%- IF changed_this_run.0 -%]
+[%- FOREACH changed IN changed_this_run %]
+[% changed.0 ; IF scm == 'cvs'; ' '; changed.1; END %]
+[%- END -%]
+[%- ELSE %]
+not recorded
+[% END -%]
+
+[% IF stage != 'OK' %] +

Files changed since last success

+
+[%- IF changed_since_success.0 %]
+[%- FOREACH changed IN changed_since_success %]
+[% changed.0 ; IF scm == 'cvs'; ' '; changed.1; END %]
+[%- END -%]
+[%- ELSE %]
+not recorded
+[% END -%]
+
+[% END %] +

Log

+
+[% log | html %]
+
+[% END %] diff --git a/trunk/templates/members.tt b/trunk/templates/members.tt new file mode 100644 index 0000000..d55e7a5 --- /dev/null +++ b/trunk/templates/members.tt @@ -0,0 +1,70 @@ +[% WRAPPER 'page.tt' + title = 'PostgreSQL BuildFarm Members' + bodyclass = 'members' + pagebutton = 'members' +%] +

PostgreSQL BuildFarm Members

+

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.

+
+ + + + + + + + + +[% alt = true %] +[% FOREACH row IN statrows ; + have_recent = 0; + FOREACH branch_days IN row.branches.split(',') ; + branch_fields = branch_days.split(':'); + branch_day = branch_fields.1; + IF branch_day < 365 ; have_recent = 1; END; + END; + IF have_recent ; +%] + [% alt = ! alt %] + + + + + + + +[% END; END %] +
 Name
Owner
OS / VersionCompiler / VersionArchBranches reported on
(most recent report)
[% row.name %]
[% row.owner_email %] +[% IF row.sys_notes %] +
+ Notes: ([% row.sys_notes_date %]) [% row.sys_notes %] +[% END %] +
[% row.operating_system %]
[% row.os_version %] + [% prev_osver = row.osversion; + FOREACH personality IN row.personalities; + IF personality.os_version != prev_osver + %] +
w.e.f. [% personality.effective_date %]: [% personality.os_version %] + [% prev_osver = personality.os_version; END; END %] +
[% row.compiler %]
[% row.compiler_version %] + [% prev_compver = row.compiler_version; + FOREACH personality IN row.personalities; + IF personality.compiler_version != prev_compver + %] +
w.e.f. [% personality.effective_date %]: [% personality.compiler_version %] + [% prev_compver = personality.compiler_version; END; END %] +
[% row.arch %][% IF ! row.branches ; ' ' ; END -%] +
    + [%- + FOREACH branch_days IN row.branches.split(',') ; + branch_fields = branch_days.split(':'); + branch = branch_fields.0; + branch_day = branch_fields.1; + IF branch_day < 365 ; + %]
  • [% branch %] ([% branch_day %] days ago)
  • [% END; END %]
+ +
+[% END %] diff --git a/trunk/templates/page.tt b/trunk/templates/page.tt new file mode 100644 index 0000000..f00da9b --- /dev/null +++ b/trunk/templates/page.tt @@ -0,0 +1,39 @@ + + + + + [% title %] + + + + + +
+ +
+ [% content %] +
+
+

+ Hosting for the PostgreSQL Buildfarm is generously + provided by: + CommandPrompt, The PostgreSQL Company +

+
+ + diff --git a/trunk/templates/register-form.tt b/trunk/templates/register-form.tt new file mode 100644 index 0000000..0f4f82b --- /dev/null +++ b/trunk/templates/register-form.tt @@ -0,0 +1,72 @@ +[% WRAPPER 'page.tt' + title = 'PostgreSQL BuildFarm Application' + bodyclass = 'application' + pagebutton = 'register' +%] +

Application to join PostgreSQL BuildFarm

+ +

Here is a short description of what is required to join the buildfarm successfully. Please read it carefully +before submitting this form.

+ +
    +
  • your machine will need to be able to contact http://www.pgbuildfarm.org + 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).
  • +
  • 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).
  • +
  • Windows only: you will need a native perl installed as well as the one in the MSys DTK. The one from ActiveState works fine.
  • +
  • download and unpack the latest release of client code from + http://pgfoundry.org/frs/?group_id=1000040
  • +
  • read instructions at + http://wiki.postgresql.org/wiki/PostgreSQL_Buildfarm_Howto
  • +
  • get the software running locally using flags --force --nostatus --nosend
  • +
  • register your machine on this page
  • +
  • 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.
  • +
+
+ +

Please complete all items.

+

For Linux, please specify the name and version of the Distribution 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".

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Operating System
OS Version
Compiler
Compiler Version
Architecture
Your name
Your email address
[% captcha %]
+
+[% END %] diff --git a/trunk/templates/register-incomplete.tt b/trunk/templates/register-incomplete.tt new file mode 100644 index 0000000..bc73f41 --- /dev/null +++ b/trunk/templates/register-incomplete.tt @@ -0,0 +1,9 @@ +[% WRAPPER 'page.tt' + title = 'PostgreSQL BuildFarm Application' + bodyclass = 'application' + pagebutton = 'none' +%] +

You need to complete all the form items. +Please click here to try again. +

+[% END %] diff --git a/trunk/templates/register-ok.tt b/trunk/templates/register-ok.tt new file mode 100644 index 0000000..fdfea96 --- /dev/null +++ b/trunk/templates/register-ok.tt @@ -0,0 +1,8 @@ +[% WRAPPER 'page.tt' + title = 'PostgreSQL BuildFarm Application' + bodyclass = 'application' + pagebutton = 'none' +%] +

PostgreSQL BuildFarm Application received

\ +

Thank you. You should hear from us shortly.

+[% END %] diff --git a/trunk/templates/status.tt b/trunk/templates/status.tt new file mode 100644 index 0000000..875c988 --- /dev/null +++ b/trunk/templates/status.tt @@ -0,0 +1,78 @@ +[% + 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', + vpath => '/img/vpath.png', + xml => '/img/xml.png', + 'thread-safety' => '/img/threads.gif', + 'integer-datetimes' = '/img/days.png', + git => '/img/git.png', + } +-%] +[%- BLOCK img ; IF flag == 'depend' or flag == 'gnu-ld' ; ; ELSIF flag_imgs.$flag %][% flag %] [% ELSE %][%# + flag ; ' ' +%][% END ; END -%] +[%- BLOCK sysnotes ; IF row.sys_notes %] +[%- ELSE %] [% END ; END -%] +[%- BLOCK cl %] class="[% SWITCH bgfor.replace('-.*','') -%] + [%- CASE 'OK' %]pass[% CASE 'ContribCheck' %]warn[% CASE [ 'Check' 'InstallCheck' ] %]warnx[% CASE %]fail[% END %]" +[%- END -%] +[% WRAPPER 'page.tt' + title = 'PostgreSQL BuildFarm Status' + bodyclass = 'none' + pagebutton = 'status' +%] +

PostgreSQL BuildFarm Status

+

+ Shown here is the latest status of each farm member + for each branch it has reported on in the last 30 days. +

+

+ Use the farm member link for history of that member + on the relevant branch. +

+ +[% FOREACH flagset IN flag_imgs %] + +[% IF loop.count == 7 %][% END %] +[% END %] +
Legend[% flagset.key %] = [% flagset.key %]
+
+ +[% brch = "" %] +[% FOREACH row IN statrows %] +[% IF row.branch != brch ; brch = row.branch %] + + +[% END %] + + + + + + + + +[% END %] +
Branch: [% brch %]
AliasSystemStatusFlags
[% row.sysname %][% PROCESS sysnotes %][% row.operating_system %] + [% row.os_version %] + [%- row.compiler %] + [% row.compiler_version %] + [%- row.architecture %] + [%- row.when_ago | replace('\s',' ') %] ago  + [% row.stage -%] + + [%- IF row.stage != 'OK' %]Details[% ELSE %]Config[% END -%][% FOREACH flag IN row.build_flags.split().sort() ; PROCESS img ; END %]
+[% END %]