Respect build-use-substitutes

This commit is contained in:
Eelco Dolstra 2016-06-02 14:25:07 +02:00
parent 812c0dfbe2
commit 064816ab98
2 changed files with 3 additions and 1 deletions

View file

@ -3107,7 +3107,7 @@ void SubstitutionGoal::init()
if (settings.readOnlyMode) if (settings.readOnlyMode)
throw Error(format("cannot substitute path %1% - no write access to the Nix store") % storePath); throw Error(format("cannot substitute path %1% - no write access to the Nix store") % storePath);
subs = getDefaultSubstituters(); subs = settings.useSubstitutes ? getDefaultSubstituters() : std::list<ref<Store>>();
tryNext(); tryNext();
} }

View file

@ -780,6 +780,7 @@ Path LocalStore::queryPathFromHashPart(const string & hashPart)
PathSet LocalStore::querySubstitutablePaths(const PathSet & paths) PathSet LocalStore::querySubstitutablePaths(const PathSet & paths)
{ {
if (!settings.useSubstitutes) return PathSet();
PathSet res; PathSet res;
for (auto & sub : getDefaultSubstituters()) { for (auto & sub : getDefaultSubstituters()) {
if (sub->storeDir != storeDir) continue; if (sub->storeDir != storeDir) continue;
@ -799,6 +800,7 @@ PathSet LocalStore::querySubstitutablePaths(const PathSet & paths)
void LocalStore::querySubstitutablePathInfos(const PathSet & paths, void LocalStore::querySubstitutablePathInfos(const PathSet & paths,
SubstitutablePathInfos & infos) SubstitutablePathInfos & infos)
{ {
if (!settings.useSubstitutes) return;
for (auto & sub : getDefaultSubstituters()) { for (auto & sub : getDefaultSubstituters()) {
if (sub->storeDir != storeDir) continue; if (sub->storeDir != storeDir) continue;
for (auto & path : paths) { for (auto & path : paths) {