aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-10-20 22:55:00 +0200
committereldritch horrors <pennae@lix.systems>2024-10-23 11:55:12 +0000
commitb8cc54df0a7748e1af5b2f0acbf548c5bcab6f56 (patch)
tree69d3aaa50f44383cc6449c8a82f3325d6b66679e /src
parent67f1aafd610c028b160f2f2ac805e671ed7073de (diff)
libstore: return relevant store path in goal result
we now do not need the goal pointers any more to process worker results. Change-Id: I1a021b862ca666bcd23fee9f38973e90e6f94a72
Diffstat (limited to 'src')
-rw-r--r--src/libstore/build/derivation-goal.cc8
-rw-r--r--src/libstore/build/entry-points.cc6
-rw-r--r--src/libstore/build/goal.hh3
-rw-r--r--src/libstore/build/substitution-goal.cc9
4 files changed, 17 insertions, 9 deletions
diff --git a/src/libstore/build/derivation-goal.cc b/src/libstore/build/derivation-goal.cc
index 5de159b2d..765df5f5a 100644
--- a/src/libstore/build/derivation-goal.cc
+++ b/src/libstore/build/derivation-goal.cc
@@ -127,11 +127,15 @@ Goal::WorkResult DerivationGoal::timedOut(Error && ex)
kj::Promise<Result<Goal::WorkResult>> DerivationGoal::workImpl() noexcept
{
- return (useDerivation ? getDerivation() : haveDerivation()).attach(kj::defer([this] {
+ KJ_DEFER({
act.reset();
actLock.reset();
builderActivities.clear();
- }));
+ });
+
+ BOOST_OUTCOME_CO_TRY(auto result, co_await (useDerivation ? getDerivation() : haveDerivation()));
+ result.storePath = drvPath;
+ co_return result;
}
bool DerivationGoal::addWantedOutputs(const OutputsSpec & outputs)
diff --git a/src/libstore/build/entry-points.cc b/src/libstore/build/entry-points.cc
index 2e91b1778..13112d827 100644
--- a/src/libstore/build/entry-points.cc
+++ b/src/libstore/build/entry-points.cc
@@ -33,10 +33,8 @@ void Store::buildPaths(const std::vector<DerivedPath> & reqs, BuildMode buildMod
ex = result.ex;
}
if (result.exitCode != Goal::ecSuccess) {
- if (auto i2 = dynamic_cast<DerivationGoal *>(i.get()))
- failed.insert(printStorePath(i2->drvPath));
- else if (auto i2 = dynamic_cast<PathSubstitutionGoal *>(i.get()))
- failed.insert(printStorePath(i2->storePath));
+ if (result.storePath)
+ failed.insert(printStorePath(*result.storePath));
}
}
diff --git a/src/libstore/build/goal.hh b/src/libstore/build/goal.hh
index 29540dcd3..5b66a2c08 100644
--- a/src/libstore/build/goal.hh
+++ b/src/libstore/build/goal.hh
@@ -94,6 +94,9 @@ public:
bool timedOut = false;
bool hashMismatch = false;
bool checkMismatch = false;
+ /// Store path this goal relates to. Will be set to drvPath for
+ /// derivations, or the substituted store path for substitions.
+ std::optional<StorePath> storePath = {};
};
protected:
diff --git a/src/libstore/build/substitution-goal.cc b/src/libstore/build/substitution-goal.cc
index e0ca23a86..2d0c594ac 100644
--- a/src/libstore/build/substitution-goal.cc
+++ b/src/libstore/build/substitution-goal.cc
@@ -3,6 +3,7 @@
#include "nar-info.hh"
#include "signals.hh"
#include "finally.hh"
+#include <boost/outcome/try.hpp>
#include <kj/array.h>
#include <kj/vector.h>
@@ -54,7 +55,7 @@ try {
/* If the path already exists we're done. */
if (!repair && worker.store.isValidPath(storePath)) {
- return {done(ecSuccess, BuildResult::AlreadyValid)};
+ co_return done(ecSuccess, BuildResult::AlreadyValid);
}
if (settings.readOnlyMode)
@@ -62,9 +63,11 @@ try {
subs = settings.useSubstitutes ? getDefaultSubstituters() : std::list<ref<Store>>();
- return tryNext();
+ BOOST_OUTCOME_CO_TRY(auto result, co_await tryNext());
+ result.storePath = storePath;
+ co_return result;
} catch (...) {
- return {std::current_exception()};
+ co_return result::failure(std::current_exception());
}