forked from lix-project/lix
Implement buildDerivation() via the daemon
This commit is contained in:
parent
6e06a18d1b
commit
71a5161365
|
@ -5,6 +5,7 @@
|
||||||
#include "archive.hh"
|
#include "archive.hh"
|
||||||
#include "affinity.hh"
|
#include "affinity.hh"
|
||||||
#include "globals.hh"
|
#include "globals.hh"
|
||||||
|
#include "derivations.hh"
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
@ -458,7 +459,14 @@ void RemoteStore::buildPaths(const PathSet & drvPaths, BuildMode buildMode)
|
||||||
BuildResult RemoteStore::buildDerivation(const Path & drvPath, const BasicDerivation & drv,
|
BuildResult RemoteStore::buildDerivation(const Path & drvPath, const BasicDerivation & drv,
|
||||||
BuildMode buildMode)
|
BuildMode buildMode)
|
||||||
{
|
{
|
||||||
throw Error("not implemented");
|
openConnection();
|
||||||
|
to << wopBuildDerivation << drvPath << drv << buildMode;
|
||||||
|
processStderr();
|
||||||
|
BuildResult res;
|
||||||
|
unsigned int status;
|
||||||
|
from >> status >> res.errorMsg;
|
||||||
|
res.status = (BuildResult::Status) status;
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,8 @@ typedef enum {
|
||||||
wopQuerySubstitutablePaths = 32,
|
wopQuerySubstitutablePaths = 32,
|
||||||
wopQueryValidDerivers = 33,
|
wopQueryValidDerivers = 33,
|
||||||
wopOptimiseStore = 34,
|
wopOptimiseStore = 34,
|
||||||
wopVerifyStore = 35
|
wopVerifyStore = 35,
|
||||||
|
wopBuildDerivation = 36,
|
||||||
} WorkerOp;
|
} WorkerOp;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -248,6 +248,13 @@ Source & operator >> (Source & in, string & s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Source & operator >> (Source & in, unsigned int & n)
|
||||||
|
{
|
||||||
|
n = readInt(in);
|
||||||
|
return in;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class T> T readStrings(Source & source)
|
template<class T> T readStrings(Source & source)
|
||||||
{
|
{
|
||||||
unsigned int count = readInt(source);
|
unsigned int count = readInt(source);
|
||||||
|
|
|
@ -143,6 +143,7 @@ string readString(Source & source);
|
||||||
template<class T> T readStrings(Source & source);
|
template<class T> T readStrings(Source & source);
|
||||||
|
|
||||||
Source & operator >> (Source & in, string & s);
|
Source & operator >> (Source & in, string & s);
|
||||||
|
Source & operator >> (Source & in, unsigned int & n);
|
||||||
|
|
||||||
|
|
||||||
MakeError(SerialisationError, Error)
|
MakeError(SerialisationError, Error)
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "affinity.hh"
|
#include "affinity.hh"
|
||||||
#include "globals.hh"
|
#include "globals.hh"
|
||||||
#include "monitor-fd.hh"
|
#include "monitor-fd.hh"
|
||||||
|
#include "derivations.hh"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
@ -325,6 +326,20 @@ static void performOp(bool trusted, unsigned int clientVersion,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case wopBuildDerivation: {
|
||||||
|
Path drvPath = readStorePath(from);
|
||||||
|
BasicDerivation drv;
|
||||||
|
from >> drv;
|
||||||
|
BuildMode buildMode = (BuildMode) readInt(from);
|
||||||
|
startWork();
|
||||||
|
if (!trusted)
|
||||||
|
throw Error("you are not privileged to build derivations");
|
||||||
|
auto res = store->buildDerivation(drvPath, drv, buildMode);
|
||||||
|
stopWork();
|
||||||
|
to << res.status << res.errorMsg;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case wopEnsurePath: {
|
case wopEnsurePath: {
|
||||||
Path path = readStorePath(from);
|
Path path = readStorePath(from);
|
||||||
startWork();
|
startWork();
|
||||||
|
|
Loading…
Reference in a new issue