mirror of
https://github.com/NixOS/nix.git
synced 2025-11-09 03:56:01 +01:00
DerivationGoal Make some fields immutable
We can set both during construction, yay!
This commit is contained in:
parent
f155dffe59
commit
4a2de1dbab
2 changed files with 11 additions and 9 deletions
|
|
@ -33,7 +33,13 @@ DerivationGoal::DerivationGoal(
|
||||||
: Goal(worker, haveDerivation())
|
: Goal(worker, haveDerivation())
|
||||||
, drvPath(drvPath)
|
, drvPath(drvPath)
|
||||||
, wantedOutput(wantedOutput)
|
, wantedOutput(wantedOutput)
|
||||||
, outputHash{Hash::dummy} // will be updated
|
, outputHash{[&] {
|
||||||
|
if (auto * mOutputHash = get(staticOutputHashes(worker.evalStore, drv), wantedOutput))
|
||||||
|
return *mOutputHash;
|
||||||
|
else
|
||||||
|
throw Error(
|
||||||
|
"derivation '%s' does not have output '%s'", worker.store.printStorePath(drvPath), wantedOutput);
|
||||||
|
}()}
|
||||||
, buildMode(buildMode)
|
, buildMode(buildMode)
|
||||||
{
|
{
|
||||||
this->drv = std::make_unique<Derivation>(drv);
|
this->drv = std::make_unique<Derivation>(drv);
|
||||||
|
|
@ -79,10 +85,6 @@ Goal::Co DerivationGoal::haveDerivation()
|
||||||
if (i.second.second)
|
if (i.second.second)
|
||||||
worker.store.addTempRoot(*i.second.second);
|
worker.store.addTempRoot(*i.second.second);
|
||||||
|
|
||||||
if (auto * mOutputHash = get(staticOutputHashes(worker.evalStore, *drv), wantedOutput)) {
|
|
||||||
outputHash = *mOutputHash;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* We don't yet have any safe way to cache an impure derivation at
|
/* We don't yet have any safe way to cache an impure derivation at
|
||||||
this step. */
|
this step. */
|
||||||
if (drv->type().isImpure()) {
|
if (drv->type().isImpure()) {
|
||||||
|
|
|
||||||
|
|
@ -70,14 +70,14 @@ private:
|
||||||
*/
|
*/
|
||||||
std::unique_ptr<Derivation> drv;
|
std::unique_ptr<Derivation> drv;
|
||||||
|
|
||||||
|
const Hash outputHash;
|
||||||
|
|
||||||
|
const BuildMode buildMode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The remainder is state held during the build.
|
* The remainder is state held during the build.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Hash outputHash;
|
|
||||||
|
|
||||||
BuildMode buildMode;
|
|
||||||
|
|
||||||
std::unique_ptr<MaintainCount<uint64_t>> mcExpectedBuilds;
|
std::unique_ptr<MaintainCount<uint64_t>> mcExpectedBuilds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue