forked from lix-project/lix
Merge branch 'mh/fix-chroot-eval' of https://github.com/obsidiansystems/nix
This commit is contained in:
commit
c17f3c5e69
|
@ -229,20 +229,21 @@ static void fetch(EvalState & state, const Pos & pos, Value * * args, Value & v,
|
||||||
? fetchers::downloadTarball(state.store, *url, name, (bool) expectedHash).first.storePath
|
? fetchers::downloadTarball(state.store, *url, name, (bool) expectedHash).first.storePath
|
||||||
: fetchers::downloadFile(state.store, *url, name, (bool) expectedHash).storePath;
|
: fetchers::downloadFile(state.store, *url, name, (bool) expectedHash).storePath;
|
||||||
|
|
||||||
auto path = state.store->toRealPath(storePath);
|
auto realPath = state.store->toRealPath(storePath);
|
||||||
|
|
||||||
if (expectedHash) {
|
if (expectedHash) {
|
||||||
auto hash = unpack
|
auto hash = unpack
|
||||||
? state.store->queryPathInfo(storePath)->narHash
|
? state.store->queryPathInfo(storePath)->narHash
|
||||||
: hashFile(htSHA256, path);
|
: hashFile(htSHA256, realPath);
|
||||||
if (hash != *expectedHash)
|
if (hash != *expectedHash)
|
||||||
throw Error((unsigned int) 102, "hash mismatch in file downloaded from '%s':\n specified: %s\n got: %s",
|
throw Error((unsigned int) 102, "hash mismatch in file downloaded from '%s':\n specified: %s\n got: %s",
|
||||||
*url, expectedHash->to_string(Base32, true), hash.to_string(Base32, true));
|
*url, expectedHash->to_string(Base32, true), hash.to_string(Base32, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.allowedPaths)
|
if (state.allowedPaths)
|
||||||
state.allowedPaths->insert(path);
|
state.allowedPaths->insert(realPath);
|
||||||
|
|
||||||
|
auto path = state.store->printStorePath(storePath);
|
||||||
mkString(v, path, PathSet({path}));
|
mkString(v, path, PathSet({path}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,5 @@ PATH1=$(nix path-info --store ./x $CORRECT_PATH)
|
||||||
PATH2=$(nix path-info --store "$PWD/x" $CORRECT_PATH)
|
PATH2=$(nix path-info --store "$PWD/x" $CORRECT_PATH)
|
||||||
[ $CORRECT_PATH == $PATH2 ]
|
[ $CORRECT_PATH == $PATH2 ]
|
||||||
|
|
||||||
# FIXME we could also test the query parameter version:
|
PATH3=$(nix path-info --store "local?root=$PWD/x" $CORRECT_PATH)
|
||||||
# PATH3=$(nix path-info --store "local?store=$PWD/x" $CORRECT_PATH)
|
[ $CORRECT_PATH == $PATH3 ]
|
||||||
# [ $CORRECT_PATH == $PATH3 ]
|
|
||||||
|
|
Loading…
Reference in a new issue