1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-16 07:22:43 +01:00

Merge pull request #13862 from obsidiansystems/build-failure-content-vs-presentation

Properly separater builder failure content and presentation
This commit is contained in:
Jörg Thalheim 2025-09-01 20:25:50 +02:00 committed by GitHub
commit 0d300112fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 48 additions and 34 deletions

View file

@ -535,26 +535,16 @@ SingleDrvOutputs DerivationBuilderImpl::unprepareBuild()
/* Check the exit status. */
if (!statusOk(status)) {
/* Check *before* cleaning up. */
bool diskFull = decideWhetherDiskFull();
cleanupBuild(false);
auto msg =
fmt("Cannot build '%s'.\n"
"Reason: " ANSI_RED "builder %s" ANSI_NORMAL ".",
Magenta(store.printStorePath(drvPath)),
statusToString(status));
msg += showKnownOutputs(store, drv);
miscMethods->appendLogTailErrorMsg(msg);
if (diskFull)
msg += "\nnote: build failure may have been caused by lack of free disk space";
throw BuildError(
throw BuilderFailureError{
!derivationType.isSandboxed() || diskFull ? BuildResult::TransientFailure : BuildResult::PermanentFailure,
msg);
status,
diskFull ? "\nnote: build failure may have been caused by lack of free disk space" : "",
};
}
/* Compute the FS closure of the outputs and register them as