X-Git-Url: https://git.exim.org/buildfarm-server.git/blobdiff_plain/c3ad6df34e5ec30c6be887033dad6d834ddf8fb1..b82a14979c08ae940b8c0b8df8583ae4e79ceea8:/cgi-bin/show_members.pl diff --git a/cgi-bin/show_members.pl b/cgi-bin/show_members.pl index 2b6e0be..f35c66a 100755 --- a/cgi-bin/show_members.pl +++ b/cgi-bin/show_members.pl @@ -1,17 +1,22 @@ #!/usr/bin/perl +=comment + +Copyright (c) 2003-2010, Andrew Dunstan + +See accompanying License file for license details + +=cut + 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"; +use FindBin qw($RealBin); +require "$RealBin/../BuildFarmWeb.pl"; my $query = new CGI; my %sort_ok = ('name' => 'lower(name)' , @@ -26,27 +31,32 @@ my $dsn="dbi:Pg:dbname=$dbname"; $dsn .= ";host=$dbhost" if $dbhost; $dsn .= ";port=$dbport" if $dbport; -my $db = DBI->connect($dsn,$dbuser,$dbpass); +my $db = DBI->connect($dsn,$dbuser,$dbpass,{pg_expand_array => 0}); # there is possibly some redundancy in this query, but it makes # a lot of the processing simpler. -my $statement = < 'HEAD', branch desc - ) as branches + ) as branches, + ARRAY(select compiler_version || E'\t' || os_version || E'\t' || effective_date + from personality p + where p.name = s.name + order by effective_date + ) as personalities from buildsystems s where status = 'approved' - order by $sort_by +}; -EOS -; +$statement .= "order by $sort_by"; my $statrows=[]; my $sth=$db->prepare($statement); @@ -54,6 +64,21 @@ $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); } @@ -74,4 +99,3 @@ $template->process('members.tt', {statrows=>$statrows}); exit; -