X-Git-Url: https://git.exim.org/buildfarm-server.git/blobdiff_plain/7696f262f27714edbcf520399a61be1dc7e3e158..a411ba172dede5036f2adfdb3d6ec3afa0a6b865:/cgi-bin/show_stage_log.pl diff --git a/cgi-bin/show_stage_log.pl b/cgi-bin/show_stage_log.pl old mode 100644 new mode 100755 index 52c1a37..fe2e3ca --- a/cgi-bin/show_stage_log.pl +++ b/cgi-bin/show_stage_log.pl @@ -23,10 +23,55 @@ 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; +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"; + + exit; + +} + +else +{ + print "Status: 460 bad parameters\n", + "Content-Type: text/plain\n\n"; + exit; +} + if ($system && $logdate) { @@ -65,7 +110,9 @@ unless ($stage) } my $template = "buildlogXXXXXX"; -my ($fh, $filename) = tempfile($template, UNLINK => 1); +my ($fh, $filename) = tempfile($template, + DIR => '/home/community/pgbuildfarm/buildlogs', + UNLINK => 1); print $fh $tgz; close($fh);