Skip to content

Commit

Permalink
Export outputPaths function
Browse files Browse the repository at this point in the history
This is useful for the new hydra-queue-runner.
  • Loading branch information
edolstra committed Jun 10, 2015
1 parent f90e9b6 commit b65875f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/libstore/build.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1187,15 +1187,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
Expand Down Expand Up @@ -1247,7 +1238,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;
}
Expand All @@ -1268,7 +1259,7 @@ void DerivationGoal::tryToBuild()
return;
}

missingPaths = outputPaths(drv.outputs);
missingPaths = outputPaths(drv);
if (buildMode != bmCheck)
foreach (PathSet::iterator, i, validPaths) missingPaths.erase(*i);

Expand Down
9 changes: 9 additions & 0 deletions src/libstore/derivations.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}


}
1 change: 1 addition & 0 deletions src/libstore/derivations.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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);

}

0 comments on commit b65875f

Please sign in to comment.