mirror of
https://github.com/NixOS/nix
synced 2025-07-07 06:01:48 +02:00
Replace --hashed-mirrors with substituters test
This commit is contained in:
parent
9077b9e6b2
commit
1c148a80fe
2 changed files with 16 additions and 19 deletions
|
@ -5,7 +5,7 @@ clearStore
|
|||
# Test fetching a flat file.
|
||||
hash=$(nix-hash --flat --type sha256 ./fetchurl.sh)
|
||||
|
||||
outPath=$(nix-build '<nix/fetchurl.nix>' --argstr url file://$(pwd)/fetchurl.sh --argstr sha256 $hash --no-out-link --hashed-mirrors '')
|
||||
outPath=$(nix-build '<nix/fetchurl.nix>' --argstr url file://$(pwd)/fetchurl.sh --argstr sha256 $hash --no-out-link)
|
||||
|
||||
cmp $outPath fetchurl.sh
|
||||
|
||||
|
@ -14,7 +14,7 @@ clearStore
|
|||
|
||||
hash=$(nix hash-file --type sha512 --base64 ./fetchurl.sh)
|
||||
|
||||
outPath=$(nix-build '<nix/fetchurl.nix>' --argstr url file://$(pwd)/fetchurl.sh --argstr sha512 $hash --no-out-link --hashed-mirrors '')
|
||||
outPath=$(nix-build '<nix/fetchurl.nix>' --argstr url file://$(pwd)/fetchurl.sh --argstr sha512 $hash --no-out-link)
|
||||
|
||||
cmp $outPath fetchurl.sh
|
||||
|
||||
|
@ -25,26 +25,23 @@ hash=$(nix hash-file ./fetchurl.sh)
|
|||
|
||||
[[ $hash =~ ^sha256- ]]
|
||||
|
||||
outPath=$(nix-build '<nix/fetchurl.nix>' --argstr url file://$(pwd)/fetchurl.sh --argstr hash $hash --no-out-link --hashed-mirrors '')
|
||||
outPath=$(nix-build '<nix/fetchurl.nix>' --argstr url file://$(pwd)/fetchurl.sh --argstr hash $hash --no-out-link)
|
||||
|
||||
cmp $outPath fetchurl.sh
|
||||
|
||||
# Test the hashed mirror feature.
|
||||
# Test that we can substitute from a different store dir.
|
||||
clearStore
|
||||
|
||||
hash=$(nix hash-file --type sha512 --base64 ./fetchurl.sh)
|
||||
hash32=$(nix hash-file --type sha512 --base16 ./fetchurl.sh)
|
||||
other_store=file://$TEST_ROOT/other_store
|
||||
|
||||
mirror=$TEST_ROOT/hashed-mirror
|
||||
rm -rf $mirror
|
||||
mkdir -p $mirror/sha512
|
||||
ln -s $(pwd)/fetchurl.sh $mirror/sha512/$hash32
|
||||
hash=$(nix hash-file --type sha256 --base16 ./fetchurl.sh)
|
||||
storePath=$(nix add-to-store --store $other_store ./fetchurl.sh)
|
||||
|
||||
outPath=$(nix-build '<nix/fetchurl.nix>' --argstr url file:///no-such-dir/fetchurl.sh --argstr sha512 $hash --no-out-link --hashed-mirrors "file://$mirror")
|
||||
outPath=$(nix-build -vvvvvv '<nix/fetchurl.nix>' --argstr url file:///no-such-dir/fetchurl.sh --argstr sha256 $hash --no-out-link --substituters $other_store)
|
||||
|
||||
# Test hashed mirrors with an SRI hash.
|
||||
nix-build '<nix/fetchurl.nix>' --argstr url file:///no-such-dir/fetchurl.sh --argstr hash $(nix to-sri --type sha512 $hash) \
|
||||
--argstr name bla --no-out-link --hashed-mirrors "file://$mirror"
|
||||
--argstr name bla --no-out-link --substituters $other_store
|
||||
|
||||
# Test unpacking a NAR.
|
||||
rm -rf $TEST_ROOT/archive
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue