From 7ce0441d806d12bb073047337545e3901404996d Mon Sep 17 00:00:00 2001 From: regnat Date: Tue, 10 Nov 2020 14:49:25 +0100 Subject: Add a dependencies field to DrvOutputInfo Currently never used, nor set but will be useful shortly --- src/libstore/realisation.cc | 10 ++++++++++ src/libstore/realisation.hh | 2 ++ 2 files changed, 12 insertions(+) (limited to 'src') diff --git a/src/libstore/realisation.cc b/src/libstore/realisation.cc index 638065547..27ad6c150 100644 --- a/src/libstore/realisation.cc +++ b/src/libstore/realisation.cc @@ -22,10 +22,14 @@ std::string DrvOutput::to_string() const { } nlohmann::json Realisation::toJSON() const { + nlohmann::json jsonDrvOutputDeps; + for (auto & dep : drvOutputDeps) + jsonDrvOutputDeps.push_back(dep.to_string()); return nlohmann::json{ {"id", id.to_string()}, {"outPath", outPath.to_string()}, {"signatures", signatures}, + {"drvOutputDeps", jsonDrvOutputDeps}, }; } @@ -51,10 +55,16 @@ Realisation Realisation::fromJSON( if (auto signaturesIterator = json.find("signatures"); signaturesIterator != json.end()) signatures.insert(signaturesIterator->begin(), signaturesIterator->end()); + std::set drvOutputDeps; + if (auto jsonDependencies = json.find("drvOutputDeps"); jsonDependencies != json.end()) + for (auto & jsonDep : *jsonDependencies) + drvOutputDeps.insert(DrvOutput::parse(jsonDep.get())); + return Realisation{ .id = DrvOutput::parse(getField("id")), .outPath = StorePath(getField("outPath")), .signatures = signatures, + .drvOutputDeps = drvOutputDeps, }; } diff --git a/src/libstore/realisation.hh b/src/libstore/realisation.hh index f5049c9e9..1e2808ce3 100644 --- a/src/libstore/realisation.hh +++ b/src/libstore/realisation.hh @@ -28,6 +28,8 @@ struct Realisation { StringSet signatures; + std::set drvOutputDeps; + nlohmann::json toJSON() const; static Realisation fromJSON(const nlohmann::json& json, const std::string& whence); -- cgit v1.2.3