From 278a3ebfd5297a976400f93afb1e54c6d1915cca Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 15 May 2025 00:24:25 -0400 Subject: [PATCH] Fix build with Nix 2.29 --- src/hydra-queue-runner/build-remote.cc | 2 +- src/hydra-queue-runner/hydra-queue-runner.cc | 4 ++-- src/hydra-queue-runner/queue-monitor.cc | 10 ++++++++-- src/hydra-queue-runner/state.hh | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/hydra-queue-runner/build-remote.cc b/src/hydra-queue-runner/build-remote.cc index 7e307c75..b372e7dd 100644 --- a/src/hydra-queue-runner/build-remote.cc +++ b/src/hydra-queue-runner/build-remote.cc @@ -50,7 +50,7 @@ static std::unique_ptr openConnection( auto remoteStore = machine->storeUri.params.find("remote-store"); if (remoteStore != machine->storeUri.params.end()) { command.push_back("--store"); - command.push_back(shellEscape(remoteStore->second)); + command.push_back(escapeShellArgAlways(remoteStore->second)); } } diff --git a/src/hydra-queue-runner/hydra-queue-runner.cc b/src/hydra-queue-runner/hydra-queue-runner.cc index ab146312..a4a7f0a7 100644 --- a/src/hydra-queue-runner/hydra-queue-runner.cc +++ b/src/hydra-queue-runner/hydra-queue-runner.cc @@ -14,7 +14,7 @@ #include #include "state.hh" #include "hydra-build-result.hh" -#include +#include #include #include @@ -832,7 +832,7 @@ void State::run(BuildID buildOne) << metricsAddr << "/metrics (port " << exposerPort << ")" << std::endl; - Store::Params localParams; + Store::Config::Params localParams; localParams["max-connections"] = "16"; localParams["max-connection-age"] = "600"; localStore = openStore(getEnv("NIX_REMOTE").value_or(""), localParams); diff --git a/src/hydra-queue-runner/queue-monitor.cc b/src/hydra-queue-runner/queue-monitor.cc index bb15ac04..0785be6f 100644 --- a/src/hydra-queue-runner/queue-monitor.cc +++ b/src/hydra-queue-runner/queue-monitor.cc @@ -492,8 +492,14 @@ Step::ptr State::createStep(ref destStore, runnable while step->created == false. */ step->drv = std::make_unique(localStore->readDerivation(drvPath)); { - auto parsedDrv = ParsedDerivation{drvPath, *step->drv}; - step->drvOptions = std::make_unique(DerivationOptions::fromParsedDerivation(parsedDrv)); + auto parsedOpt = StructuredAttrs::tryParse(step->drv->env); + try { + step->drvOptions = std::make_unique( + DerivationOptions::fromStructuredAttrs(step->drv->env, parsedOpt ? &*parsedOpt : nullptr)); + } catch (Error & e) { + e.addTrace({}, "while parsing derivation '%s'", localStore->printStorePath(drvPath)); + throw; + } } step->preferLocalBuild = step->drvOptions->willBuildLocally(*localStore, *step->drv); diff --git a/src/hydra-queue-runner/state.hh b/src/hydra-queue-runner/state.hh index edfad4fb..f7ab7de3 100644 --- a/src/hydra-queue-runner/state.hh +++ b/src/hydra-queue-runner/state.hh @@ -172,7 +172,7 @@ struct Step nix::StorePath drvPath; std::unique_ptr drv; std::unique_ptr drvOptions; - std::set requiredSystemFeatures; + nix::StringSet requiredSystemFeatures; bool preferLocalBuild; bool isDeterministic; std::string systemType; // concatenation of drv.platform and requiredSystemFeatures