mirror of
https://github.com/NixOS/nix
synced 2025-07-07 01:51:47 +02:00
Merge remote-tracking branch 'origin/master' into overlayfs-store
This commit is contained in:
commit
c0e6466a1e
29 changed files with 191 additions and 97 deletions
|
@ -42,8 +42,10 @@ nix-build -o $RESULT check-refs.nix -A test7
|
|||
nix-build -o $RESULT check-refs.nix -A test10
|
||||
|
||||
if isDaemonNewer 2.12pre20230103; then
|
||||
enableFeatures discard-references
|
||||
restartDaemon
|
||||
if ! isDaemonNewer 2.16.0; then
|
||||
enableFeatures discard-references
|
||||
restartDaemon
|
||||
fi
|
||||
|
||||
# test11 should succeed.
|
||||
test11=$(nix-build -o $RESULT check-refs.nix -A test11)
|
||||
|
|
|
@ -27,6 +27,7 @@ test_file_flake_input () {
|
|||
|
||||
mkdir inputs
|
||||
echo foo > inputs/test_input_file
|
||||
echo '{ outputs = { self }: { }; }' > inputs/flake.nix
|
||||
tar cfa test_input.tar.gz inputs
|
||||
cp test_input.tar.gz test_input_no_ext
|
||||
input_tarball_hash="$(nix hash path test_input.tar.gz)"
|
||||
|
@ -50,6 +51,9 @@ test_file_flake_input () {
|
|||
url = "file+file://$PWD/test_input.tar.gz";
|
||||
flake = false;
|
||||
};
|
||||
inputs.flake_no_ext = {
|
||||
url = "file://$PWD/test_input_no_ext";
|
||||
};
|
||||
outputs = { ... }: {};
|
||||
}
|
||||
EOF
|
||||
|
@ -58,7 +62,7 @@ EOF
|
|||
nix eval --file - <<EOF
|
||||
with (builtins.fromJSON (builtins.readFile ./flake.lock));
|
||||
|
||||
# Url inputs whose extension doesn’t match a known archive format should
|
||||
# Non-flake inputs whose extension doesn’t match a known archive format should
|
||||
# not be unpacked by default
|
||||
assert (nodes.no_ext_default_no_unpack.locked.type == "file");
|
||||
assert (nodes.no_ext_default_no_unpack.locked.unpack or false == false);
|
||||
|
@ -75,8 +79,16 @@ EOF
|
|||
# Explicitely passing the unpack parameter should enforce the desired behavior
|
||||
assert (nodes.no_ext_explicit_unpack.locked.narHash == nodes.tarball_default_unpack.locked.narHash);
|
||||
assert (nodes.tarball_explicit_no_unpack.locked.narHash == nodes.no_ext_default_no_unpack.locked.narHash);
|
||||
|
||||
# Flake inputs should always be tarballs
|
||||
assert (nodes.flake_no_ext.locked.type == "tarball");
|
||||
|
||||
true
|
||||
EOF
|
||||
|
||||
# Test tarball URLs on the command line.
|
||||
[[ $(nix flake metadata --json file://$PWD/test_input_no_ext | jq -r .resolved.type) = tarball ]]
|
||||
|
||||
popd
|
||||
|
||||
[[ -z "${NIX_DAEMON_PACKAGE-}" ]] && return 0
|
||||
|
|
|
@ -22,3 +22,8 @@ echo "$PRECISE_WHY_DEPENDS_OUTPUT" | grepQuiet input-2
|
|||
# But only the “precise” one should refer to `reference-to-input-2`
|
||||
echo "$FAST_WHY_DEPENDS_OUTPUT" | grepQuietInverse reference-to-input-2
|
||||
echo "$PRECISE_WHY_DEPENDS_OUTPUT" | grepQuiet reference-to-input-2
|
||||
|
||||
<<<"$PRECISE_WHY_DEPENDS_OUTPUT" sed -n '2p' | grepQuiet "└───reference-to-input-2 -> "
|
||||
<<<"$PRECISE_WHY_DEPENDS_OUTPUT" sed -n '3p' | grep " →" | grepQuiet "dependencies-input-2"
|
||||
<<<"$PRECISE_WHY_DEPENDS_OUTPUT" sed -n '4p' | grepQuiet " └───input0: …" # in input-2, file input0
|
||||
<<<"$PRECISE_WHY_DEPENDS_OUTPUT" sed -n '5p' | grep " →" | grepQuiet "dependencies-input-0" # is dependencies-input-0 referenced
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue