print derivation name if system attribute is missing

This commit is contained in:
Jörg Thalheim 2023-09-12 09:01:51 +02:00 committed by mergify[bot]
parent 4af42f97d3
commit 15ec2c4663

View file

@ -96,13 +96,13 @@ struct MyArgs : MixEvalArgs, MixCommonArgs {
.handler = { .handler = {
[=, this](std::string s) { nrWorkers = std::stoi(s); }}}); [=, this](std::string s) { nrWorkers = std::stoi(s); }}});
addFlag( addFlag({.longName = "max-memory-size",
{.longName = "max-memory-size", .description = "maximum evaluation memory size in megabyte "
.description = "(4GiB per worker by default)",
"maximum evaluation memory size (4GiB per worker by default)", .labels = {"size"},
.labels = {"size"}, .handler = {[=, this](std::string s) {
.handler = { maxMemorySize = std::stoi(s);
[=, this](std::string s) { maxMemorySize = std::stoi(s); }}}); }}});
addFlag({.longName = "flake", addFlag({.longName = "flake",
.description = "build a flake", .description = "build a flake",
@ -201,8 +201,11 @@ struct Drv {
std::optional<nlohmann::json> meta; std::optional<nlohmann::json> meta;
Drv(EvalState &state, DrvInfo &drvInfo) { Drv(EvalState &state, DrvInfo &drvInfo) {
if (drvInfo.querySystem() == "unknown") name = drvInfo.queryName();
throw EvalError("derivation must have a 'system' attribute"); system = drvInfo.querySystem();
if (system == "unknown")
throw EvalError("derivation '" + name +
"' must have a 'system' attribute");
auto localStore = state.store.dynamic_pointer_cast<LocalFSStore>(); auto localStore = state.store.dynamic_pointer_cast<LocalFSStore>();
@ -239,8 +242,6 @@ struct Drv {
isCached = queryIsCached(*localStore, outputs); isCached = queryIsCached(*localStore, outputs);
} }
name = drvInfo.queryName();
system = drvInfo.querySystem();
drvPath = localStore->printStorePath(drvInfo.requireDrvPath()); drvPath = localStore->printStorePath(drvInfo.requireDrvPath());
auto drv = localStore->readDerivation(drvInfo.requireDrvPath()); auto drv = localStore->readDerivation(drvInfo.requireDrvPath());