Merge branch 'short-circuit-subst' of https://github.com/Kha/nix

This commit is contained in:
Eelco Dolstra 2021-09-01 21:45:04 +02:00
commit 2cb7a502a4
2 changed files with 8 additions and 3 deletions

View file

@ -1076,6 +1076,10 @@ void LocalStore::querySubstitutablePathInfos(const StorePathCAMap & paths, Subst
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())
// choose first succeeding substituter
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

View file

@ -430,9 +430,10 @@ public:
virtual StorePathSet querySubstitutablePaths(const StorePathSet & paths) { return {}; }; virtual StorePathSet querySubstitutablePaths(const StorePathSet & paths) { return {}; };
/* Query substitute info (i.e. references, derivers and download /* Query substitute info (i.e. references, derivers and download
sizes) of a map of paths to their optional ca values. If a path sizes) of a map of paths to their optional ca values. The info
does not have substitute info, it's omitted from the resulting of the first succeeding substituter for each path will be
infos map. */ returned. If a path does not have substitute info, it's omitted
from the resulting infos map. */
virtual void querySubstitutablePathInfos(const StorePathCAMap & paths, virtual void querySubstitutablePathInfos(const StorePathCAMap & paths,
SubstitutablePathInfos & infos) { return; }; SubstitutablePathInfos & infos) { return; };