Account steps with preferLocalBuild as a separate system type

They will show up in machineTypes as (e.g.) x86_64-linux:local instead
of x86_64-linux. This is to prevent the Hydra provisioner from
creating machines for steps that are supposed to be executed locally.
This commit is contained in:
Eelco Dolstra 2015-09-02 13:42:25 +02:00
parent 7e954aff03
commit ee9bf7ace7

View file

@ -332,21 +332,26 @@ Step::ptr State::createStep(std::shared_ptr<StoreAPI> store, const Path & drvPat
it's not runnable yet, and other threads won't make it
runnable while step->created == false. */
step->drv = readDerivation(drvPath);
step->systemType = step->drv.platform;
{
auto i = step->drv.env.find("requiredSystemFeatures");
if (i != step->drv.env.end()) {
step->requiredSystemFeatures = tokenizeString<std::set<std::string>>(i->second);
step->systemType += ":";
step->systemType += concatStringsSep(",", step->requiredSystemFeatures);
}
}
auto attr = step->drv.env.find("preferLocalBuild");
step->preferLocalBuild =
attr != step->drv.env.end() && attr->second == "1"
&& has(localPlatforms, step->drv.platform);
step->systemType = step->drv.platform;
{
auto i = step->drv.env.find("requiredSystemFeatures");
StringSet features;
if (i != step->drv.env.end())
features = step->requiredSystemFeatures = tokenizeString<std::set<std::string>>(i->second);
if (step->preferLocalBuild)
features.insert("local");
if (!features.empty()) {
step->systemType += ":";
step->systemType += concatStringsSep(",", features);
}
}
/* Are all outputs valid? */
bool valid = true;
for (auto & i : step->drv.outputs) {