1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-15 23:12:44 +01:00

BuildResult: Add a "Cancelled" status

This denotes the result of a build that didn't succeed or fail, but
was cancelled because some other goal failed and --keep-going was not
enabled.
This commit is contained in:
Eelco Dolstra 2025-11-13 16:41:40 +01:00
parent f98bc8f41f
commit 1cd5e62402
3 changed files with 4 additions and 2 deletions

View file

@ -40,7 +40,7 @@ static BuildResult::Success::Status successStatusFromString(std::string_view str
throw Error("unknown built result success status '%s'", str); throw Error("unknown built result success status '%s'", str);
} }
static constexpr std::array<std::pair<BuildResult::Failure::Status, std::string_view>, 12> failureStatusStrings{{ static constexpr std::array<std::pair<BuildResult::Failure::Status, std::string_view>, 13> failureStatusStrings{{
#define ENUM_ENTRY(e) {BuildResult::Failure::e, #e} #define ENUM_ENTRY(e) {BuildResult::Failure::e, #e}
ENUM_ENTRY(PermanentFailure), ENUM_ENTRY(PermanentFailure),
ENUM_ENTRY(InputRejected), ENUM_ENTRY(InputRejected),
@ -54,6 +54,7 @@ static constexpr std::array<std::pair<BuildResult::Failure::Status, std::string_
ENUM_ENTRY(NotDeterministic), ENUM_ENTRY(NotDeterministic),
ENUM_ENTRY(NoSubstituters), ENUM_ENTRY(NoSubstituters),
ENUM_ENTRY(HashMismatch), ENUM_ENTRY(HashMismatch),
ENUM_ENTRY(Cancelled),
#undef ENUM_ENTRY #undef ENUM_ENTRY
}}; }};

View file

@ -74,6 +74,7 @@ struct BuildResult
/// know about this one, so change it back to `OutputRejected` /// know about this one, so change it back to `OutputRejected`
/// before serialization. /// before serialization.
HashMismatch = 15, HashMismatch = 15,
Cancelled = 16,
} status = MiscFailure; } status = MiscFailure;
/** /**

View file

@ -109,7 +109,7 @@ public:
/** /**
* Build result. * Build result.
*/ */
BuildResult buildResult; BuildResult buildResult = {.inner = BuildResult::Failure{.status = BuildResult::Failure::Cancelled}};
/** /**
* Suspend our goal and wait until we get `work`-ed again. * Suspend our goal and wait until we get `work`-ed again.