From 5adbb0aabe54479304453bf5e544f84b40ee7dd7 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 4 Aug 2008 13:15:35 +0000 Subject: * build.cc: only use a substituter if it returns info for a path. --- src/libstore/local-store.cc | 58 +++++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 26 deletions(-) (limited to 'src/libstore/local-store.cc') diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index 141c7a85297f..ccf1a51bc5b2 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -541,38 +541,44 @@ bool LocalStore::hasSubstitutes(const Path & path) } -bool LocalStore::querySubstitutablePathInfo(const Path & path, - SubstitutablePathInfo & info) +bool LocalStore::querySubstitutablePathInfo(const Path & substituter, + const Path & path, SubstitutablePathInfo & info) { - foreach (Paths::iterator, i, substituters) { - RunningSubstituter & run(runningSubstituters[*i]); - startSubstituter(*i, run); + RunningSubstituter & run(runningSubstituters[substituter]); + startSubstituter(substituter, run); - *run.to << "info\n" << path << "\n" << std::flush; + *run.to << "info\n" << path << "\n" << std::flush; + + string s; - string s; + int res; + getline(*run.from, s); + if (!string2Int(s, res)) abort(); - int res; - getline(*run.from, s); - if (!string2Int(s, res)) abort(); - - if (res) { - getline(*run.from, info.deriver); - int nrRefs; - getline(*run.from, s); - if (!string2Int(s, nrRefs)) abort(); - while (nrRefs--) { - Path p; getline(*run.from, p); - info.references.insert(p); - } - getline(*run.from, s); - long long size; - if (!string2Int(s, size)) abort(); - info.downloadSize = size; - return true; - } + if (!res) return false; + + getline(*run.from, info.deriver); + int nrRefs; + getline(*run.from, s); + if (!string2Int(s, nrRefs)) abort(); + while (nrRefs--) { + Path p; getline(*run.from, p); + info.references.insert(p); } + getline(*run.from, s); + long long size; + if (!string2Int(s, size)) abort(); + info.downloadSize = size; + return true; +} + + +bool LocalStore::querySubstitutablePathInfo(const Path & path, + SubstitutablePathInfo & info) +{ + foreach (Paths::iterator, i, substituters) + if (querySubstitutablePathInfo(*i, path, info)) return true; return false; } -- cgit 1.4.1