8 use vars qw($dbhost $dbname $dbuser $dbpass $dbport $template_dir @log_file_names);
10 require "$ENV{BFConfDir}/BuildFarmWeb.pl";
12 my $template_opts = { INCLUDE_PATH => $template_dir, EVAL_PERL => 1};
13 my $template = new Template($template_opts);
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'); $system =~ s/[^a-zA-Z0-9_ -]//g;
25 my $logdate = $query->param('dt'); $logdate =~ s/[^a-zA-Z0-9_ :-]//g;
29 my ($stage,$changed_this_run,$changed_since_success,$sysinfo,$branch,$scmurl);
32 use vars qw($info_row);
34 if ($system && $logdate)
37 my $db = DBI->connect($dsn,$dbuser,$dbpass);
39 die $DBI::errstr unless $db;
43 select log,conf_sum,stage, changed_this_run, changed_since_success,branch,
44 log_archive_filenames, scm, scmurl
46 where sysname = ? and snapshot = ?
49 my $sth=$db->prepare($statement);
50 $sth->execute($system,$logdate);
51 my $row=$sth->fetchrow_arrayref;
53 $conf=$row->[1] || "not recorded" ;
54 $stage=$row->[2] || "unknown";
55 $changed_this_run = $row->[3];
56 $changed_since_success = $row->[4];
58 my $log_file_names = $row->[6];
60 $scm ||= 'cvs'; # legacy scripts
62 $log_file_names =~ s/^\{(.*)\}$/$1/;
63 @log_file_names=split(',',$log_file_names)
69 select operating_system, os_version,
70 compiler, compiler_version,
72 replace(owner_email,'\@',' [ a t ] ') as owner_email,
73 sys_notes_ts::date AS sys_notes_date, sys_notes
75 where status = 'approved'
79 $sth=$db->prepare($statement);
80 $sth->execute($system);
81 $info_row=$sth->fetchrow_hashref;
83 my $latest_personality = $db->selectrow_arrayref(q{
84 select os_version, compiler_version
86 where effective_date < ?
88 order by effective_date desc limit 1
89 }, undef, $logdate, $system);
90 # $sysinfo = join(" ",@$row);
91 if ($latest_personality)
93 $info_row->{os_version} = $latest_personality->[0];
94 $info_row->{compiler_version} = $latest_personality->[1];
100 foreach my $chgd ($changed_this_run,$changed_since_success)
102 my $cvsurl = 'http://anoncvs.postgresql.org/cvsweb.cgi';
103 my $giturl = $scmurl || 'http://git.postgresql.org/gitweb?p=postgresql.git;a=commit;h=';
104 my @lines = split(/!/,$chgd);
105 my $changed_rows = [];
108 next if ($scm eq 'cvs' and ! m!^(pgsql|master|REL\d_\d_STABLE)/!);
109 push(@$changed_rows,[$1,$3]) if (m!(^\S+)(\s+)(\S+)!);
111 $chgd = $changed_rows;
114 $conf =~ s/\@/ [ a t ] /g;
116 print "Content-Type: text/html\n\n";
118 $template->process('log.tt',
126 log_file_names => \@log_file_names,
129 changed_this_run => $changed_this_run,
130 changed_since_success => $changed_since_success,
131 info_row => $info_row,