nix-build: Support talking to old daemons

Fixes #76.
This commit is contained in:
Eelco Dolstra 2012-12-29 23:21:46 +01:00
parent b7629778ef
commit 12f9129f60

View file

@ -441,7 +441,16 @@ void RemoteStore::buildPaths(const PathSet & drvPaths, bool repair)
if (repair) throw Error("repairing is not supported when building through the Nix daemon"); if (repair) throw Error("repairing is not supported when building through the Nix daemon");
openConnection(); openConnection();
writeInt(wopBuildPaths, to); writeInt(wopBuildPaths, to);
if (GET_PROTOCOL_MINOR(daemonVersion) >= 13)
writeStrings(drvPaths, to); writeStrings(drvPaths, to);
else {
/* For backwards compatibility with old daemons, strip output
identifiers. */
PathSet drvPaths2;
foreach (PathSet::const_iterator, i, drvPaths)
drvPaths2.insert(string(*i, 0, i->find('!')));
writeStrings(drvPaths2, to);
}
processStderr(); processStderr();
readInt(from); readInt(from);
} }