Process Nix API changes
This commit is contained in:
parent
993647d1e3
commit
92d8b59361
|
@ -153,7 +153,7 @@ static void findJobsWrapped(EvalState & state, JSONObject & top,
|
|||
done. */
|
||||
if (gcRootsDir != "") {
|
||||
Path root = gcRootsDir + "/" + baseNameOf(drvPath);
|
||||
if (!pathExists(root)) addPermRoot(*store, drvPath, root, false);
|
||||
if (!pathExists(root)) state.store->addPermRoot(drvPath, root, false);
|
||||
}
|
||||
|
||||
res.attr("outputs");
|
||||
|
@ -253,7 +253,7 @@ int main(int argc, char * * argv)
|
|||
|
||||
if (gcRootsDir == "") printMsg(lvlError, "warning: `--gc-roots-dir' not specified");
|
||||
|
||||
EvalState state(searchPath);
|
||||
EvalState state(searchPath, openStore());
|
||||
|
||||
AutoArgs autoArgs;
|
||||
Value * inputsSet = state.allocValue();
|
||||
|
@ -280,8 +280,6 @@ int main(int argc, char * * argv)
|
|||
autoArgs[sInputs].push_back(inputsSet);
|
||||
}
|
||||
|
||||
store = openStore();
|
||||
|
||||
Value v;
|
||||
state.evalFile(releaseExpr, v);
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "misc.hh"
|
||||
#include "serve-protocol.hh"
|
||||
#include "state.hh"
|
||||
#include "util.hh"
|
||||
|
@ -74,14 +73,14 @@ static void openConnection(Machine::ptr machine, Path tmpDir, int stderrFD, Chil
|
|||
}
|
||||
|
||||
|
||||
static void copyClosureTo(std::shared_ptr<StoreAPI> store,
|
||||
static void copyClosureTo(ref<Store> store,
|
||||
FdSource & from, FdSink & to, const PathSet & paths,
|
||||
counter & bytesSent,
|
||||
bool useSubstitutes = false)
|
||||
{
|
||||
PathSet closure;
|
||||
for (auto & path : paths)
|
||||
computeFSClosure(*store, path, closure);
|
||||
store->computeFSClosure(path, closure);
|
||||
|
||||
/* Send the "query valid paths" command with the "lock" option
|
||||
enabled. This prevents a race where the remote host
|
||||
|
@ -96,7 +95,7 @@ static void copyClosureTo(std::shared_ptr<StoreAPI> store,
|
|||
|
||||
if (present.size() == closure.size()) return;
|
||||
|
||||
Paths sorted = topoSortPaths(*store, closure);
|
||||
Paths sorted = store->topoSortPaths(closure);
|
||||
|
||||
Paths missing;
|
||||
for (auto i = sorted.rbegin(); i != sorted.rend(); ++i)
|
||||
|
@ -108,7 +107,7 @@ static void copyClosureTo(std::shared_ptr<StoreAPI> store,
|
|||
bytesSent += store->queryPathInfo(p).narSize;
|
||||
|
||||
to << cmdImportPaths;
|
||||
exportPaths(*store, missing, false, to);
|
||||
store->exportPaths(missing, false, to);
|
||||
to.flush();
|
||||
|
||||
if (readInt(from) != 1)
|
||||
|
@ -116,7 +115,7 @@ static void copyClosureTo(std::shared_ptr<StoreAPI> store,
|
|||
}
|
||||
|
||||
|
||||
static void copyClosureFrom(std::shared_ptr<StoreAPI> store,
|
||||
static void copyClosureFrom(ref<Store> store,
|
||||
FdSource & from, FdSink & to, const PathSet & paths, counter & bytesReceived)
|
||||
{
|
||||
to << cmdExportPaths << 0 << paths;
|
||||
|
@ -128,7 +127,7 @@ static void copyClosureFrom(std::shared_ptr<StoreAPI> store,
|
|||
}
|
||||
|
||||
|
||||
void State::buildRemote(std::shared_ptr<StoreAPI> store,
|
||||
void State::buildRemote(ref<Store> store,
|
||||
Machine::ptr machine, Step::ptr step,
|
||||
unsigned int maxSilentTime, unsigned int buildTimeout,
|
||||
RemoteResult & result)
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include "build-result.hh"
|
||||
#include "store-api.hh"
|
||||
#include "misc.hh"
|
||||
#include "util.hh"
|
||||
#include "regex.hh"
|
||||
|
||||
|
@ -22,7 +21,7 @@ static std::tuple<bool, string> secureRead(Path fileName)
|
|||
}
|
||||
|
||||
|
||||
BuildOutput getBuildOutput(std::shared_ptr<StoreAPI> store, const Derivation & drv)
|
||||
BuildOutput getBuildOutput(nix::ref<Store> store, const Derivation & drv)
|
||||
{
|
||||
BuildOutput res;
|
||||
|
||||
|
@ -32,7 +31,7 @@ BuildOutput getBuildOutput(std::shared_ptr<StoreAPI> store, const Derivation & d
|
|||
outputs.insert(output.second.path);
|
||||
PathSet closure;
|
||||
for (auto & output : outputs)
|
||||
computeFSClosure(*store, output, closure);
|
||||
store->computeFSClosure(output, closure);
|
||||
for (auto & path : closure) {
|
||||
auto info = store->queryPathInfo(path);
|
||||
res.closureSize += info.narSize;
|
||||
|
|
|
@ -37,4 +37,4 @@ struct BuildOutput
|
|||
std::map<std::string, BuildMetric> metrics;
|
||||
};
|
||||
|
||||
BuildOutput getBuildOutput(std::shared_ptr<nix::StoreAPI> store, const nix::Derivation & drv);
|
||||
BuildOutput getBuildOutput(nix::ref<nix::Store> store, const nix::Derivation & drv);
|
||||
|
|
|
@ -45,7 +45,7 @@ void State::builder(MachineReservation::ptr reservation)
|
|||
}
|
||||
|
||||
|
||||
bool State::doBuildStep(std::shared_ptr<StoreAPI> store, Step::ptr step,
|
||||
bool State::doBuildStep(nix::ref<Store> store, Step::ptr step,
|
||||
Machine::ptr machine)
|
||||
{
|
||||
{
|
||||
|
@ -354,7 +354,7 @@ bool State::doBuildStep(std::shared_ptr<StoreAPI> store, Step::ptr step,
|
|||
/* Remember failed paths in the database so that they
|
||||
won't be built again. */
|
||||
if (!cachedFailure && result.status == BuildResult::PermanentFailure)
|
||||
for (auto & path : outputPaths(step->drv))
|
||||
for (auto & path : step->drv.outputPaths())
|
||||
txn.parameterized("insert into FailedPaths values ($1)")(path).exec();
|
||||
|
||||
txn.commit();
|
||||
|
|
|
@ -359,7 +359,7 @@ void State::markSucceededBuild(pqxx::work & txn, Build::ptr build,
|
|||
bool State::checkCachedFailure(Step::ptr step, Connection & conn)
|
||||
{
|
||||
pqxx::work txn(conn);
|
||||
for (auto & path : outputPaths(step->drv))
|
||||
for (auto & path : step->drv.outputPaths())
|
||||
if (!txn.parameterized("select 1 from FailedPaths where path = $1")(path).exec().empty())
|
||||
return true;
|
||||
return false;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include "state.hh"
|
||||
#include "build-result.hh"
|
||||
#include "globals.hh"
|
||||
#include "misc.hh"
|
||||
|
||||
|
||||
using namespace nix;
|
||||
|
@ -64,7 +63,7 @@ void State::queueMonitorLoop()
|
|||
}
|
||||
|
||||
|
||||
bool State::getQueuedBuilds(Connection & conn, std::shared_ptr<StoreAPI> store, unsigned int & lastBuildId)
|
||||
bool State::getQueuedBuilds(Connection & conn, ref<Store> store, unsigned int & lastBuildId)
|
||||
{
|
||||
printMsg(lvlInfo, format("checking the queue for builds > %1%...") % lastBuildId);
|
||||
|
||||
|
@ -315,7 +314,7 @@ void State::processQueueChange(Connection & conn)
|
|||
}
|
||||
|
||||
|
||||
Step::ptr State::createStep(std::shared_ptr<StoreAPI> store,
|
||||
Step::ptr State::createStep(ref<Store> store,
|
||||
Connection & conn, Build::ptr build, const Path & drvPath,
|
||||
Build::ptr referringBuild, Step::ptr referringStep, std::set<Path> & finishedDrvs,
|
||||
std::set<Step::ptr> & newSteps, std::set<Step::ptr> & newRunnable)
|
||||
|
@ -373,7 +372,7 @@ Step::ptr State::createStep(std::shared_ptr<StoreAPI> store,
|
|||
runnable while step->created == false. */
|
||||
step->drv = readDerivation(drvPath);
|
||||
|
||||
step->preferLocalBuild = willBuildLocally(step->drv);
|
||||
step->preferLocalBuild = step->drv.willBuildLocally();
|
||||
|
||||
step->systemType = step->drv.platform;
|
||||
{
|
||||
|
@ -391,7 +390,7 @@ Step::ptr State::createStep(std::shared_ptr<StoreAPI> store,
|
|||
|
||||
/* Are all outputs valid? */
|
||||
bool valid = true;
|
||||
PathSet outputs = outputPaths(step->drv);
|
||||
PathSet outputs = step->drv.outputPaths();
|
||||
DerivationOutputs missing;
|
||||
PathSet missingPaths;
|
||||
for (auto & i : step->drv.outputs)
|
||||
|
|
|
@ -377,12 +377,12 @@ private:
|
|||
void queueMonitorLoop();
|
||||
|
||||
/* Check the queue for new builds. */
|
||||
bool getQueuedBuilds(Connection & conn, std::shared_ptr<nix::StoreAPI> store, unsigned int & lastBuildId);
|
||||
bool getQueuedBuilds(Connection & conn, nix::ref<nix::Store> store, unsigned int & lastBuildId);
|
||||
|
||||
/* Handle cancellation, deletion and priority bumps. */
|
||||
void processQueueChange(Connection & conn);
|
||||
|
||||
Step::ptr createStep(std::shared_ptr<nix::StoreAPI> store,
|
||||
Step::ptr createStep(nix::ref<nix::Store> store,
|
||||
Connection & conn, Build::ptr build, const nix::Path & drvPath,
|
||||
Build::ptr referringBuild, Step::ptr referringStep, std::set<nix::Path> & finishedDrvs,
|
||||
std::set<Step::ptr> & newSteps, std::set<Step::ptr> & newRunnable);
|
||||
|
@ -405,10 +405,10 @@ private:
|
|||
|
||||
/* Perform the given build step. Return true if the step is to be
|
||||
retried. */
|
||||
bool doBuildStep(std::shared_ptr<nix::StoreAPI> store, Step::ptr step,
|
||||
bool doBuildStep(nix::ref<nix::Store> store, Step::ptr step,
|
||||
Machine::ptr machine);
|
||||
|
||||
void buildRemote(std::shared_ptr<nix::StoreAPI> store,
|
||||
void buildRemote(nix::ref<nix::Store> store,
|
||||
Machine::ptr machine, Step::ptr step,
|
||||
unsigned int maxSilentTime, unsigned int buildTimeout,
|
||||
RemoteResult & result);
|
||||
|
|
Loading…
Reference in a new issue