mirror of
https://github.com/NixOS/nix.git
synced 2025-11-09 03:56:01 +01:00
Update dummy store JSON format to include derivations
This commit is contained in:
parent
f446cb290c
commit
acd9dbfc55
5 changed files with 41 additions and 0 deletions
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"build-trace": {},
|
||||
"contents": {},
|
||||
"derivations": {},
|
||||
"store-dir": "/nix/store"
|
||||
}
|
||||
|
|
|
|||
18
src/libstore-tests/data/dummy-store/one-derivation.json
Normal file
18
src/libstore-tests/data/dummy-store/one-derivation.json
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"build-trace": {},
|
||||
"contents": {},
|
||||
"derivations": {
|
||||
"rlqjbbb65ggcx9hy577hvnn929wz1aj0-foo.drv": {
|
||||
"args": [],
|
||||
"builder": "",
|
||||
"env": {},
|
||||
"inputDrvs": {},
|
||||
"inputSrcs": [],
|
||||
"name": "foo",
|
||||
"outputs": {},
|
||||
"system": "",
|
||||
"version": 4
|
||||
}
|
||||
},
|
||||
"store-dir": "/nix/store"
|
||||
}
|
||||
|
|
@ -30,5 +30,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"derivations": {},
|
||||
"store-dir": "/nix/store"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,6 +115,16 @@ INSTANTIATE_TEST_SUITE_P(DummyStoreJSON, DummyStoreJsonTest, [] {
|
|||
HashAlgorithm::SHA256);
|
||||
return store;
|
||||
}(),
|
||||
},
|
||||
std::pair{
|
||||
"one-derivation",
|
||||
[&] {
|
||||
auto store = writeCfg->openDummyStore();
|
||||
Derivation drv;
|
||||
drv.name = "foo";
|
||||
store->writeDerivation(drv);
|
||||
return store;
|
||||
}(),
|
||||
});
|
||||
}());
|
||||
|
||||
|
|
|
|||
|
|
@ -422,6 +422,8 @@ ref<DummyStore> adl_serializer<ref<DummyStore>>::from_json(const json & json)
|
|||
}();
|
||||
for (auto & [k, v] : getObject(valueAt(obj, "contents")))
|
||||
res->contents.insert({StorePath{k}, v});
|
||||
for (auto & [k, v] : getObject(valueAt(obj, "derivations")))
|
||||
res->derivations.insert({StorePath{k}, v});
|
||||
for (auto & [k0, v] : getObject(valueAt(obj, "build-trace"))) {
|
||||
for (auto & [k1, v2] : getObject(v)) {
|
||||
auto vref = make_ref<UnkeyedRealisation>(v2);
|
||||
|
|
@ -449,6 +451,15 @@ void adl_serializer<ref<DummyStore>>::to_json(json & json, const ref<DummyStore>
|
|||
});
|
||||
return obj;
|
||||
}()},
|
||||
{"derivations",
|
||||
[&] {
|
||||
auto obj = json::object();
|
||||
val->derivations.cvisit_all([&](const auto & kv) {
|
||||
auto & [k, v] = kv;
|
||||
obj[k.to_string()] = v;
|
||||
});
|
||||
return obj;
|
||||
}()},
|
||||
{"build-trace",
|
||||
[&] {
|
||||
auto obj = json::object();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue