8 use vars qw($dbhost $dbname $dbuser $dbpass $dbport
10 require "$ENV{BFConfDir}/BuildFarmWeb.pl";
12 die "no dbname" unless $dbname;
13 die "no dbuser" unless $dbuser;
15 my $dsn="dbi:Pg:dbname=$dbname";
16 $dsn .= ";host=$dbhost" if $dbhost;
17 $dsn .= ";port=$dbport" if $dbport;
19 my $db = DBI->connect($dsn,$dbuser,$dbpass);
21 die $DBI::errstr unless $db;
23 my ($brhandle,@branches_of_interest);
24 if (open($brhandle,"$ENV{BFConfDir}/htdocs/branches_of_interest.txt"))
26 @branches_of_interest = <$brhandle>;
28 chomp(@branches_of_interest);
31 my $sth = $db->prepare(q[
32 SELECT DISTINCT ON (sysname,branch)
34 FROM build_status AS s
35 JOIN buildsystems AS b ON (s.sysname = b.name)
36 ORDER BY sysname, branch ASC
40 my $del_sth = $db->prepare(q[
41 DELETE FROM build_status
45 my $del_dash_sth = $db->prepare(q[
46 DELETE FROM dashboard_mat
51 while (my $row = $sth->fetchrow_hashref)
53 my $sysname = $row->{sysname};
54 my $branch = $row->{branch};
55 print "Considering $sysname:$branch\n";
56 unless (grep {$_ eq $branch} @branches_of_interest)
58 print "** Delete branch $branch\n";
59 $del_sth->execute($sysname,$branch);
60 $del_dash_sth->execute($sysname,$branch);