=cut
use strict;
+use URI::Escape;
use vars qw($dbhost $dbname $dbuser $dbpass $dbport
$all_stat $fail_stat $change_stat $green_stat
use Digest::SHA1 qw(sha1_hex);
use MIME::Base64;
use DBI;
-use DBD::mysql;
+use DBD::Pg;
use Data::Dumper;
use Mail::Send;
use Time::ParseDate;
use Storable qw(thaw);
-require "$ENV{BFConfDir}/BuildFarmWeb.pl";
-my $buildlogs = "$ENV{BFConfDir}/buildlogs";
+use FindBin qw($RealBin);
+require "$RealBin/../BuildFarmWeb.pl";
+
+my $buildlogs = "$RealBin/../buildlogs";
die "no dbname" unless $dbname;
die "no dbuser" unless $dbuser;
-my $dsn="dbi:mysql:dbname=$dbname";
+my $dsn="dbi:Pg:dbname=$dbname";
$dsn .= ";host=$dbhost" if $dbhost;
$dsn .= ";port=$dbport" if $dbport;
my $content =
- "branch=$branch&res=$res&stage=$stage&animal=$animal&".
+ 'branch=' . uri_escape($branch) . "&res=$res&stage=$stage&animal=$animal&".
"ts=$ts&log=$log&conf=$conf";
my $extra_content =
}
-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;
-
-}
+# Want to allow all kinds of named branches
+#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);
chomp $githeadref;
close $githead;
}
- # unlink $archname;
+ unlink $archname;
}
my $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';
+ push(@config_flags, 'doc')
+ if (defined $client_conf->{'optional_steps'}->{'make-doc'});
+ push(@config_flags, 'test')
+ if (defined $client_conf->{'optional_steps'}->{'test'});
$config_flags = '{' . join(',',@config_flags) . '}' ;
}
my $sqlres;
$db->begin_work;
-$db->do("select set_local_error_terse()");
+#$db->do("select set_local_error_terse()");
$sth=$db->prepare($logst);
$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::mysql::PG_BYTEA });
-$sth->bind_param(11,undef,{ pg_type => DBD::mysql::PG_BYTEA });
+#$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->bind_param(15,$githeadref);
-$sth->bind_param(16,$frozen_sconf,{ pg_type => DBD::mysql::PG_BYTEA });
+$sth->bind_param(16,$frozen_sconf,{ pg_type => DBD::Pg::PG_BYTEA });
$sqlres = $sth->execute;
my $host = `hostname`; chomp ($host);
$host = $default_host unless ($host =~ m/[.]/ || !defined($default_host));
-my $from_addr = "PG Build Farm <$me\@$host>";
+my $from_addr = "Exim Build Farm <$me\@$host>";
$from_addr =~ tr /\r\n//d;
my $msg = new Mail::Send;
$msg->to(@$mailto);
$msg->bcc(@$bcc_stat) if (@$bcc_stat);
-$msg->subject("PGBuildfarm member $animal Branch $branch $stat_type $stage");
+$msg->subject("Exim BuildFarm member $animal Branch $branch $stat_type $stage");
$msg->set('From',$from_addr);
my $fh = $msg->open;
print $fh <<EOMAIL;
-The PGBuildfarm member $animal had the following event on branch $branch:
+The Exim BuildFarm member $animal had the following event on branch $branch:
$stat_type: $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");
+$msg->subject("Exim BuildFarm member $animal Branch $branch Status $stat_type");
$msg->set('From',$from_addr);
$fh = $msg->open;
print $fh <<EOMAIL;
-The PGBuildfarm member $animal had the following event on branch $branch:
+The Exim BuildFarm member $animal had the following event on branch $branch:
Status $stat_type