This commit is contained in:
Eelco Dolstra 2021-09-01 21:46:25 +02:00
parent 2cb7a502a4
commit f73d911628

View file

@ -1071,18 +1071,19 @@ StorePathSet LocalStore::querySubstitutablePaths(const StorePathSet & paths)
} }
// FIXME: move this, it's not specific to LocalStore.
void LocalStore::querySubstitutablePathInfos(const StorePathCAMap & paths, SubstitutablePathInfos & infos) void LocalStore::querySubstitutablePathInfos(const StorePathCAMap & paths, SubstitutablePathInfos & infos)
{ {
if (!settings.useSubstitutes) return; if (!settings.useSubstitutes) return;
for (auto & sub : getDefaultSubstituters()) { for (auto & sub : getDefaultSubstituters()) {
for (auto & path : paths) { for (auto & path : paths) {
if (infos.find(path.first) != infos.end()) if (infos.count(path.first))
// choose first succeeding substituter // Choose first succeeding substituter.
continue; continue;
auto subPath(path.first); auto subPath(path.first);
// recompute store path so that we can use a different store root // Recompute store path so that we can use a different store root.
if (path.second) { if (path.second) {
subPath = makeFixedOutputPathFromCA(path.first.name(), *path.second); subPath = makeFixedOutputPathFromCA(path.first.name(), *path.second);
if (sub->storeDir == storeDir) if (sub->storeDir == storeDir)