* querySubstitutablePathInfo: work properly when run via the daemon.

* --dry-run: print the paths that we don't know how to build/substitute.
This commit is contained in:
Eelco Dolstra 2008-08-04 11:44:50 +00:00
parent b3c26180e3
commit 03427e76f1
7 changed files with 49 additions and 16 deletions

View file

@ -46,7 +46,7 @@ Path findOutput(const Derivation & drv, string id)
void queryMissing(const PathSet & targets,
PathSet & willBuild, PathSet & willSubstitute)
PathSet & willBuild, PathSet & willSubstitute, PathSet & unknown)
{
PathSet todo(targets.begin(), targets.end()), done;
@ -57,7 +57,10 @@ void queryMissing(const PathSet & targets,
done.insert(p);
if (isDerivation(p)) {
if (!store->isValidPath(p)) continue;
if (!store->isValidPath(p)) {
unknown.insert(p);
continue;
}
Derivation drv = derivationFromPath(p);
bool mustBuild = false;
@ -81,12 +84,11 @@ void queryMissing(const PathSet & targets,
else {
if (store->isValidPath(p)) continue;
SubstitutablePathInfo info;
if (dynamic_cast<LocalStore *>(store.get())->querySubstitutablePathInfo(p, info)) {
if (store->querySubstitutablePathInfo(p, info)) {
willSubstitute.insert(p);
todo.insert(info.references.begin(), info.references.end());
}
/* Not substitutable and not buildable; should we flag
this? */
} else
unknown.insert(p);
}
}
}

View file

@ -29,7 +29,7 @@ Path findOutput(const Derivation & drv, string id);
derivations that will be built, and the set of output paths that
will be substituted. */
void queryMissing(const PathSet & targets,
PathSet & willBuild, PathSet & willSubstitute);
PathSet & willBuild, PathSet & willSubstitute, PathSet & unknown);
}

View file

@ -216,7 +216,16 @@ bool RemoteStore::hasSubstitutes(const Path & path)
bool RemoteStore::querySubstitutablePathInfo(const Path & path,
SubstitutablePathInfo & info)
{
throw Error("not implemented");
writeInt(wopQuerySubstitutablePathInfo, to);
writeString(path, to);
processStderr();
unsigned int reply = readInt(from);
if (reply == 0) return false;
info.deriver = readString(from);
if (info.deriver != "") assertStorePath(info.deriver);
info.references = readStorePaths(from);
info.downloadSize = readLongLong(from);
return true;
}

View file

@ -33,6 +33,7 @@ typedef enum {
wopQueryDeriver = 18,
wopSetOptions = 19,
wopCollectGarbage = 20,
wopQuerySubstitutablePathInfo = 21,
} WorkerOp;