Always register the realisations of input-addressed drvs

Fix #4725
This commit is contained in:
regnat 2021-04-22 17:55:36 +02:00
parent b1711071d1
commit 9161e02039

View file

@ -1269,12 +1269,23 @@ void DerivationGoal::checkPathValidity()
}; };
} }
if (settings.isExperimentalFeatureEnabled("ca-derivations")) { if (settings.isExperimentalFeatureEnabled("ca-derivations")) {
if (auto real = worker.store.queryRealisation( auto drvOutput = DrvOutput{initialOutputs.at(i.first).outputHash, i.first};
DrvOutput{initialOutputs.at(i.first).outputHash, i.first})) { if (auto real = worker.store.queryRealisation(drvOutput)) {
info.known = { info.known = {
.path = real->outPath, .path = real->outPath,
.status = PathStatus::Valid, .status = PathStatus::Valid,
}; };
} else if (info.known && info.known->status == PathStatus::Valid) {
// We know the output because it' a static output of the
// derivation, and the output path is valid, but we don't have
// its realisation stored (probably because it has been built
// without the `ca-derivations` experimental flag)
worker.store.registerDrvOutput(
Realisation{
drvOutput,
info.known->path,
}
);
} }
} }
} }