diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2017-07-17T11·13+0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2017-07-17T11·13+0200 |
commit | bf6792c0df2163a0501beb14feeb5135c4aa71c2 (patch) | |
tree | 2e10250c084d65ec8d5da88a6381ee95e24c22bb /tests | |
parent | 49304bae812f2c5334f304a4ea6a4e06360b33da (diff) |
Always use base-16 for hashed mirror lookups
In particular, don't use base-64, which we don't support. (We do have base-32 redirects for hysterical reasons.) Also, add a test for the hashed mirror feature.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/fetchurl.sh | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/fetchurl.sh b/tests/fetchurl.sh index 02b83525bb30..7f2de907049a 100644 --- a/tests/fetchurl.sh +++ b/tests/fetchurl.sh @@ -18,6 +18,19 @@ outPath=$(nix-build '<nix/fetchurl.nix>' --argstr url file://$(pwd)/fetchurl.sh cmp $outPath fetchurl.sh +# Test the hashed mirror feature. +clearStore + +hash=$(nix hash-file --type sha512 --base64 ./fetchurl.sh) +hash32=$(nix hash-file --type sha512 --base16 ./fetchurl.sh) + +mirror=$TMPDIR/hashed-mirror +rm -rf $mirror +mkdir -p $mirror/sha512 +ln -s $(pwd)/fetchurl.sh $mirror/sha512/$hash32 + +outPath=$(nix-build '<nix/fetchurl.nix>' --argstr url file:///no-such-dir/fetchurl.sh --argstr sha512 $hash --no-out-link --option hashed-mirrors "file://$mirror") + # Test unpacking a NAR. rm -rf $TEST_ROOT/archive mkdir -p $TEST_ROOT/archive |