Skip to content

Commit b7dece5

Browse files
committed
We move the `assertPathValidity` to where we know what the wanted outputs are.
1 parent ba96067 commit b7dece5

File tree

4 files changed

+10
-14
lines changed

4 files changed

+10
-14
lines changed

src/libstore/build/derivation-building-goal.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -613,9 +613,6 @@ Goal::Co DerivationBuildingGoal::tryToBuild()
613613
void closeLogFile() override {
614614
goal.closeLogFile();
615615
}
616-
SingleDrvOutputs assertPathValidity() override {
617-
return goal.assertPathValidity();
618-
}
619616
void appendLogTailErrorMsg(std::string & msg) override {
620617
goal.appendLogTailErrorMsg(msg);
621618
}

src/libstore/build/derivation-goal.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,13 @@ Goal::Co DerivationGoal::haveDerivation(StorePath drvPath)
210210
.outputs = wantedOutputs,
211211
});
212212

213+
if (buildMode == bmCheck) {
214+
/* In checking mode, the builder will not register any outputs.
215+
So we want to make sure the ones that we wanted to repair are
216+
properly there. */
217+
buildResult.builtOutputs = assertPathValidity(drvPath);
218+
}
219+
213220
co_return amDone(g->exitCode, g->ex);
214221
};
215222

src/libstore/unix/build/derivation-builder.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -589,10 +589,10 @@ static void replaceValidPath(const Path & storePath, const Path & tmpPath)
589589
way first. We'd better not be interrupted here, because if
590590
we're repairing (say) Glibc, we end up with a broken system. */
591591
Path oldPath;
592-
592+
593593
if (pathExists(storePath)) {
594594
// why do we loop here?
595-
// although makeTempPath should be unique, we can't
595+
// although makeTempPath should be unique, we can't
596596
// guarantee that.
597597
do {
598598
oldPath = makeTempPath(storePath, ".old");
@@ -1871,7 +1871,7 @@ SingleDrvOutputs DerivationBuilderImpl::registerOutputs()
18711871
also a source for non-determinism. */
18721872
if (delayedException)
18731873
std::rethrow_exception(delayedException);
1874-
return miscMethods->assertPathValidity();
1874+
return {};
18751875
}
18761876

18771877
/* Apply output checks. */

src/libstore/unix/include/nix/store/build/derivation-builder.hh

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,6 @@ struct DerivationBuilderCallbacks
9797
*/
9898
virtual void closeLogFile() = 0;
9999

100-
/**
101-
* Aborts if any output is not valid or corrupt, and otherwise
102-
* returns a 'SingleDrvOutputs' structure containing all outputs.
103-
*
104-
* @todo Probably should just be in `DerivationGoal`.
105-
*/
106-
virtual SingleDrvOutputs assertPathValidity() = 0;
107-
108100
virtual void appendLogTailErrorMsg(std::string & msg) = 0;
109101

110102
/**

0 commit comments

Comments
 (0)