forked from lix-project/lix
Merge pull request #3897 from bburdette/error-2238
error messages for issue 2238
This commit is contained in:
commit
3321b2bc65
|
@ -103,7 +103,7 @@ static int _main(int argc, char * * argv)
|
||||||
drvPath = store->parseStorePath(readString(source));
|
drvPath = store->parseStorePath(readString(source));
|
||||||
auto requiredFeatures = readStrings<std::set<std::string>>(source);
|
auto requiredFeatures = readStrings<std::set<std::string>>(source);
|
||||||
|
|
||||||
auto canBuildLocally = amWilling
|
auto canBuildLocally = amWilling
|
||||||
&& ( neededSystem == settings.thisSystem
|
&& ( neededSystem == settings.thisSystem
|
||||||
|| settings.extraPlatforms.get().count(neededSystem) > 0)
|
|| settings.extraPlatforms.get().count(neededSystem) > 0)
|
||||||
&& allSupportedLocally(requiredFeatures);
|
&& allSupportedLocally(requiredFeatures);
|
||||||
|
@ -170,7 +170,45 @@ static int _main(int argc, char * * argv)
|
||||||
if (rightType && !canBuildLocally)
|
if (rightType && !canBuildLocally)
|
||||||
std::cerr << "# postpone\n";
|
std::cerr << "# postpone\n";
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
// build the hint template.
|
||||||
|
string hintstring = "derivation: %s\nrequired (system, features): (%s, %s)";
|
||||||
|
hintstring += "\n%s available machines:";
|
||||||
|
hintstring += "\n(systems, maxjobs, supportedFeatures, mandatoryFeatures)";
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < machines.size(); ++i) {
|
||||||
|
hintstring += "\n(%s, %s, %s, %s)";
|
||||||
|
}
|
||||||
|
|
||||||
|
// add the template values.
|
||||||
|
string drvstr;
|
||||||
|
if (drvPath.has_value())
|
||||||
|
drvstr = drvPath->to_string();
|
||||||
|
else
|
||||||
|
drvstr = "<unknown>";
|
||||||
|
|
||||||
|
auto hint = hintformat(hintstring);
|
||||||
|
hint
|
||||||
|
% drvstr
|
||||||
|
% neededSystem
|
||||||
|
% concatStringsSep<StringSet>(", ", requiredFeatures)
|
||||||
|
% machines.size();
|
||||||
|
|
||||||
|
for (auto & m : machines) {
|
||||||
|
hint % concatStringsSep<vector<string>>(", ", m.systemTypes)
|
||||||
|
% m.maxJobs
|
||||||
|
% concatStringsSep<StringSet>(", ", m.supportedFeatures)
|
||||||
|
% concatStringsSep<StringSet>(", ", m.mandatoryFeatures);
|
||||||
|
}
|
||||||
|
|
||||||
|
logError({
|
||||||
|
.name = "Remote build",
|
||||||
|
.description = "Failed to find a machine for remote build!",
|
||||||
|
.hint = hint
|
||||||
|
});
|
||||||
|
|
||||||
std::cerr << "# decline\n";
|
std::cerr << "# decline\n";
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4876,8 +4876,17 @@ void Worker::run(const Goals & _topGoals)
|
||||||
waitForInput();
|
waitForInput();
|
||||||
else {
|
else {
|
||||||
if (awake.empty() && 0 == settings.maxBuildJobs)
|
if (awake.empty() && 0 == settings.maxBuildJobs)
|
||||||
throw Error("unable to start any build; either increase '--max-jobs' "
|
{
|
||||||
"or enable remote builds");
|
if (getMachines().empty())
|
||||||
|
throw Error("unable to start any build; either increase '--max-jobs' "
|
||||||
|
"or enable remote builds."
|
||||||
|
"\nhttps://nixos.org/nix/manual/#chap-distributed-builds");
|
||||||
|
else
|
||||||
|
throw Error("unable to start any build; remote machines may not have "
|
||||||
|
"all required system features."
|
||||||
|
"\nhttps://nixos.org/nix/manual/#chap-distributed-builds");
|
||||||
|
|
||||||
|
}
|
||||||
assert(!awake.empty());
|
assert(!awake.empty());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue