From: Andrew Dunstan Date: Sun, 22 Mar 2009 14:23:54 +0000 (+0000) Subject: add script for extracting recent typedefs X-Git-Url: https://git.exim.org/buildfarm-server.git/commitdiff_plain/4162ff9658e407a2c3aaf9a2a9d3f8622081eddf?ds=sidebyside add script for extracting recent typedefs --- diff --git a/cgi-bin/typedefs.pl b/cgi-bin/typedefs.pl new file mode 100755 index 0000000..c10a1cf --- /dev/null +++ b/cgi-bin/typedefs.pl @@ -0,0 +1,49 @@ +#!/usr/bin/perl + +use strict; +use DBI; + +use vars qw($dbhost $dbname $dbuser $dbpass $dbport); + +require "$ENV{BFConfDir}/BuildFarmWeb.pl"; + +my $dsn="dbi:Pg:dbname=$dbname"; +$dsn .= ";host=$dbhost" if $dbhost; +$dsn .= ";port=$dbport" if $dbport; + +my $dbh = DBI->connect($dsn,$dbuser,$dbpass) or die("$dsn,$dbuser,$dbpass,$!"); + +my %words; + +my $sql = q{ + select sysname, max(snapshot) as snapshot + from build_status_log + where branch = 'HEAD' and + log_stage = 'typedefs.log' and + snapshot > current_date::timestamp - interval '30 days' + group by sysname +}; +my $builds = $dbh->selectall_arrayref($sql, { Slice => {} }); + +$sql = q{ + select log_text + from build_status_log + where sysname = ? + and snapshot = ? + and log_stage = 'typedefs.log' + and branch = 'HEAD' + }; + +my $sth = $dbh->prepare($sql); + +foreach my $build (@$builds) +{ + $sth->execute($build->{sysname},$build->{snapshot}); + my @row = $sth->fetchrow; + my @typedefs = split(/\s+/,$row[0]); + @words{@typedefs} = 1 x @typedefs; +} + +print "Content-Type: text/plain\n\n", + join("\n",sort keys %words), + "\n";