1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 06:31:14 +02:00

Don't require --fallback to recover from disappeared binary cache NARs

This commit is contained in:
Eelco Dolstra 2018-06-05 16:04:41 +02:00
parent 691b7582c7
commit 4ac4f675df
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
4 changed files with 41 additions and 17 deletions

View file

@ -76,19 +76,28 @@ if nix-store --substituters "file://$cacheDir" -r $outPath; then
fi
# Test whether fallback works if we have cached info but the
# corresponding NAR has disappeared.
# Test whether fallback works if a NAR has disappeared. This does not require --fallback.
clearStore
nix-build --substituters "file://$cacheDir" dependencies.nix --dry-run # get info
mkdir $cacheDir/tmp
mv $cacheDir/nar $cacheDir/nar2
nix-build --substituters "file://$cacheDir" --no-require-sigs dependencies.nix -o $TEST_ROOT/result
mv $cacheDir/nar2 $cacheDir/nar
# Test whether fallback works if a NAR is corrupted. This does require --fallback.
clearStore
mv $cacheDir/nar $cacheDir/nar2
mkdir $cacheDir/nar
for i in $(cd $cacheDir/nar2 && echo *); do touch $cacheDir/nar/$i; done
(! nix-build --substituters "file://$cacheDir" --no-require-sigs dependencies.nix -o $TEST_ROOT/result)
nix-build --substituters "file://$cacheDir" --no-require-sigs dependencies.nix -o $TEST_ROOT/result --fallback
rm -rf $cacheDir/nar
mv $cacheDir/nar2 $cacheDir/nar