forked from lix-project/lix
Merge pull request #5022 from NixOS/more-lenient-realisation-compatibility-check
Be more lenient when realisations have a conflicting dependency set
This commit is contained in:
commit
2cf21f2829
2 changed files with 14 additions and 6 deletions
|
@ -342,7 +342,7 @@ LocalStore::LocalStore(const Params & params)
|
||||||
if (settings.isExperimentalFeatureEnabled("ca-derivations")) {
|
if (settings.isExperimentalFeatureEnabled("ca-derivations")) {
|
||||||
state->stmts->RegisterRealisedOutput.create(state->db,
|
state->stmts->RegisterRealisedOutput.create(state->db,
|
||||||
R"(
|
R"(
|
||||||
insert or replace into Realisations (drvPath, outputName, outputPath, signatures)
|
insert into Realisations (drvPath, outputName, outputPath, signatures)
|
||||||
values (?, ?, (select id from ValidPaths where path = ?), ?)
|
values (?, ?, (select id from ValidPaths where path = ?), ?)
|
||||||
;
|
;
|
||||||
)");
|
)");
|
||||||
|
@ -379,7 +379,7 @@ LocalStore::LocalStore(const Params & params)
|
||||||
R"(
|
R"(
|
||||||
insert or replace into RealisationsRefs (referrer, realisationReference)
|
insert or replace into RealisationsRefs (referrer, realisationReference)
|
||||||
values (
|
values (
|
||||||
?,
|
(select id from Realisations where drvPath = ? and outputName = ?),
|
||||||
(select id from Realisations where drvPath = ? and outputName = ?));
|
(select id from Realisations where drvPath = ? and outputName = ?));
|
||||||
)");
|
)");
|
||||||
}
|
}
|
||||||
|
@ -748,7 +748,6 @@ void LocalStore::registerDrvOutput(const Realisation & info)
|
||||||
(concatStringsSep(" ", info.signatures))
|
(concatStringsSep(" ", info.signatures))
|
||||||
.exec();
|
.exec();
|
||||||
}
|
}
|
||||||
uint64_t myId = state->db.getLastInsertedRowId();
|
|
||||||
for (auto & [outputId, depPath] : info.dependentRealisations) {
|
for (auto & [outputId, depPath] : info.dependentRealisations) {
|
||||||
auto localRealisation = queryRealisationCore_(*state, outputId);
|
auto localRealisation = queryRealisationCore_(*state, outputId);
|
||||||
if (!localRealisation)
|
if (!localRealisation)
|
||||||
|
@ -761,7 +760,8 @@ void LocalStore::registerDrvOutput(const Realisation & info)
|
||||||
"match what we have locally",
|
"match what we have locally",
|
||||||
info.id.to_string(), outputId.to_string());
|
info.id.to_string(), outputId.to_string());
|
||||||
state->stmts->AddRealisationReference.use()
|
state->stmts->AddRealisationReference.use()
|
||||||
(myId)
|
(info.id.strHash())
|
||||||
|
(info.id.outputName)
|
||||||
(outputId.strHash())
|
(outputId.strHash())
|
||||||
(outputId.outputName)
|
(outputId.outputName)
|
||||||
.exec();
|
.exec();
|
||||||
|
|
|
@ -144,8 +144,16 @@ bool Realisation::isCompatibleWith(const Realisation & other) const
|
||||||
{
|
{
|
||||||
assert (id == other.id);
|
assert (id == other.id);
|
||||||
if (outPath == other.outPath) {
|
if (outPath == other.outPath) {
|
||||||
assert(dependentRealisations == other.dependentRealisations);
|
if (dependentRealisations.empty() != other.dependentRealisations.empty()) {
|
||||||
|
warn(
|
||||||
|
"Encountered a realisation for '%s' with an empty set of "
|
||||||
|
"dependencies. This is likely an artifact from an older Nix. "
|
||||||
|
"I’ll try to fix the realisation if I can",
|
||||||
|
id.to_string());
|
||||||
return true;
|
return true;
|
||||||
|
} else if (dependentRealisations == other.dependentRealisations) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue