From adf61e5cf8571a4c50664361c2d8e3b89266e11e Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <edolstra@gmail.com>
Date: Sat, 15 Feb 2020 14:54:21 +0100
Subject: [PATCH] Fix build

(cherry picked from commit 639c660abfd5de62ecfcd8d3cbc2eb6924c7ec75)
---
 src/hydra-queue-runner/queue-monitor.cc | 7 +++----
 src/hydra-queue-runner/state.hh         | 6 ++++++
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/hydra-queue-runner/queue-monitor.cc b/src/hydra-queue-runner/queue-monitor.cc
index 62de134a..3c02e1aa 100644
--- a/src/hydra-queue-runner/queue-monitor.cc
+++ b/src/hydra-queue-runner/queue-monitor.cc
@@ -102,9 +102,9 @@ bool State::getQueuedBuilds(Connection & conn,
             if (id > newLastBuildId) newLastBuildId = id;
             if (builds_->count(id)) continue;
 
-            auto build = std::make_shared<Build>();
+            auto build = std::make_shared<Build>(
+                localStore->parseStorePath(row["drvPath"].as<string>()));
             build->id = id;
-            build->drvPath = localStore->parseStorePath(row["drvPath"].as<string>());
             build->projectName = row["project"].as<string>();
             build->jobsetName = row["jobset"].as<string>();
             build->jobName = row["job"].as<string>();
@@ -402,8 +402,7 @@ Step::ptr State::createStep(ref<Store> destStore,
 
         /* If it doesn't exist, create it. */
         if (!step) {
-            step = std::make_shared<Step>();
-            step->drvPath = drvPath.clone();
+            step = std::make_shared<Step>(drvPath.clone());
             isNew = true;
         }
 
diff --git a/src/hydra-queue-runner/state.hh b/src/hydra-queue-runner/state.hh
index de74b768..180907e9 100644
--- a/src/hydra-queue-runner/state.hh
+++ b/src/hydra-queue-runner/state.hh
@@ -136,6 +136,9 @@ struct Build
 
     std::atomic_bool finishedInDB{false};
 
+    Build(nix::StorePath && drvPath) : drvPath(std::move(drvPath))
+    { }
+
     std::string fullJobName()
     {
         return projectName + ":" + jobsetName + ":" + jobName;
@@ -201,6 +204,9 @@ struct Step
 
     nix::Sync<State> state;
 
+    Step(nix::StorePath && drvPath) : drvPath(std::move(drvPath))
+    { }
+
     ~Step()
     {
         //printMsg(lvlError, format("destroying step %1%") % drvPath);