forked from lix-project/lix
Check hash
This commit is contained in:
parent
45b5c606ac
commit
1c5067b9a7
|
@ -409,8 +409,6 @@ static void emitSourceInfoAttrs(EvalState & state, const SourceInfo & sourceInfo
|
||||||
{
|
{
|
||||||
auto & path = sourceInfo.storePath;
|
auto & path = sourceInfo.storePath;
|
||||||
assert(state.store->isValidPath(path));
|
assert(state.store->isValidPath(path));
|
||||||
// FIXME: turn into fetchGit etc.
|
|
||||||
// FIXME: check narHash.
|
|
||||||
mkString(*state.allocAttr(vAttrs, state.sOutPath), path, {path});
|
mkString(*state.allocAttr(vAttrs, state.sOutPath), path, {path});
|
||||||
|
|
||||||
if (sourceInfo.resolvedRef.rev) {
|
if (sourceInfo.resolvedRef.rev) {
|
||||||
|
@ -436,6 +434,10 @@ static void prim_callFlake(EvalState & state, const Pos & pos, Value * * args, V
|
||||||
{
|
{
|
||||||
auto lazyFlake = (FlakeInput *) args[0]->attrs;
|
auto lazyFlake = (FlakeInput *) args[0]->attrs;
|
||||||
auto flake = getFlake(state, lazyFlake->ref, false);
|
auto flake = getFlake(state, lazyFlake->ref, false);
|
||||||
|
|
||||||
|
if (flake.sourceInfo.narHash != lazyFlake->narHash)
|
||||||
|
throw Error("the content hash of flake '%s' doesn't match the hash recorded in the referring lockfile", flake.sourceInfo.resolvedRef);
|
||||||
|
|
||||||
callFlake(state, flake, *lazyFlake, v);
|
callFlake(state, flake, *lazyFlake, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -106,5 +106,7 @@ struct LockFile : FlakeInputs
|
||||||
void write(const Path & path) const;
|
void write(const Path & path) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
std::ostream & operator <<(std::ostream & stream, const LockFile & lockFile);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue