forked from lix-project/lix
Merge remote-tracking branch 'origin/deduplicate-static-hashes-computation'
This commit is contained in:
commit
73daffb81b
|
@ -123,17 +123,7 @@ DerivationGoal::DerivationGoal(const StorePath & drvPath, const BasicDerivation
|
||||||
, wantedOutputs(wantedOutputs)
|
, wantedOutputs(wantedOutputs)
|
||||||
, buildMode(buildMode)
|
, buildMode(buildMode)
|
||||||
{
|
{
|
||||||
this->drv = std::make_unique<BasicDerivation>(BasicDerivation(drv));
|
this->drv = std::make_unique<Derivation>(drv);
|
||||||
|
|
||||||
auto outputHashes = staticOutputHashes(worker.store, drv);
|
|
||||||
for (auto &[outputName, outputHash] : outputHashes)
|
|
||||||
initialOutputs.insert({
|
|
||||||
outputName,
|
|
||||||
InitialOutput{
|
|
||||||
.wanted = true, // Will be refined later
|
|
||||||
.outputHash = outputHash
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
state = &DerivationGoal::haveDerivation;
|
state = &DerivationGoal::haveDerivation;
|
||||||
name = fmt(
|
name = fmt(
|
||||||
|
@ -271,18 +261,8 @@ void DerivationGoal::loadDerivation()
|
||||||
|
|
||||||
auto fullDrv = new Derivation(worker.store.derivationFromPath(drvPath));
|
auto fullDrv = new Derivation(worker.store.derivationFromPath(drvPath));
|
||||||
|
|
||||||
auto outputHashes = staticOutputHashes(worker.store, *fullDrv);
|
|
||||||
for (auto &[outputName, outputHash] : outputHashes)
|
|
||||||
initialOutputs.insert({
|
|
||||||
outputName,
|
|
||||||
InitialOutput{
|
|
||||||
.wanted = true, // Will be refined later
|
|
||||||
.outputHash = outputHash
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
/* Get the derivation. */
|
/* Get the derivation. */
|
||||||
drv = std::unique_ptr<BasicDerivation>(fullDrv);
|
drv = std::unique_ptr<Derivation>(fullDrv);
|
||||||
|
|
||||||
haveDerivation();
|
haveDerivation();
|
||||||
}
|
}
|
||||||
|
@ -301,6 +281,16 @@ void DerivationGoal::haveDerivation()
|
||||||
if (i.second.second)
|
if (i.second.second)
|
||||||
worker.store.addTempRoot(*i.second.second);
|
worker.store.addTempRoot(*i.second.second);
|
||||||
|
|
||||||
|
auto outputHashes = staticOutputHashes(worker.store, *drv);
|
||||||
|
for (auto &[outputName, outputHash] : outputHashes)
|
||||||
|
initialOutputs.insert({
|
||||||
|
outputName,
|
||||||
|
InitialOutput{
|
||||||
|
.wanted = true, // Will be refined later
|
||||||
|
.outputHash = outputHash
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
/* Check what outputs paths are not already valid. */
|
/* Check what outputs paths are not already valid. */
|
||||||
checkPathValidity();
|
checkPathValidity();
|
||||||
bool allValid = true;
|
bool allValid = true;
|
||||||
|
@ -3517,10 +3507,9 @@ void DerivationGoal::registerOutputs()
|
||||||
but it's fine to do in all cases. */
|
but it's fine to do in all cases. */
|
||||||
|
|
||||||
if (settings.isExperimentalFeatureEnabled("ca-derivations")) {
|
if (settings.isExperimentalFeatureEnabled("ca-derivations")) {
|
||||||
auto outputHashes = staticOutputHashes(worker.store, *drv);
|
|
||||||
for (auto& [outputName, newInfo] : infos)
|
for (auto& [outputName, newInfo] : infos)
|
||||||
worker.store.registerDrvOutput(Realisation{
|
worker.store.registerDrvOutput(Realisation{
|
||||||
.id = DrvOutput{outputHashes.at(outputName), outputName},
|
.id = DrvOutput{initialOutputs.at(outputName).outputHash, outputName},
|
||||||
.outPath = newInfo.path});
|
.outPath = newInfo.path});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ struct DerivationGoal : public Goal
|
||||||
bool retrySubstitution;
|
bool retrySubstitution;
|
||||||
|
|
||||||
/* The derivation stored at drvPath. */
|
/* The derivation stored at drvPath. */
|
||||||
std::unique_ptr<BasicDerivation> drv;
|
std::unique_ptr<Derivation> drv;
|
||||||
|
|
||||||
std::unique_ptr<ParsedDerivation> parsedDrv;
|
std::unique_ptr<ParsedDerivation> parsedDrv;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue