add support for keeping SCM type
[buildfarm-server.git] / cgi-bin / pgstatus.pl
index aa83566d95357ff8a530c1d52936ef349a2d0ab5..41d5c331d4408b12f4746a47a6472f54afa47046 100755 (executable)
@@ -230,13 +230,14 @@ if (@config_flags)
     $config_flags = '{' . join(',',@config_flags) . '}' ;
 }
 
+my $scm = $client_conf->{scm} || 'cvs';
 
 my $logst = <<EOSQL;
     insert into build_status 
       (sysname, snapshot,status, stage, log,conf_sum, branch,
        changed_this_run, changed_since_success, 
-       log_archive_filenames , log_archive, build_flags)
-    values(?,?,?,?,?,?,?,?,?,?,?,?)
+       log_archive_filenames , log_archive, build_flags, scm)
+    values(?,?,?,?,?,?,?,?,?,?,?,?,?)
 EOSQL
 ;
 $sth=$db->prepare($logst);
@@ -254,6 +255,7 @@ $sth->bind_param(10,$log_file_names);
 #$sth->bind_param(11,$log_archive,{ pg_type => DBD::Pg::PG_BYTEA });
 $sth->bind_param(11,undef,{ pg_type => DBD::Pg::PG_BYTEA });
 $sth->bind_param(12,$config_flags);
+$sth->bind_param(13,$scm);
 
 $sth->execute;
 $sth->finish;
@@ -282,6 +284,7 @@ foreach my $log_file( @log_file_names )
   $stage_start = $mtime;
   my $ltext = <$handle>;
   close($handle);
+  $ltext =~ s/\x00/\\0/g;
   $sth->execute($animal,$dbdate,$branch,$log_file,$ltext, 
                "$stage_interval seconds");
 }
@@ -322,6 +325,12 @@ $row=$sth->fetchrow_arrayref;
 my ($os, $compiler,$arch) = @$row;
 $sth->finish;
 
+
+$db->begin_work;
+$db->do("truncate dashboard_mat");
+$db->do("insert into dashboard_mat select * from dashboard_mat_data");
+$db->commit;
+
 $db->disconnect;
 
 print "Content-Type: text/plain\n\n";