mirror of
https://github.com/NixOS/nix
synced 2025-07-07 01:51:47 +02:00
Eliminate the substituter mechanism
Substitution is now simply a Store -> Store copy operation, most typically from BinaryCacheStore to LocalStore.
This commit is contained in:
parent
21e9d183cc
commit
aa3bc3d5dc
16 changed files with 166 additions and 597 deletions
|
@ -1,20 +0,0 @@
|
|||
source common.sh
|
||||
|
||||
clearStore
|
||||
|
||||
drvPath=$(nix-instantiate simple.nix)
|
||||
echo "derivation is $drvPath"
|
||||
|
||||
outPath=$(nix-store -q --fallback "$drvPath")
|
||||
echo "output path is $outPath"
|
||||
|
||||
# Build with a substitute that fails. This should fail.
|
||||
export NIX_SUBSTITUTERS=$(pwd)/substituter2.sh
|
||||
if nix-store -r "$drvPath"; then echo unexpected fallback; exit 1; fi
|
||||
|
||||
# Build with a substitute that fails. This should fall back to a source build.
|
||||
export NIX_SUBSTITUTERS=$(pwd)/substituter2.sh
|
||||
nix-store -r --fallback "$drvPath"
|
||||
|
||||
text=$(cat "$outPath"/hello)
|
||||
if test "$text" != "Hello World!"; then exit 1; fi
|
|
@ -3,8 +3,7 @@ check:
|
|||
|
||||
nix_tests = \
|
||||
init.sh hash.sh lang.sh add.sh simple.sh dependencies.sh \
|
||||
build-hook.sh substitutes.sh substitutes2.sh \
|
||||
fallback.sh nix-push.sh gc.sh gc-concurrent.sh \
|
||||
build-hook.sh nix-push.sh gc.sh gc-concurrent.sh \
|
||||
referrers.sh user-envs.sh logging.sh nix-build.sh misc.sh fixed.sh \
|
||||
gc-runtime.sh install-package.sh check-refs.sh filter-source.sh \
|
||||
remote-store.sh export.sh export-graph.sh \
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
#! /bin/sh -e
|
||||
echo
|
||||
echo substituter args: $* >&2
|
||||
|
||||
if test $1 = "--query"; then
|
||||
while read cmd args; do
|
||||
echo "CMD = $cmd, ARGS = $args" >&2
|
||||
if test "$cmd" = "have"; then
|
||||
for path in $args; do
|
||||
read path
|
||||
if grep -q "$path" $TEST_ROOT/sub-paths; then
|
||||
echo $path
|
||||
fi
|
||||
done
|
||||
echo
|
||||
elif test "$cmd" = "info"; then
|
||||
for path in $args; do
|
||||
echo $path
|
||||
echo "" # deriver
|
||||
echo 0 # nr of refs
|
||||
echo $((1 * 1024 * 1024)) # download size
|
||||
echo $((2 * 1024 * 1024)) # nar size
|
||||
done
|
||||
echo
|
||||
else
|
||||
echo "bad command $cmd"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
elif test $1 = "--substitute"; then
|
||||
mkdir $2
|
||||
echo "Hallo Wereld" > $2/hello
|
||||
echo # no expected hash
|
||||
else
|
||||
echo "unknown substituter operation"
|
||||
exit 1
|
||||
fi
|
|
@ -1,33 +0,0 @@
|
|||
#! /bin/sh -e
|
||||
echo
|
||||
echo substituter2 args: $* >&2
|
||||
|
||||
if test $1 = "--query"; then
|
||||
while read cmd args; do
|
||||
if test "$cmd" = have; then
|
||||
for path in $args; do
|
||||
if grep -q "$path" $TEST_ROOT/sub-paths; then
|
||||
echo $path
|
||||
fi
|
||||
done
|
||||
echo
|
||||
elif test "$cmd" = info; then
|
||||
for path in $args; do
|
||||
echo $path
|
||||
echo "" # deriver
|
||||
echo 0 # nr of refs
|
||||
echo 0 # download size
|
||||
echo 0 # nar size
|
||||
done
|
||||
echo
|
||||
else
|
||||
echo "bad command $cmd"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
elif test $1 = "--substitute"; then
|
||||
exit 1
|
||||
else
|
||||
echo "unknown substituter operation"
|
||||
exit 1
|
||||
fi
|
|
@ -1,22 +0,0 @@
|
|||
source common.sh
|
||||
|
||||
clearStore
|
||||
|
||||
# Instantiate.
|
||||
drvPath=$(nix-instantiate simple.nix)
|
||||
echo "derivation is $drvPath"
|
||||
|
||||
# Find the output path.
|
||||
outPath=$(nix-store -qvv "$drvPath")
|
||||
echo "output path is $outPath"
|
||||
|
||||
echo $outPath > $TEST_ROOT/sub-paths
|
||||
|
||||
export NIX_SUBSTITUTERS=$(pwd)/substituter.sh
|
||||
|
||||
nix-store -r "$drvPath" --dry-run 2>&1 | grep -q "1.00 MiB.*2.00 MiB"
|
||||
|
||||
nix-store -rvv "$drvPath"
|
||||
|
||||
text=$(cat "$outPath"/hello)
|
||||
if test "$text" != "Hallo Wereld"; then echo "wrong substitute output: $text"; exit 1; fi
|
|
@ -1,21 +0,0 @@
|
|||
source common.sh
|
||||
|
||||
clearStore
|
||||
|
||||
# Instantiate.
|
||||
drvPath=$(nix-instantiate simple.nix)
|
||||
echo "derivation is $drvPath"
|
||||
|
||||
# Find the output path.
|
||||
outPath=$(nix-store -qvvvvv "$drvPath")
|
||||
echo "output path is $outPath"
|
||||
|
||||
echo $outPath > $TEST_ROOT/sub-paths
|
||||
|
||||
# First try a substituter that fails, then one that succeeds
|
||||
export NIX_SUBSTITUTERS=$(pwd)/substituter2.sh:$(pwd)/substituter.sh
|
||||
|
||||
nix-store -j0 -rvv "$drvPath"
|
||||
|
||||
text=$(cat "$outPath"/hello)
|
||||
if test "$text" != "Hallo Wereld"; then echo "wrong substitute output: $text"; exit 1; fi
|
Loading…
Add table
Add a link
Reference in a new issue