forked from lix-project/hydra
Use nix::willBuildLocally()
This commit is contained in:
parent
30823078c4
commit
71bf7e02d5
|
@ -21,10 +21,6 @@ State::State()
|
||||||
if (hydraData == "") throw Error("$HYDRA_DATA must be set");
|
if (hydraData == "") throw Error("$HYDRA_DATA must be set");
|
||||||
|
|
||||||
logDir = canonPath(hydraData + "/build-logs");
|
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 : ""), ":");
|
getEnv("NIX_REMOTE_SYSTEMS", pathExists(defaultMachinesFile) ? defaultMachinesFile : ""), ":");
|
||||||
|
|
||||||
if (machinesFiles.empty()) {
|
if (machinesFiles.empty()) {
|
||||||
parseMachines("localhost " + concatStringsSep(",", localPlatforms)
|
parseMachines("localhost " + settings.thisSystem
|
||||||
+ " - " + int2String(settings.maxBuildJobs) + " 1");
|
+ " - " + int2String(settings.maxBuildJobs) + " 1");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "state.hh"
|
#include "state.hh"
|
||||||
#include "build-result.hh"
|
#include "build-result.hh"
|
||||||
#include "globals.hh"
|
#include "globals.hh"
|
||||||
|
#include "misc.hh"
|
||||||
|
|
||||||
|
|
||||||
using namespace nix;
|
using namespace nix;
|
||||||
|
@ -358,10 +359,7 @@ Step::ptr State::createStep(std::shared_ptr<StoreAPI> store,
|
||||||
runnable while step->created == false. */
|
runnable while step->created == false. */
|
||||||
step->drv = readDerivation(drvPath);
|
step->drv = readDerivation(drvPath);
|
||||||
|
|
||||||
auto attr = step->drv.env.find("preferLocalBuild");
|
step->preferLocalBuild = willBuildLocally(step->drv);
|
||||||
step->preferLocalBuild =
|
|
||||||
attr != step->drv.env.end() && attr->second == "1"
|
|
||||||
&& has(localPlatforms, step->drv.platform);
|
|
||||||
|
|
||||||
step->systemType = step->drv.platform;
|
step->systemType = step->drv.platform;
|
||||||
{
|
{
|
||||||
|
|
|
@ -259,8 +259,6 @@ private:
|
||||||
|
|
||||||
nix::Path hydraData, logDir;
|
nix::Path hydraData, logDir;
|
||||||
|
|
||||||
nix::StringSet localPlatforms;
|
|
||||||
|
|
||||||
/* The queued builds. */
|
/* The queued builds. */
|
||||||
typedef std::map<BuildID, Build::ptr> Builds;
|
typedef std::map<BuildID, Build::ptr> Builds;
|
||||||
Sync<Builds> builds;
|
Sync<Builds> builds;
|
||||||
|
|
Loading…
Reference in a new issue