show vpath builds in icon set
[buildfarm-server.git] / cgi-bin / show_status.pl
old mode 100644 (file)
new mode 100755 (executable)
index 3e35bcf..8c962f5
@@ -18,67 +18,33 @@ my $dsn="dbi:Pg:dbname=$dbname";
 $dsn .= ";host=$dbhost" if $dbhost;
 $dsn .= ";port=$dbport" if $dbport;
 
+
+my $sort_clause = "";
+my $sortby = $query->param('sortby') || 'nosort';
+if ($sortby eq 'name')
+{
+       $sort_clause = 'lower(sysname),';
+}
+elsif ($sortby eq 'os')
+{
+       $sort_clause = 'lower(operating_system), os_version desc,'; 
+}
+elsif ($sortby eq 'compiler')
+{
+       $sort_clause = "lower(compiler), compiler_version,";
+}
+
 my $db = DBI->connect($dsn,$dbuser,$dbpass) or die("$dsn,$dbuser,$dbpass,$!");
 
-# there is possibly some redundancy in this query, but it makes
-# a lot of the processing simpler.
-
-my $statement = <<EOS;
-
-  select (now() at time zone 'GMT')::timestamp(0) - snapshot as when_ago,
-      sysname, snapshot, b.status, stage, branch, build_flags,
-      operating_system, os_version, compiler, compiler_version, architecture 
-  from buildsystems s, 
-       build_status b
-       natural join 
-       (select sysname, branch, max(snapshot) as snapshot
-        from build_status
-        group by sysname, branch
-       having max(snapshot) > now() - '30 days'::interval
-       ) m
-  where name = sysname
-        and s.status = 'approved'
-  order by branch = 'HEAD' desc, 
-        branch desc, 
-        snapshot desc
+my $statement =<<EOS;
 
-EOS
-;
 
-$statement =<<EOS;
-
-
-  select (now() at time zone 'GMT')::timestamp(0) - snapshot as when_ago,
-       sysname, snapshot, b.status, stage, branch, build_flags,
-       operating_system, coalesce(b.os_version,s.os_version) as os_version,
-       compiler, coalesce(b.compiler_version, s.compiler_version) as compiler_version, 
-       architecture 
-  from buildsystems s, 
-        (
-       select distinct on (bs.sysname, bs.branch, bs.report_time) 
-               sysname, snapshot, status, stage, branch, build_flags,
-               report_time ,compiler_version, os_version
-        from build_status bs
-             left join 
-             personality p
-             on (p.name = bs.sysname and p.effective_date <= bs.report_time)
-        order by bs.sysname, bs.branch, bs.report_time, 
-                 p.effective_date is null, p.effective_date desc
-        ) as b
-       natural join 
-               (select sysname, branch, max(snapshot) as snapshot
-        from build_status
-        group by sysname, branch
-       having max(snapshot) > now() - '30 days'::interval
-               ) m
-  where name = sysname
-        and s.status = 'approved'
+  select timezone('GMT'::text, now())::timestamp(0) without time zone - b.snapshot AS when_ago, b.*
+  from dashboard_mat b
   order by branch = 'HEAD' desc,
-        branch desc, 
+        branch desc, $sort_clause 
         snapshot desc
 
-
-
 EOS
 ;
 
@@ -90,6 +56,18 @@ while (my $row = $sth->fetchrow_hashref)
     next if (@members && ! grep {$_ eq $row->{sysname} } @members);
     $row->{build_flags}  =~ s/^\{(.*)\}$/$1/;
     $row->{build_flags}  =~ s/,/ /g;
+       # enable-integer-datetimes is now the default
+       if ($row->{branch} eq 'HEAD' || $row->{branch} gt 'REL8_3_STABLE')
+       {
+               $row->{build_flags} .= " --enable-integer-datetimes "
+                       unless ($row->{build_flags} =~ /--(en|dis)able-integer-datetimes/);
+       }
+       # enable-thread-safety is now the default
+       if ($row->{branch} eq 'HEAD' || $row->{branch} gt 'REL8_5_STABLE')
+       {
+               $row->{build_flags} .= " --enable-thread-safety "
+                       unless ($row->{build_flags} =~ /--(en|dis)able-thread-safety/);
+       }
     $row->{build_flags}  =~ s/--((enable|with)-)?//g;
        $row->{build_flags} =~ s/libxml/xml/;
     $row->{build_flags}  =~ s/\S+=\S+//g;
@@ -100,6 +78,7 @@ $sth->finish;
 
 $db->disconnect;
 
+
 my $template = new Template({});
 
 print "Content-Type: text/html\n\n";
@@ -127,6 +106,7 @@ __DATA__
      nls => '/img/translateicon.gif',
      krb5 => '/img/krb.gif',
      tcl => '/img/tcl.png',
+     vpath => '/img/vpath.png',
      xml => '/img/xml.png',
      'thread-safety' => '/img/threads.gif',
      'integer-datetimes' = '/img/days.png',
@@ -135,7 +115,7 @@ __DATA__
 [%- BLOCK img ; IF flag == 'depend' or flag == 'gnu-ld' ; ; ELSIF flag_imgs.$flag %]<img src="[% flag_imgs.$flag %]" title="[% flag %]" alt="[% flag %]" height="16" width="16" class="inline" align="bottom" />  [% ELSE %][%#
                                                                                                                                                                                                          flag ; ' '
 %][% END ; END -%]
-[%- BLOCK cl %] class=" [% SWITCH bgfor -%]
+[%- BLOCK cl %] class="[% SWITCH bgfor.replace('-.*','') -%]
   [%- CASE 'OK' %]pass[% CASE 'ContribCheck' %]warn[% CASE [ 'Check' 'InstallCheck' ] %]warnx[% CASE %]fail[% END %]"
 [%- END -%]
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"