diff --git a/src/hydra-queue-runner/builder.cc b/src/hydra-queue-runner/builder.cc index 8a636b17..ceaa252e 100644 --- a/src/hydra-queue-runner/builder.cc +++ b/src/hydra-queue-runner/builder.cc @@ -264,7 +264,7 @@ State::StepResult State::doBuildStep(nix::ref destStore, assert(stepNr); for (auto & path : step->drv.outputPaths()) - writeFile(rootsDir + "/" + baseNameOf(path), ""); + addRoot(path); /* Register success in the database for all Build objects that have this step as the top-level step. Since the queue @@ -473,3 +473,10 @@ State::StepResult State::doBuildStep(nix::ref destStore, return sDone; } + + +void State::addRoot(const Path & storePath) +{ + auto root = rootsDir + "/" + baseNameOf(storePath); + if (!pathExists(root)) writeFile(root, ""); +} diff --git a/src/hydra-queue-runner/hydra-queue-runner.cc b/src/hydra-queue-runner/hydra-queue-runner.cc index f0bb338e..283ca96b 100644 --- a/src/hydra-queue-runner/hydra-queue-runner.cc +++ b/src/hydra-queue-runner/hydra-queue-runner.cc @@ -841,6 +841,8 @@ void State::run(BuildID buildOne) jobsetRepeats.emplace(std::make_pair(s2[0], s2[1]), std::stoi(s2[2])); } + addRoot("/nix/store/rk9lahzm21qm0zjclv6mz0m4hy77wk14-vm-test-run-unnamed.drv"); + { auto conn(dbPool.get()); clearBusy(*conn, 0); diff --git a/src/hydra-queue-runner/queue-monitor.cc b/src/hydra-queue-runner/queue-monitor.cc index 85d8f626..862925b2 100644 --- a/src/hydra-queue-runner/queue-monitor.cc +++ b/src/hydra-queue-runner/queue-monitor.cc @@ -222,7 +222,7 @@ bool State::getQueuedBuilds(Connection & conn, BuildOutput res = getBuildOutputCached(conn, destStore, drv); for (auto & path : drv.outputPaths()) - writeFile(rootsDir + "/" + baseNameOf(path), ""); + addRoot(path); { auto mc = startDbUpdate(); diff --git a/src/hydra-queue-runner/state.hh b/src/hydra-queue-runner/state.hh index f5ba641e..543a36e3 100644 --- a/src/hydra-queue-runner/state.hh +++ b/src/hydra-queue-runner/state.hh @@ -535,6 +535,8 @@ private: void dumpStatus(Connection & conn, bool log); + void addRoot(const nix::Path & storePath); + public: void showStatus();