diff options
author | regnat <rg@regnat.ovh> | 2020-11-10 14:49:25 +0100 |
---|---|---|
committer | regnat <rg@regnat.ovh> | 2021-05-26 16:59:09 +0200 |
commit | 7ce0441d806d12bb073047337545e3901404996d (patch) | |
tree | 34c2da7138927390153d30a63e8ce7c66395aec3 /src | |
parent | 4077d55775fa3d178c56640d26722dea737ccfcc (diff) |
Add a dependencies field to DrvOutputInfo
Currently never used, nor set but will be useful shortly
Diffstat (limited to 'src')
-rw-r--r-- | src/libstore/realisation.cc | 10 | ||||
-rw-r--r-- | src/libstore/realisation.hh | 2 |
2 files changed, 12 insertions, 0 deletions
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 <DrvOutput> drvOutputDeps; + if (auto jsonDependencies = json.find("drvOutputDeps"); jsonDependencies != json.end()) + for (auto & jsonDep : *jsonDependencies) + drvOutputDeps.insert(DrvOutput::parse(jsonDep.get<std::string>())); + 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<DrvOutput> drvOutputDeps; + nlohmann::json toJSON() const; static Realisation fromJSON(const nlohmann::json& json, const std::string& whence); |