aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-05-01 16:08:13 +0200
committerEelco Dolstra <edolstra@gmail.com>2017-05-01 17:30:16 +0200
commitdeac171925bf2e3960d2f837d95b71c0427d26dd (patch)
tree54413d867ed56d1346abb45e95722e0d03843e7c
parent3f5b98e65a86abd31f97bd763ae5cb41ff4aeda8 (diff)
Implement LegacySSHStore::buildDerivation()
This makes LegacySSHStore usable by build-remote and hydra-queue-runner.
-rw-r--r--src/libstore/legacy-ssh-store.cc37
1 files changed, 32 insertions, 5 deletions
diff --git a/src/libstore/legacy-ssh-store.cc b/src/libstore/legacy-ssh-store.cc
index de0562aef..d6b70b992 100644
--- a/src/libstore/legacy-ssh-store.cc
+++ b/src/libstore/legacy-ssh-store.cc
@@ -5,6 +5,7 @@
#include "store-api.hh"
#include "worker-protocol.hh"
#include "ssh.hh"
+#include "derivations.hh"
namespace nix {
@@ -21,6 +22,7 @@ struct LegacySSHStore : public Store
std::unique_ptr<SSHMaster::Connection> sshConn;
FdSink to;
FdSource from;
+ int remoteVersion;
};
std::string host;
@@ -53,8 +55,6 @@ struct LegacySSHStore : public Store
conn->to = FdSink(conn->sshConn->in.get());
conn->from = FdSource(conn->sshConn->out.get());
- int remoteVersion;
-
try {
conn->to << SERVE_MAGIC_1 << SERVE_PROTOCOL_VERSION;
conn->to.flush();
@@ -62,8 +62,8 @@ struct LegacySSHStore : public Store
unsigned int magic = readInt(conn->from);
if (magic != SERVE_MAGIC_2)
throw Error("protocol mismatch with ‘nix-store --serve’ on ‘%s’", host);
- remoteVersion = readInt(conn->from);
- if (GET_PROTOCOL_MAJOR(remoteVersion) != 0x200)
+ conn->remoteVersion = readInt(conn->from);
+ if (GET_PROTOCOL_MAJOR(conn->remoteVersion) != 0x200)
throw Error("unsupported ‘nix-store --serve’ protocol version on ‘%s’", host);
} catch (EndOfFile & e) {
@@ -173,7 +173,34 @@ struct LegacySSHStore : public Store
BuildResult buildDerivation(const Path & drvPath, const BasicDerivation & drv,
BuildMode buildMode) override
- { unsupported(); }
+ {
+ auto conn(connections->get());
+
+ conn->to
+ << cmdBuildDerivation
+ << drvPath
+ << drv
+ << settings.maxSilentTime
+ << settings.buildTimeout;
+ if (GET_PROTOCOL_MINOR(conn->remoteVersion) >= 2)
+ conn->to
+ << settings.maxLogSize;
+ if (GET_PROTOCOL_MINOR(conn->remoteVersion) >= 3)
+ conn->to
+ << settings.buildRepeat
+ << settings.enforceDeterminism;
+
+ conn->to.flush();
+
+ BuildResult status;
+ status.status = (BuildResult::Status) readInt(conn->from);
+ conn->from >> status.errorMsg;
+
+ if (GET_PROTOCOL_MINOR(conn->remoteVersion) >= 3)
+ conn->from >> status.timesBuilt >> status.isNonDeterministic >> status.startTime >> status.stopTime;
+
+ return status;
+ }
void ensurePath(const Path & path) override
{ unsupported(); }