Export outputPaths function

This is useful for the new hydra-queue-runner.
This commit is contained in:
Eelco Dolstra 2015-06-10 16:17:06 +02:00 committed by Ludovic Courtès
parent 5dfea34048
commit 60bda60fc0
3 changed files with 12 additions and 11 deletions

View File

@ -1188,15 +1188,6 @@ void DerivationGoal::inputsRealised()
}
PathSet outputPaths(const DerivationOutputs & outputs)
{
PathSet paths;
foreach (DerivationOutputs::const_iterator, i, outputs)
paths.insert(i->second.path);
return paths;
}
static bool canBuildLocally(const string & platform)
{
return platform == settings.thisSystem
@ -1248,7 +1239,7 @@ void DerivationGoal::tryToBuild()
can't acquire the lock, then continue; hopefully some other
goal can start a build, and if not, the main loop will sleep a
few seconds and then retry this goal. */
if (!outputLocks.lockPaths(outputPaths(drv.outputs), "", false)) {
if (!outputLocks.lockPaths(outputPaths(drv), "", false)) {
worker.waitForAWhile(shared_from_this());
return;
}
@ -1269,7 +1260,7 @@ void DerivationGoal::tryToBuild()
return;
}
missingPaths = outputPaths(drv.outputs);
missingPaths = outputPaths(drv);
if (buildMode != bmCheck)
foreach (PathSet::iterator, i, validPaths) missingPaths.erase(*i);

View File

@ -285,4 +285,13 @@ bool wantOutput(const string & output, const std::set<string> & wanted)
}
PathSet outputPaths(const Derivation & drv)
{
PathSet paths;
for (auto & i : drv.outputs)
paths.insert(i.second.path);
return paths;
}
}

View File

@ -89,5 +89,6 @@ Path makeDrvPathWithOutputs(const Path & drvPath, const std::set<string> & outpu
bool wantOutput(const string & output, const std::set<string> & wanted);
PathSet outputPaths(const Derivation & drv);
}