7 use File::Temp qw(tempfile);
9 use vars qw($dbhost $dbname $dbuser $dbpass $dbport @log_file_names);
12 require "$ENV{BFConfDir}/BuildFarmWeb.pl";
13 #require "BuildFarmWeb.pl";
15 die "no dbname" unless $dbname;
16 die "no dbuser" unless $dbuser;
18 my $dsn="dbi:Pg:dbname=$dbname";
19 $dsn .= ";host=$dbhost" if $dbhost;
20 $dsn .= ";port=$dbport" if $dbport;
24 my $system = $query->param('nm');
25 my $logdate = $query->param('dt');
26 my $stage = $query->param('stg');
28 use vars qw($tgz $output);
30 if ($stage && $system && $logdate)
35 if ($system && $logdate)
38 my $db = DBI->connect($dsn,$dbuser,$dbpass);
40 die $DBI::errstr unless $db;
58 where sysname = ? and snapshot = ?
64 my $sth=$db->prepare($statement);
65 $sth->execute($system,$logdate);
66 my $row=$sth->fetchrow_arrayref;
70 $output = `tar -z -O -xf $filename $stage.log 2>&1`
81 "Content-Type: application/x-gzip\n",
82 "Content-Disposition: attachment; filename=buildfarmlog.tgz\n",
88 my $template = "buildlogXXXXXX";
89 my ($fh, $filename) = tempfile($template, UNLINK => 1);
93 print "Content-Type: text/plain\n\n", $output,
95 "-------------------------------------------------\n\n",
96 "Hosting for the PostgreSQL Buildfarm is generously ",
97 "provided by: CommandPrompt, The PostgreSQL Company";
101 # using <pre> like this on huge files can make browsers choke
103 print "Content-Type: text/html\n\n";