mirror of
https://github.com/NixOS/nix
synced 2025-07-08 19:23:54 +02:00
Merge pull request #11051 from Mic92/fix-prefetch
src/nix/prefetch: fix prefetch containing current directory instead o…
This commit is contained in:
commit
d5461b9009
2 changed files with 18 additions and 5 deletions
|
@ -54,6 +54,18 @@ test_tarball() {
|
|||
# with the content-addressing
|
||||
(! nix-instantiate --eval -E "fetchTree { type = \"tarball\"; url = file://$tarball; narHash = \"$hash\"; name = \"foo\"; }")
|
||||
|
||||
store_path=$(nix store prefetch-file --json "file://$tarball" | jq -r .storePath)
|
||||
if ! cmp -s "$store_path" "$tarball"; then
|
||||
echo "prefetched tarball differs from original: $store_path vs $tarball" >&2
|
||||
exit 1
|
||||
fi
|
||||
store_path2=$(nix store prefetch-file --json --unpack "file://$tarball" | jq -r .storePath)
|
||||
diff_output=$(diff -r "$store_path2" "$tarroot")
|
||||
if [ -n "$diff_output" ]; then
|
||||
echo "prefetched tarball differs from original: $store_path2 vs $tarroot" >&2
|
||||
echo "$diff_output"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
test_tarball '' cat
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue