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
This commit is contained in:
parent
67f1aafd61
commit
b8cc54df0a
|
@ -127,11 +127,15 @@ Goal::WorkResult DerivationGoal::timedOut(Error && ex)
|
||||||
|
|
||||||
kj::Promise<Result<Goal::WorkResult>> DerivationGoal::workImpl() noexcept
|
kj::Promise<Result<Goal::WorkResult>> DerivationGoal::workImpl() noexcept
|
||||||
{
|
{
|
||||||
return (useDerivation ? getDerivation() : haveDerivation()).attach(kj::defer([this] {
|
KJ_DEFER({
|
||||||
act.reset();
|
act.reset();
|
||||||
actLock.reset();
|
actLock.reset();
|
||||||
builderActivities.clear();
|
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)
|
bool DerivationGoal::addWantedOutputs(const OutputsSpec & outputs)
|
||||||
|
|
|
@ -33,10 +33,8 @@ void Store::buildPaths(const std::vector<DerivedPath> & reqs, BuildMode buildMod
|
||||||
ex = result.ex;
|
ex = result.ex;
|
||||||
}
|
}
|
||||||
if (result.exitCode != Goal::ecSuccess) {
|
if (result.exitCode != Goal::ecSuccess) {
|
||||||
if (auto i2 = dynamic_cast<DerivationGoal *>(i.get()))
|
if (result.storePath)
|
||||||
failed.insert(printStorePath(i2->drvPath));
|
failed.insert(printStorePath(*result.storePath));
|
||||||
else if (auto i2 = dynamic_cast<PathSubstitutionGoal *>(i.get()))
|
|
||||||
failed.insert(printStorePath(i2->storePath));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,6 +94,9 @@ public:
|
||||||
bool timedOut = false;
|
bool timedOut = false;
|
||||||
bool hashMismatch = false;
|
bool hashMismatch = false;
|
||||||
bool checkMismatch = 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:
|
protected:
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "nar-info.hh"
|
#include "nar-info.hh"
|
||||||
#include "signals.hh"
|
#include "signals.hh"
|
||||||
#include "finally.hh"
|
#include "finally.hh"
|
||||||
|
#include <boost/outcome/try.hpp>
|
||||||
#include <kj/array.h>
|
#include <kj/array.h>
|
||||||
#include <kj/vector.h>
|
#include <kj/vector.h>
|
||||||
|
|
||||||
|
@ -54,7 +55,7 @@ try {
|
||||||
|
|
||||||
/* If the path already exists we're done. */
|
/* If the path already exists we're done. */
|
||||||
if (!repair && worker.store.isValidPath(storePath)) {
|
if (!repair && worker.store.isValidPath(storePath)) {
|
||||||
return {done(ecSuccess, BuildResult::AlreadyValid)};
|
co_return done(ecSuccess, BuildResult::AlreadyValid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings.readOnlyMode)
|
if (settings.readOnlyMode)
|
||||||
|
@ -62,9 +63,11 @@ try {
|
||||||
|
|
||||||
subs = settings.useSubstitutes ? getDefaultSubstituters() : std::list<ref<Store>>();
|
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 (...) {
|
} catch (...) {
|
||||||
return {std::current_exception()};
|
co_return result::failure(std::current_exception());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue