From 8378d57ba24a348ab36068c319f79fca19ff7dd9 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 5 Nov 2008 01:58:29 +0000 Subject: [PATCH] --- src/scheduler.pl | 61 ++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/src/scheduler.pl b/src/scheduler.pl index 184ee649..e3547fcb 100644 --- a/src/scheduler.pl +++ b/src/scheduler.pl @@ -49,42 +49,43 @@ sub buildJob { , starttime => $startTime , stoptime => $stopTime }); - }); + print " build ID = ", $build->id, "\n"; - return 0; + my $logPath = "/nix/var/log/nix/drvs/" . basename $drvPath; + if (-e $logPath) { + print " LOG $logPath\n"; + $db->resultset('Buildlogs')->create( + { buildid => $build->id + , logphase => "full" + , path => $logPath + , type => "raw" + }); + } - my $dbh, my $description, my $jobName; + if ($buildStatus == 0) { - $dbh->begin_work; - - $dbh->prepare("insert into builds(timestamp, jobName, description, drvPath, outPath, isCachedBuild, buildStatus, errorMsg, startTime, stopTime) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)") - ->execute(time(), $jobName, $description, $drvPath, $outPath, $isCachedBuild, $buildStatus, "", $startTime, $stopTime); - - my $buildId = $dbh->last_insert_id(undef, undef, undef, undef); - print " db id = $buildId\n"; - - my $logPath = "/nix/var/log/nix/drvs/" . basename $drvPath; - if (-e $logPath) { - print " LOG $logPath\n"; - $dbh->prepare("insert into buildLogs(buildId, logPhase, path, type) values(?, ?, ?, ?)") - ->execute($buildId, "full", $logPath, "raw"); - } - - if ($buildStatus == 0) { - - $dbh->prepare("insert into buildProducts(buildId, type, subtype, path) values(?, ?, ?, ?)") - ->execute($buildId, "nix-build", "", $outPath); - - if (-e "$outPath/log") { - foreach my $logPath (glob "$outPath/log/*") { - print " LOG $logPath\n"; - $dbh->prepare("insert into buildLogs(buildId, logPhase, path, type) values(?, ?, ?, ?)") - ->execute($buildId, basename($logPath), $logPath, "raw"); + $db->resultset('Buildproducts')->create( + { buildid => $build->id + , type => "nix-build" + , subtype => "" + , path => $outPath + }); + + if (-e "$outPath/log") { + foreach my $logPath (glob "$outPath/log/*") { + print " LOG $logPath\n"; + $db->resultset('Buildlogs')->create( + { buildid => $build->id + , logphase => basename($logPath) + , path => $logPath + , type => "raw" + }); + } } } - } + + }); - $dbh->commit; }