Skip to content

Commit

Permalink
Build the resolved derivation and not the original one
Browse files Browse the repository at this point in the history
  • Loading branch information
thufschmitt committed Mar 29, 2022
1 parent 92b627a commit 6e571e2
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions src/hydra-queue-runner/build-remote.cc
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ void handshake(Machine::Connection & conn, unsigned int repeats)
throw Error("machine ‘%1%’ does not support repeating a build; please upgrade it to Nix 1.12", conn.machine->sshName);
}

StorePathSet sendInputs(
BasicDerivation sendInputs(
State & state,
Step & step,
Store & localStore,
Expand All @@ -214,19 +214,13 @@ StorePathSet sendInputs(
counter & nrStepsCopyingTo
)
{

StorePathSet inputs;
BasicDerivation basicDrv(*step.drv);

for (auto & p : step.drv->inputSrcs)
inputs.insert(p);

for (auto & input : step.drv->inputDrvs) {
auto drv2 = localStore.readDerivation(input.first);
for (auto & name : input.second) {
if (auto i = get(drv2.outputs, name)) {
auto outPath = i->path(localStore, drv2.name, name);
inputs.insert(*outPath);
basicDrv.inputSrcs.insert(*outPath);
}
}
Expand Down Expand Up @@ -255,18 +249,18 @@ StorePathSet sendInputs(
/* Copy the input closure. */
if (conn.machine->isLocalhost()) {
StorePathSet closure;
destStore.computeFSClosure(inputs, closure);
destStore.computeFSClosure(basicDrv.inputSrcs, closure);
copyPaths(destStore, localStore, closure, NoRepair, NoCheckSigs, NoSubstitute);
} else {
copyClosureTo(conn.machine->state->sendLock, destStore, conn.from, conn.to, inputs, true);
copyClosureTo(conn.machine->state->sendLock, destStore, conn.from, conn.to, basicDrv.inputSrcs, true);
}

auto now2 = std::chrono::steady_clock::now();

overhead += std::chrono::duration_cast<std::chrono::milliseconds>(now2 - now1).count();
}

return inputs;
return basicDrv;
}

void RemoteResult::updateWithBuildResult(const nix::BuildResult & buildResult)
Expand Down Expand Up @@ -535,8 +529,7 @@ void State::buildRemote(ref<Store> destStore,
copy the immediate sources of the derivation and the required
outputs of the input derivations. */
updateStep(ssSendingInputs);

StorePathSet inputs = sendInputs(*this, *step, *localStore, *destStore, conn, result.overhead, nrStepsWaiting, nrStepsCopyingTo);
BasicDerivation resolvedDrv = sendInputs(*this, *step, *localStore, *destStore, conn, result.overhead, nrStepsWaiting, nrStepsCopyingTo);

logFileDel.cancel();

Expand All @@ -561,7 +554,7 @@ void State::buildRemote(ref<Store> destStore,
conn,
*localStore,
step->drvPath,
BasicDerivation(*step->drv),
resolvedDrv,
buildOptions,
nrStepsBuilding
);
Expand Down

0 comments on commit 6e571e2

Please sign in to comment.