From aaa0e128c1e85885ff55f6abd3a3115ab4b194be Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sat, 9 Dec 2023 11:58:09 -0500 Subject: [PATCH 1/4] flake.lock: Update Nix master MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'nix': 'github:NixOS/nix/c3827ff6348a4d5199eaddf8dbc2ca2e2ef46ec5' (2023-12-07) → 'github:NixOS/nix/c8458bd731eb1c74159bebe459ea00165e056b65' (2023-12-09) --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index ae4f60eb..424ed3b0 100644 --- a/flake.lock +++ b/flake.lock @@ -59,11 +59,11 @@ "nixpkgs-regression": "nixpkgs-regression" }, "locked": { - "lastModified": 1701948782, - "narHash": "sha256-rEu4hLHZIy3fgf88BpiaVfl79hNSESRfQNbmxAO5uzg=", + "lastModified": 1702090558, + "narHash": "sha256-JzuGOltp5Ht9flroZ7g0erD5ud2okNQChw9YlxWDX3c=", "owner": "NixOS", "repo": "nix", - "rev": "c3827ff6348a4d5199eaddf8dbc2ca2e2ef46ec5", + "rev": "c8458bd731eb1c74159bebe459ea00165e056b65", "type": "github" }, "original": { From 3f932a6731cfd40919258d0731aad235b77e470c Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 7 Dec 2023 14:10:28 -0500 Subject: [PATCH 2/4] build-remote: Use `std::map` It is less denormalized --- src/hydra-queue-runner/build-remote.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/hydra-queue-runner/build-remote.cc b/src/hydra-queue-runner/build-remote.cc index 05bfdb66..62d321bb 100644 --- a/src/hydra-queue-runner/build-remote.cc +++ b/src/hydra-queue-runner/build-remote.cc @@ -154,7 +154,7 @@ static void copyClosureTo( // FIXME: use Store::topoSortPaths(). -static StorePaths reverseTopoSortPaths(const std::map & paths) +static StorePaths reverseTopoSortPaths(const std::map & paths) { StorePaths sorted; StorePathSet visited; @@ -322,7 +322,7 @@ static BuildResult performBuild( return result; } -static std::map queryPathInfos( +static std::map queryPathInfos( Machine::Connection & conn, Store & localStore, StorePathSet & outputs, @@ -331,7 +331,7 @@ static std::map queryPathInfos( { /* Get info about each output path. */ - std::map infos; + std::map infos; conn.to << ServeProto::Command::QueryPathInfos; ServeProto::write(localStore, conn, outputs); conn.to.flush(); @@ -395,14 +395,16 @@ static void copyPathsFromRemote( NarMemberDatas & narMembers, Store & localStore, Store & destStore, - const std::map & infos + const std::map & infos ) { auto pathsSorted = reverseTopoSortPaths(infos); for (auto & path : pathsSorted) { auto & info = infos.find(path)->second; - copyPathFromRemote(conn, narMembers, localStore, destStore, info); + copyPathFromRemote( + conn, narMembers, localStore, destStore, + ValidPathInfo { path, info }); } } From d0d3b0a2986915ab7aa96d3fce8371a5012c9021 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 7 Dec 2023 14:13:06 -0500 Subject: [PATCH 3/4] Use `ServeProto::Serialise` for `QueryValidPaths` Companion to already-merged https://github.com/NixOS/nix/pull/9560 --- src/hydra-queue-runner/build-remote.cc | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/src/hydra-queue-runner/build-remote.cc b/src/hydra-queue-runner/build-remote.cc index 62d321bb..5818727b 100644 --- a/src/hydra-queue-runner/build-remote.cc +++ b/src/hydra-queue-runner/build-remote.cc @@ -338,23 +338,10 @@ static std::map queryPathInfos( while (true) { auto storePathS = readString(conn.from); if (storePathS == "") break; - auto deriver = readString(conn.from); // deriver - auto references = ServeProto::Serialise::read(localStore, conn); - readLongLong(conn.from); // download size - auto narSize = readLongLong(conn.from); - auto narHash = Hash::parseAny(readString(conn.from), HashAlgorithm::SHA256); - auto ca = ContentAddress::parseOpt(readString(conn.from)); - readStrings(conn.from); // sigs - ValidPathInfo info(localStore.parseStorePath(storePathS), narHash); - assert(outputs.count(info.path)); - info.references = references; - info.narSize = narSize; - totalNarSize += info.narSize; - info.narHash = narHash; - info.ca = ca; - if (deriver != "") - info.deriver = localStore.parseStorePath(deriver); - infos.insert_or_assign(info.path, info); + + auto storePath = localStore.parseStorePath(storePathS); + auto info = ServeProto::Serialise::read(localStore, conn); + infos.insert_or_assign(storePath, info); } return infos; From f6f817926a5ee98af4251a4244d01f5ba1f31695 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sat, 9 Dec 2023 12:11:04 -0500 Subject: [PATCH 4/4] `std::move` the into the path info map --- src/hydra-queue-runner/build-remote.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hydra-queue-runner/build-remote.cc b/src/hydra-queue-runner/build-remote.cc index 5818727b..a8047182 100644 --- a/src/hydra-queue-runner/build-remote.cc +++ b/src/hydra-queue-runner/build-remote.cc @@ -341,7 +341,7 @@ static std::map queryPathInfos( auto storePath = localStore.parseStorePath(storePathS); auto info = ServeProto::Serialise::read(localStore, conn); - infos.insert_or_assign(storePath, info); + infos.insert_or_assign(std::move(storePath), std::move(info)); } return infos;