∅:D[
2.6680] → [
3.2422:2445]
B:BD[
3.2422] → [
3.2422:2445]
B:BD[
3.2445] → [
4.2686:3001]
∅:D[
4.3001] → [
3.2656:2763]
B:BD[
3.2656] → [
3.2656:2763]
B:BD[
3.2763] → [
4.3002:3285]
∅:D[
4.3285] → [
3.2763:2963]
B:BD[
3.2763] → [
3.2763:2963]
B:BD[
3.3270] → [
3.3270:3586]
    $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"
                        });
                }