build-remote: Don't copy the .drv closure

Since build-remote uses buildDerivation() now, we don't need to copy
the .drv file anymore. This greatly reduces the set of input paths
copied to the remote side (e.g. from 392 to 51 store paths for GNU
hello on x86_64-darwin).
This commit is contained in:
Eelco Dolstra 2017-05-01 15:00:39 +02:00
parent b986c7f8b1
commit ca9f589a93
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
2 changed files with 8 additions and 16 deletions

View file

@ -269,8 +269,11 @@ connected:
copyPaths(store, ref<Store>(sshStore), inputs); copyPaths(store, ref<Store>(sshStore), inputs);
uploadLock = -1; uploadLock = -1;
printError("building %s on %s", drvPath, hostName); BasicDerivation drv(readDerivation(drvPath));
sshStore->buildDerivation(drvPath, readDerivation(drvPath)); drv.inputSrcs = inputs;
printError("building %s on %s", drvPath, storeUri);
sshStore->buildDerivation(drvPath, drv);
PathSet missing; PathSet missing;
for (auto & path : outputs) for (auto & path : outputs)

View file

@ -1622,23 +1622,12 @@ HookReply DerivationGoal::tryBuildHook()
hook = std::move(worker.hook); hook = std::move(worker.hook);
/* Tell the hook all the inputs that have to be copied to the /* Tell the hook all the inputs that have to be copied to the
remote system. This unfortunately has to contain the entire remote system. */
derivation closure to ensure that the validity invariant holds writeLine(hook->toHook.writeSide.get(), concatStringsSep(" ", inputPaths));
on the remote system. (I.e., it's unfortunate that we have to
list it since the remote system *probably* already has it.) */
PathSet allInputs;
allInputs.insert(inputPaths.begin(), inputPaths.end());
worker.store.computeFSClosure(drvPath, allInputs);
string s;
for (auto & i : allInputs) { s += i; s += ' '; }
writeLine(hook->toHook.writeSide.get(), s);
/* Tell the hooks the missing outputs that have to be copied back /* Tell the hooks the missing outputs that have to be copied back
from the remote system. */ from the remote system. */
s = ""; writeLine(hook->toHook.writeSide.get(), concatStringsSep(" ", missingPaths));
for (auto & i : missingPaths) { s += i; s += ' '; }
writeLine(hook->toHook.writeSide.get(), s);
hook->toHook.writeSide = -1; hook->toHook.writeSide = -1;