Check LockedInput::computeStorePath()
This commit is contained in:
parent
b9fb372075
commit
b9f93e7386
|
@ -584,6 +584,8 @@ static void prim_callFlake(EvalState & state, const Pos & pos, Value * * args, V
|
||||||
throw Error("the content hash of flake '%s' doesn't match the hash recorded in the referring lockfile",
|
throw Error("the content hash of flake '%s' doesn't match the hash recorded in the referring lockfile",
|
||||||
lazyInput->lockedInput.ref);
|
lazyInput->lockedInput.ref);
|
||||||
|
|
||||||
|
assert(flake.sourceInfo->storePath == lazyInput->lockedInput.computeStorePath(*state.store));
|
||||||
|
|
||||||
callFlake(state, flake, lazyInput->lockedInput, v);
|
callFlake(state, flake, lazyInput->lockedInput, v);
|
||||||
} else {
|
} else {
|
||||||
FlakeCache flakeCache;
|
FlakeCache flakeCache;
|
||||||
|
@ -593,6 +595,8 @@ static void prim_callFlake(EvalState & state, const Pos & pos, Value * * args, V
|
||||||
throw Error("the content hash of repository '%s' doesn't match the hash recorded in the referring lockfile",
|
throw Error("the content hash of repository '%s' doesn't match the hash recorded in the referring lockfile",
|
||||||
lazyInput->lockedInput.ref);
|
lazyInput->lockedInput.ref);
|
||||||
|
|
||||||
|
assert(sourceInfo.storePath == lazyInput->lockedInput.computeStorePath(*state.store));
|
||||||
|
|
||||||
state.mkAttrs(v, 8);
|
state.mkAttrs(v, 8);
|
||||||
|
|
||||||
assert(state.store->isValidPath(sourceInfo.storePath));
|
assert(state.store->isValidPath(sourceInfo.storePath));
|
||||||
|
|
|
@ -25,9 +25,9 @@ nlohmann::json LockedInput::toJson() const
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
Path LockedInput::computeStorePath(Store & store) const
|
StorePath LockedInput::computeStorePath(Store & store) const
|
||||||
{
|
{
|
||||||
return store.printStorePath(store.makeFixedOutputPath(true, narHash, "source"));
|
return store.makeFixedOutputPath(true, narHash, "source");
|
||||||
}
|
}
|
||||||
|
|
||||||
LockedInputs::LockedInputs(const nlohmann::json & json)
|
LockedInputs::LockedInputs(const nlohmann::json & json)
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
class Store;
|
class Store;
|
||||||
|
struct StorePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace nix::flake {
|
namespace nix::flake {
|
||||||
|
@ -53,7 +54,7 @@ struct LockedInput : LockedInputs
|
||||||
|
|
||||||
nlohmann::json toJson() const;
|
nlohmann::json toJson() const;
|
||||||
|
|
||||||
Path computeStorePath(Store & store) const;
|
StorePath computeStorePath(Store & store) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* An entire lock file. Note that this cannot be a FlakeInput for the
|
/* An entire lock file. Note that this cannot be a FlakeInput for the
|
||||||
|
|
Loading…
Reference in a new issue