From 71bf7e02d55d753787d651010936fd5aec7d45d1 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 21 Oct 2015 15:44:29 +0200 Subject: [PATCH] Use nix::willBuildLocally() --- src/hydra-queue-runner/hydra-queue-runner.cc | 6 +----- src/hydra-queue-runner/queue-monitor.cc | 6 ++---- src/hydra-queue-runner/state.hh | 2 -- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/hydra-queue-runner/hydra-queue-runner.cc b/src/hydra-queue-runner/hydra-queue-runner.cc index 7656d8ea..1e7ff7cc 100644 --- a/src/hydra-queue-runner/hydra-queue-runner.cc +++ b/src/hydra-queue-runner/hydra-queue-runner.cc @@ -21,10 +21,6 @@ State::State() if (hydraData == "") throw Error("$HYDRA_DATA must be set"); logDir = canonPath(hydraData + "/build-logs"); - - localPlatforms = {settings.thisSystem}; - if (settings.thisSystem == "x86_64-linux") - localPlatforms.insert("i686-linux"); } @@ -97,7 +93,7 @@ void State::monitorMachinesFile() getEnv("NIX_REMOTE_SYSTEMS", pathExists(defaultMachinesFile) ? defaultMachinesFile : ""), ":"); if (machinesFiles.empty()) { - parseMachines("localhost " + concatStringsSep(",", localPlatforms) + parseMachines("localhost " + settings.thisSystem + " - " + int2String(settings.maxBuildJobs) + " 1"); return; } diff --git a/src/hydra-queue-runner/queue-monitor.cc b/src/hydra-queue-runner/queue-monitor.cc index da250f5a..0694facc 100644 --- a/src/hydra-queue-runner/queue-monitor.cc +++ b/src/hydra-queue-runner/queue-monitor.cc @@ -1,6 +1,7 @@ #include "state.hh" #include "build-result.hh" #include "globals.hh" +#include "misc.hh" using namespace nix; @@ -358,10 +359,7 @@ Step::ptr State::createStep(std::shared_ptr store, runnable while step->created == false. */ step->drv = readDerivation(drvPath); - auto attr = step->drv.env.find("preferLocalBuild"); - step->preferLocalBuild = - attr != step->drv.env.end() && attr->second == "1" - && has(localPlatforms, step->drv.platform); + step->preferLocalBuild = willBuildLocally(step->drv); step->systemType = step->drv.platform; { diff --git a/src/hydra-queue-runner/state.hh b/src/hydra-queue-runner/state.hh index 838338aa..fda04192 100644 --- a/src/hydra-queue-runner/state.hh +++ b/src/hydra-queue-runner/state.hh @@ -259,8 +259,6 @@ private: nix::Path hydraData, logDir; - nix::StringSet localPlatforms; - /* The queued builds. */ typedef std::map Builds; Sync builds;