Update to Nix 2.19

Flake lock file updates:

• Updated input 'nix':
    'github:NixOS/nix/f5f4de6a550327b4b1a06123c2e450f1b92c73b6' (2023-10-02)
  → 'github:NixOS/nix/50f8f1c8bc019a4c0fd098b9ac674b94cfc6af0d' (2023-11-27)
This commit is contained in:
John Ericson
2023-11-30 14:38:26 -05:00
parent e9da80fff6
commit c922e73c11
11 changed files with 61 additions and 34 deletions

View File

@ -9,9 +9,11 @@
#include "path.hh"
#include "serve-protocol.hh"
#include "state.hh"
#include "current-process.hh"
#include "processes.hh"
#include "util.hh"
#include "worker-protocol.hh"
#include "worker-protocol-impl.hh"
#include "serve-protocol.hh"
#include "serve-protocol-impl.hh"
#include "finally.hh"
#include "url.hh"
@ -106,26 +108,32 @@ static void openConnection(Machine::ptr machine, Path tmpDir, int stderrFD, Chil
static void copyClosureTo(std::timed_mutex & sendMutex, Store & destStore,
FdSource & from, FdSink & to, const StorePathSet & paths,
FdSource & from, FdSink & to, ServeProto::Version remoteVersion, const StorePathSet & paths,
bool useSubstitutes = false)
{
StorePathSet closure;
destStore.computeFSClosure(paths, closure);
WorkerProto::WriteConn wconn { .to = to };
WorkerProto::ReadConn rconn { .from = from };
ServeProto::WriteConn wconn {
.to = to,
.version = remoteVersion,
};
ServeProto::ReadConn rconn {
.from = from,
.version = remoteVersion,
};
/* Send the "query valid paths" command with the "lock" option
enabled. This prevents a race where the remote host
garbage-collect paths that are already there. Optionally, ask
the remote host to substitute missing paths. */
// FIXME: substitute output pollutes our build log
to << ServeProto::Command::QueryValidPaths << 1 << useSubstitutes;
WorkerProto::write(destStore, wconn, closure);
ServeProto::write(destStore, wconn, closure);
to.flush();
/* Get back the set of paths that are already valid on the remote
host. */
auto present = WorkerProto::Serialise<StorePathSet>::read(destStore, rconn);
auto present = ServeProto::Serialise<StorePathSet>::read(destStore, rconn);
if (present.size() == closure.size()) return;
@ -227,9 +235,7 @@ void State::buildRemote(ref<Store> destStore,
});
FdSource from(child.from.get());
WorkerProto::ReadConn rconn { .from = from };
FdSink to(child.to.get());
WorkerProto::WriteConn wconn { .to = to };
Finally updateStats([&]() {
bytesReceived += from.read;
@ -237,7 +243,7 @@ void State::buildRemote(ref<Store> destStore,
});
/* Handshake. */
unsigned int remoteVersion;
ServeProto::Version remoteVersion;
try {
to << SERVE_MAGIC_1 << 0x206;
@ -258,6 +264,15 @@ void State::buildRemote(ref<Store> destStore,
throw Error("cannot connect to %1%: %2%", machine->sshName, s);
}
ServeProto::ReadConn rconn {
.from = from,
.version = remoteVersion,
};
ServeProto::WriteConn wconn {
.to = to,
.version = remoteVersion,
};
{
auto info(machine->state->connectInfo.lock());
info->consecutiveFailures = 0;
@ -313,7 +328,7 @@ void State::buildRemote(ref<Store> destStore,
destStore->computeFSClosure(inputs, closure);
copyPaths(*destStore, *localStore, closure, NoRepair, NoCheckSigs, NoSubstitute);
} else {
copyClosureTo(machine->state->sendLock, *destStore, from, to, inputs, true);
copyClosureTo(machine->state->sendLock, *destStore, from, to, remoteVersion, inputs, true);
}
auto now2 = std::chrono::steady_clock::now();
@ -373,7 +388,7 @@ void State::buildRemote(ref<Store> destStore,
}
}
if (GET_PROTOCOL_MINOR(remoteVersion) >= 6) {
WorkerProto::Serialise<DrvOutputs>::read(*localStore, rconn);
ServeProto::Serialise<DrvOutputs>::read(*localStore, rconn);
}
switch ((BuildResult::Status) res) {
case BuildResult::Built:
@ -450,13 +465,13 @@ void State::buildRemote(ref<Store> destStore,
std::map<StorePath, ValidPathInfo> infos;
size_t totalNarSize = 0;
to << ServeProto::Command::QueryPathInfos;
WorkerProto::write(*localStore, wconn, outputs);
ServeProto::write(*localStore, wconn, outputs);
to.flush();
while (true) {
auto storePathS = readString(from);
if (storePathS == "") break;
auto deriver = readString(from); // deriver
auto references = WorkerProto::Serialise<StorePathSet>::read(*localStore, rconn);
auto references = ServeProto::Serialise<StorePathSet>::read(*localStore, rconn);
readLongLong(from); // download size
auto narSize = readLongLong(from);
auto narHash = Hash::parseAny(readString(from), htSHA256);