4 Jul 01:52
zagor: r21631 - www/buildserver
<mailer <at> svn.rockbox.org>
2009-07-03 23:52:04 GMT
2009-07-03 23:52:04 GMT
Date: 2009-07-04 01:52:04 +0200 (Sat, 04 Jul 2009)
New Revision: 21631
Log Message:
Fixed client dupe check.
Added db pre-insert of builds to be made.
Modified:
www/buildserver/rbmaster.pl
Modified: www/buildserver/rbmaster.pl
===================================================================
--- www/buildserver/rbmaster.pl 2009-07-03 23:03:07 UTC (rev 21630)
+++ www/buildserver/rbmaster.pl 2009-07-03 23:52:04 UTC (rev 21631)
@@ -310,7 +310,7 @@
}
$cli .= "-$user"; # append the user name
- for my $cl (@build_clients) {
+ for my $cl (&build_clients) {
if($client{$cl}{'client'} eq "$cli") {
print "HELLO dupe name: $cli ($args)\n";
$rh->write("_HELLO error duplicate name!\n");
@@ -389,10 +389,8 @@
# log this build in the database
# (must be done before handoutbuilds() since it will reset $buildround)
- if ($rb_dbuser) {
- &db_submit($buildround, $id, $cli, $took,
- $client{$rh->fileno}{'bogomips'});
- }
+ &db_submit($buildround, $id, $cli, $took,
+ $client{$rh->fileno}{'bogomips'});
# if we have builds not yet completed, hand out one
handoutbuilds();
@@ -422,11 +420,19 @@
sub db_submit
{
+ return unless ($rb_dbuser and $rb_dbpwd);
+
my ($revision, $id, $client, $timeused, $bogomips) = @_;
my $dbpath = 'DBI:mysql:rockbox';
my $db = DBI->connect($dbpath, $rb_dbuser, $rb_dbpwd);
- my $sth = $db->prepare("INSERT INTO builds (revision,id,client,timeused,bogomips) VALUES (?,?,?,?,?)");
- $sth->execute($revision, $id, $client, $timeused, $bogomips);
+ if ($client) {
+ my $sth = $db->prepare("UPDATE builds SET client=?,timeused=?,bogomips=? WHERE revision=? and id=?");
+ $sth->execute($client, $timeused, $bogomips, $revision, $id);
+ }
+ else {
+ my $sth = $db->prepare("INSERT INTO builds (revision,id) VALUES (?,?) ON DUPLICATE KEY UPDATE client='',timeused=0,bogomips=0");
+ $sth->execute($revision, $id);
+ }
$db->disconnect();
}
@@ -496,6 +502,11 @@
resetbuildround();
+ # fill db with builds to be done
+ for my $id (@buildids) {
+ &db_submit($buildround, $id);
+ }
+
handoutbuilds();
}
_______________________________________________
rockbox-cvs mailing list
rockbox-cvs <at> cool.haxx.se
http://cool.haxx.se/cgi-bin/mailman/listinfo/rockbox-cvs
RSS Feed