From 708d9070006fd46ffe4c2c3cf64154ea4430202a Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 2 Dec 2015 18:43:51 +0200 Subject: daemon: Add 'buildMode' parameter to 'buildPaths' RPC. * nix/libstore/worker-protocol.hh (PROTOCOL_VERSION): Bump to 0x10f. * nix/libstore/remote-store.cc (RemoteStore::buildPaths): Send the BUILDMODE when the daemon supports it. Reject invalid values of BUILDMODE for old daemons. * nix/nix-daemon/nix-daemon.cc (performOp) : Read the build mode when the client supports it. --- nix/nix-daemon/nix-daemon.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'nix/nix-daemon') diff --git a/nix/nix-daemon/nix-daemon.cc b/nix/nix-daemon/nix-daemon.cc index bd9eebe0a9..c1e697bcac 100644 --- a/nix/nix-daemon/nix-daemon.cc +++ b/nix/nix-daemon/nix-daemon.cc @@ -451,8 +451,17 @@ static void performOp(bool trusted, unsigned int clientVersion, case wopBuildPaths: { PathSet drvs = readStorePaths(from); + BuildMode mode = bmNormal; + if (GET_PROTOCOL_MINOR(clientVersion) >= 15) { + mode = (BuildMode)readInt(from); + + /* Repairing is not atomic, so disallowed for "untrusted" + clients. */ + if (mode == bmRepair && !trusted) + throw Error("repairing is not supported when building through the Nix daemon"); + } startWork(); - store->buildPaths(drvs); + store->buildPaths(drvs, mode); stopWork(); writeInt(1, to); break; -- cgit v1.2.3