aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2021-04-23 14:22:03 +0200
committerGitHub <noreply@github.com>2021-04-23 14:22:03 +0200
commit4549d65b4f88168d03e05cd981e3fde9a3ab1b37 (patch)
treed50c04f441bc0ce69668d1ec6f3f15ccab68eaaa /src
parent3996ca42cfe7bd8e215edba98a79a33bd793b42f (diff)
parentd3df747cb6813fc5f9d0fcc63d6fd16292c92e04 (diff)
Merge pull request #4732 from NixOS/4725-always-register-the-realisations
Aways register the realisations
Diffstat (limited to 'src')
-rw-r--r--src/libcmd/installables.cc15
-rw-r--r--src/libstore/build/derivation-goal.cc15
2 files changed, 16 insertions, 14 deletions
diff --git a/src/libcmd/installables.cc b/src/libcmd/installables.cc
index 10855688c..06ef4c669 100644
--- a/src/libcmd/installables.cc
+++ b/src/libcmd/installables.cc
@@ -736,18 +736,9 @@ std::set<RealisedPath> toRealisedPaths(
output.first);
auto outputId = DrvOutput{outputHashes.at(output.first), output.first};
auto realisation = store->queryRealisation(outputId);
- if (!realisation) {
- // TODO: remove this check once #4725 is fixed
- // as we’ll have the guaranty that if
- // `output.second` exists, then the realisation
- // will be there too
- if (output.second)
- res.insert(*output.second);
- else
- throw Error("cannot operate on an output of unbuilt content-addresed derivation '%s'", outputId.to_string());
- } else {
- res.insert(RealisedPath{*realisation});
- }
+ if (!realisation)
+ throw Error("cannot operate on an output of unbuilt content-addresed derivation '%s'", outputId.to_string());
+ res.insert(RealisedPath{*realisation});
}
else {
// If ca-derivations isn't enabled, behave as if
diff --git a/src/libstore/build/derivation-goal.cc b/src/libstore/build/derivation-goal.cc
index 55ced2215..9100d3333 100644
--- a/src/libstore/build/derivation-goal.cc
+++ b/src/libstore/build/derivation-goal.cc
@@ -1269,12 +1269,23 @@ void DerivationGoal::checkPathValidity()
};
}
if (settings.isExperimentalFeatureEnabled("ca-derivations")) {
- if (auto real = worker.store.queryRealisation(
- DrvOutput{initialOutputs.at(i.first).outputHash, i.first})) {
+ auto drvOutput = DrvOutput{initialOutputs.at(i.first).outputHash, i.first};
+ if (auto real = worker.store.queryRealisation(drvOutput)) {
info.known = {
.path = real->outPath,
.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,
+ }
+ );
}
}
}