From 290e0653ad0121b80e53dfc0a5f9eed7540049ff Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Sun, 20 Feb 2022 12:15:10 -0500 Subject: [PATCH] hydra-eval-jobs: GC root aggregate jobs --- src/hydra-eval-jobs/hydra-eval-jobs.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/hydra-eval-jobs/hydra-eval-jobs.cc b/src/hydra-eval-jobs/hydra-eval-jobs.cc index acffe1d1..897956bf 100644 --- a/src/hydra-eval-jobs/hydra-eval-jobs.cc +++ b/src/hydra-eval-jobs/hydra-eval-jobs.cc @@ -504,6 +504,16 @@ int main(int argc, char * * argv) job.erase("namedConstituents"); + /* Register the derivation as a GC root. !!! This + registers roots for jobs that we may have already + done. */ + auto localStore = store.dynamic_pointer_cast(); + if (gcRootsDir != "" && localStore) { + Path root = gcRootsDir + "/" + std::string(baseNameOf((std::string) job["drvPath"])); + if (!pathExists(root)) + localStore->addPermRoot(localStore->parseStorePath((std::string) job["drvPath"]), root); + } + if (!brokenJobs.empty()) { std::stringstream ss; for (const auto& [jobName, error] : brokenJobs) {