Fix root creation when the root already exists but is owned by another user

This commit is contained in:
Eelco Dolstra 2017-10-19 12:28:06 +02:00
parent b904f25247
commit b04dc6c76e
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
4 changed files with 13 additions and 2 deletions

View file

@ -264,7 +264,7 @@ State::StepResult State::doBuildStep(nix::ref<Store> 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<Store> destStore,
return sDone;
}
void State::addRoot(const Path & storePath)
{
auto root = rootsDir + "/" + baseNameOf(storePath);
if (!pathExists(root)) writeFile(root, "");
}

View file

@ -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);

View file

@ -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();

View file

@ -535,6 +535,8 @@ private:
void dumpStatus(Connection & conn, bool log);
void addRoot(const nix::Path & storePath);
public:
void showStatus();