6 use vars qw($dbhost $dbname $dbuser $dbpass $dbport);
8 require "$ENV{BFConfDir}/BuildFarmWeb.pl";
10 use lib "/home/community/pgbuildfarm/lib/lib/perl5/site_perl";
12 use SOAP::Transport::HTTP;
14 SOAP::Transport::HTTP::CGI->dispatch_to('PGBuildFarm')->handle;
28 my $dsn="dbi:Pg:dbname=$::dbname";
29 $dsn .= ";host=$::dbhost" if $::dbhost;
30 $dsn .= ";port=$::dbport" if $::dbport;
32 my $db = DBI->connect($dsn,$::dbuser,$::dbpass) or
33 die("$dsn,$::dbuser,$::dbpass,$!");
35 # there is possibly some redundancy in this query, but it makes
36 # a lot of the processing simpler.
41 select (now() at time zone 'GMT')::timestamp(0) - snapshot as when_ago,
42 sysname, snapshot, b.status, stage, branch, build_flags,
43 operating_system, coalesce(b.os_version,s.os_version) as os_version,
45 coalesce(b.compiler_version, s.compiler_version) as compiler_version,
49 select distinct on (bs.sysname, bs.branch, bs.report_time)
50 sysname, snapshot, status, stage, branch, build_flags,
51 report_time ,compiler_version, os_version
55 on (p.name = bs.sysname and p.effective_date <= bs.report_time)
56 order by bs.sysname, bs.branch, bs.report_time,
57 p.effective_date is null, p.effective_date desc
60 (select sysname, branch, max(snapshot) as snapshot
62 group by sysname, branch
63 having max(snapshot) > now() - '30 days'::interval
66 and s.status = 'approved'
67 order by branch = 'HEAD' desc,
77 my $sth=$db->prepare($statement);
79 while (my $row = $sth->fetchrow_hashref)
81 next if (@members && ! grep {$_ eq $row->{sysname} } @members);
82 $row->{build_flags} =~ s/^\{(.*)\}$/$1/;
83 $row->{build_flags} =~ s/,/ /g;
84 $row->{build_flags} =~ s/--((enable|with)-)?//g;
85 $row->{build_flags} =~ s/\S+=\S+//g;
86 push(@$statrows,$row);