Merge pull request #9563 from obsidiansystems/tryResolve-evalStore

Give `Derivation::tryResolve` an `evalStore` argument

(cherry picked from commit 36ca6adc60511dc822870f2df43c0a578e481925)
Change-Id: If76b185a01ffa982e4c49cf333a9b5fbf9edebfe
This commit is contained in:
eldritch horrors 2024-03-04 06:32:46 +01:00
parent dd2926f7ea
commit d42cd24afe
3 changed files with 4 additions and 4 deletions

View file

@ -558,7 +558,7 @@ void DerivationGoal::inputsRealised()
inputDrvOutputs statefully, sometimes it gets out of sync with inputDrvOutputs statefully, sometimes it gets out of sync with
the real source of truth (store). So we query the store the real source of truth (store). So we query the store
directly if there's a problem. */ directly if there's a problem. */
attempt = fullDrv.tryResolve(worker.store); attempt = fullDrv.tryResolve(worker.store, &worker.evalStore);
} }
assert(attempt); assert(attempt);
Derivation drvResolved { std::move(*attempt) }; Derivation drvResolved { std::move(*attempt) };

View file

@ -1003,13 +1003,13 @@ static void rewriteDerivation(Store & store, BasicDerivation & drv, const String
} }
std::optional<BasicDerivation> Derivation::tryResolve(Store & store) const std::optional<BasicDerivation> Derivation::tryResolve(Store & store, Store * evalStore) const
{ {
std::map<std::pair<StorePath, std::string>, StorePath> inputDrvOutputs; std::map<std::pair<StorePath, std::string>, StorePath> inputDrvOutputs;
std::function<void(const StorePath &, const DerivedPathMap<StringSet>::ChildNode &)> accum; std::function<void(const StorePath &, const DerivedPathMap<StringSet>::ChildNode &)> accum;
accum = [&](auto & inputDrv, auto & node) { accum = [&](auto & inputDrv, auto & node) {
for (auto & [outputName, outputPath] : store.queryPartialDerivationOutputMap(inputDrv)) { for (auto & [outputName, outputPath] : store.queryPartialDerivationOutputMap(inputDrv, evalStore)) {
if (outputPath) { if (outputPath) {
inputDrvOutputs.insert_or_assign({inputDrv, outputName}, *outputPath); inputDrvOutputs.insert_or_assign({inputDrv, outputName}, *outputPath);
if (auto p = get(node.childMap, outputName)) if (auto p = get(node.childMap, outputName))

View file

@ -340,7 +340,7 @@ struct Derivation : BasicDerivation
* 2. Input placeholders are replaced with realized input store * 2. Input placeholders are replaced with realized input store
* paths. * paths.
*/ */
std::optional<BasicDerivation> tryResolve(Store & store) const; std::optional<BasicDerivation> tryResolve(Store & store, Store * evalStore = nullptr) const;
/** /**
* Like the above, but instead of querying the Nix database for * Like the above, but instead of querying the Nix database for