1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-27 12:41:00 +01:00

DummyStore build trace holds UnkeyedRealisation by value

Otherwise the equality instance we need to add will be messed up.
This commit is contained in:
John Ericson 2025-11-24 15:03:46 -05:00
parent f78e88c973
commit b0c016ae7d
3 changed files with 5 additions and 6 deletions

View file

@ -27,7 +27,7 @@ TEST(DummyStore, realisation_read)
.outPath = StorePath{"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo.drv"}, .outPath = StorePath{"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo.drv"},
}; };
store->buildTrace.insert({drvHash, {{outputName, make_ref<UnkeyedRealisation>(value)}}}); store->buildTrace.insert({drvHash, {{outputName, value}}});
auto value2 = store->queryRealisation({drvHash, outputName}); auto value2 = store->queryRealisation({drvHash, outputName});

View file

@ -320,9 +320,8 @@ struct DummyStoreImpl : DummyStore
void registerDrvOutput(const Realisation & output) override void registerDrvOutput(const Realisation & output) override
{ {
auto ref = make_ref<UnkeyedRealisation>(output); buildTrace.insert_or_visit({output.id.drvHash, {{output.id.outputName, output}}}, [&](auto & kv) {
buildTrace.insert_or_visit({output.id.drvHash, {{output.id.outputName, ref}}}, [&](auto & kv) { kv.second.insert_or_assign(output.id.outputName, output);
kv.second.insert_or_assign(output.id.outputName, make_ref<UnkeyedRealisation>(output));
}); });
} }
@ -333,7 +332,7 @@ struct DummyStoreImpl : DummyStore
buildTrace.cvisit(drvOutput.drvHash, [&](const auto & kv) { buildTrace.cvisit(drvOutput.drvHash, [&](const auto & kv) {
if (auto it = kv.second.find(drvOutput.outputName); it != kv.second.end()) { if (auto it = kv.second.find(drvOutput.outputName); it != kv.second.end()) {
visited = true; visited = true;
callback(it->second.get_ptr()); callback(std::make_shared<UnkeyedRealisation>(it->second));
} }
}); });

View file

@ -47,7 +47,7 @@ struct DummyStore : virtual Store
* outer map for the derivation, and inner maps for the outputs of a * outer map for the derivation, and inner maps for the outputs of a
* given derivation. * given derivation.
*/ */
boost::concurrent_flat_map<Hash, std::map<std::string, ref<UnkeyedRealisation>>> buildTrace; boost::concurrent_flat_map<Hash, std::map<std::string, UnkeyedRealisation>> buildTrace;
DummyStore(ref<const Config> config) DummyStore(ref<const Config> config)
: Store{*config} : Store{*config}