* Use Nix's negative caching.

[?]
Mar 26, 2009, 12:53 PM
3BKF6P72K4YGWSQD5PO6PKNM3KXGFLONB3SONKRZR4DJHH3W3PSAC

Dependencies

  • [2] ZV23C3PQ * Disregard failing substituters.
  • [3] G5A7TZVI * Don't discard old build steps when restarting a build.
  • [4] CMU3YKOU * Store the release name.
  • [5] AS5PAYLI
  • [6] NLJJZVHO * Use ->update({...}) properly.
  • [7] 2T42QGZD * Register builds as GC roots so they don't get deleted.
  • [8] 37R34XJO * Negative caching: don't perform a build if a dependency already
  • [9] CLJQCY2X * Store info about all the build actions and allow them to be
  • [10] K3EAQY3X * Doh.
  • [11] 7YBYT2LQ
  • [12] 3E6IP3R3 * Add the name of the jobset to ReleaseSetJobs, otherwise we can't
  • [13] L2E6EVE2 * Merged the Build and Job tables.
  • [14] LQNBKF3D
  • [15] ECBA3GQO * Make the schema class names match the case of the SQL table names.
  • [16] BD3GRK4B * Get rid of "positive failures" and separate log phases.
  • [*] AFTXA575 * $HYDRA_DATA environment variable.

Change contents

  • edit in src/script/hydra_build.pl at line 11
    [18.1093]
    [4.3075]
    sub getBuildLog {
    my ($drvPath) = @_;
    my $logPath = "/nix/var/log/nix/drvs/" . basename $drvPath;
    return -e $logPath ? $logPath : undef;
    }
  • edit in src/script/hydra_build.pl at line 41
    [4.3533][4.3484:4603](),[4.4603][2.0:104](),[2.104][4.93:144](),[4.93][4.93:144](),[4.144][4.4744:4782](),[4.4744][4.4744:4782](),[4.4782][4.4283:4339](),[4.4339][4.4835:4971](),[4.4835][4.4835:4971]()
    # Check whether a dependency of this build has previously
    # failed. If so, don't even bother to build, since it will
    # fail anyway. !!! Once Nix has negative caching, this code
    # can go.
    my @drvDeps = split '\n', `nix-store --query --requisites --include-outputs $drvPath`;
    die "cannot query dependencies of `$drvPath': $?" if $? != 0;
    @drvDeps = grep { $_ =~ /.drv$/ } @drvDeps;
    my @drvOutputs = split '\n', `nix-store --query --outputs @drvDeps`;
    die "cannot query outputs of the dependencies of `$drvPath': $?" if $? != 0;
    foreach my $dep (@drvOutputs) {
    # !!! This checks more than it has to, namely
    # build-time-only dependencies of dependencies (which
    # don't need to be built). However, it shouldn't matter:
    # if the dependency was built, then presumably *its*
    # dependencies were built as well.
    # !!! should disregard fixed-output derivations (?)
    if (!isValidPath($dep)) {
    my ($step) = $db->resultset('BuildSteps')->search(
    {outPath => $dep}, {rows => 1, order_by => "stopTime DESC", type => 0, busy => 0});
    if ($step && $step->status != 0) {
    $buildStatus = 5;
    $failedDepBuild = $step->build->id;
    $failedDepStepNr = $step->stepnr;
    goto done;
    }
    }
    }
  • edit in src/script/hydra_build.pl at line 96
    [4.3884]
    [4.6461]
    my $errorMsg = $4;
    $errorMsg = "build failed previously (cached)" if $3 eq "cached";
  • replacement in src/script/hydra_build.pl at line 101
    [3.507][4.541:640](),[4.2643][4.541:640]()
    $step->update({busy => 0, status => 1, errormsg => $4, stoptime => time});
    [3.507]
    [4.2898]
    $step->update({busy => 0, status => 1, errormsg => $errorMsg, stoptime => time});
  • replacement in src/script/hydra_build.pl at line 104
    [4.4746][4.4746:4801]()
    { stepnr => $buildStepNr++
    [4.4746]
    [4.3091]
    { stepnr => ($buildSteps{$drvPathStep} = $buildStepNr++)
  • replacement in src/script/hydra_build.pl at line 108
    [4.3235][4.3235:3279]()
    , logfile => $4
    [4.3235]
    [4.3279]
    , logfile => getBuildLog($drvPathStep)
  • replacement in src/script/hydra_build.pl at line 113
    [4.3456][4.3456:3501]()
    , errormsg => $4
    [4.3456]
    [4.3501]
    , errormsg => $errorMsg
  • edit in src/script/hydra_build.pl at line 173
    [4.871][4.7526:7527](),[4.5042][4.7526:7527](),[4.7526][4.7526:7527](),[4.7527][4.4350:4463]()
    my $logPath = "/nix/var/log/nix/drvs/" . basename $drvPath;
    $logPath = undef unless -e $logPath;
  • replacement in src/script/hydra_build.pl at line 188
    [4.4537][4.4473:4507]()
    , logfile => $logPath
    [4.4537]
    [4.4507]
    , logfile => getBuildLog $drvPath