From ee9bf7ace79956bf8fb29deb958825cc62e19774 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 2 Sep 2015 13:42:25 +0200 Subject: [PATCH] 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. --- src/hydra-queue-runner/queue-monitor.cc | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/hydra-queue-runner/queue-monitor.cc b/src/hydra-queue-runner/queue-monitor.cc index 68635294..c9d21200 100644 --- a/src/hydra-queue-runner/queue-monitor.cc +++ b/src/hydra-queue-runner/queue-monitor.cc @@ -332,21 +332,26 @@ Step::ptr State::createStep(std::shared_ptr 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>(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>(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) {