mirror of
https://github.com/NixOS/nix
synced 2025-07-07 22:33:57 +02:00
Merge branch 'path-info' into ca-drv-exotic
This commit is contained in:
commit
e68e8e3cee
63 changed files with 2079 additions and 401 deletions
|
@ -42,20 +42,21 @@ nix build -f multiple-outputs.nix --json 'a^*' --no-link | jq --exit-status '
|
|||
nix build -f multiple-outputs.nix --json e --no-link | jq --exit-status '
|
||||
(.[0] |
|
||||
(.drvPath | match(".*multiple-outputs-e.drv")) and
|
||||
(.outputs | keys == ["a", "b"]))
|
||||
(.outputs | keys == ["a_a", "b"]))
|
||||
'
|
||||
|
||||
# But not when it's overriden.
|
||||
nix build -f multiple-outputs.nix --json e^a --no-link | jq --exit-status '
|
||||
nix build -f multiple-outputs.nix --json e^a_a --no-link
|
||||
nix build -f multiple-outputs.nix --json e^a_a --no-link | jq --exit-status '
|
||||
(.[0] |
|
||||
(.drvPath | match(".*multiple-outputs-e.drv")) and
|
||||
(.outputs | keys == ["a"]))
|
||||
(.outputs | keys == ["a_a"]))
|
||||
'
|
||||
|
||||
nix build -f multiple-outputs.nix --json 'e^*' --no-link | jq --exit-status '
|
||||
(.[0] |
|
||||
(.drvPath | match(".*multiple-outputs-e.drv")) and
|
||||
(.outputs | keys == ["a", "b", "c"]))
|
||||
(.outputs | keys == ["a_a", "b", "c"]))
|
||||
'
|
||||
|
||||
# Test building from raw store path to drv not expression.
|
||||
|
@ -88,7 +89,7 @@ nix build "$drv^first,second" --no-link --json | jq --exit-status '
|
|||
(.outputs |
|
||||
(keys | length == 2) and
|
||||
(.first | match(".*multiple-outputs-a-first")) and
|
||||
(.second | match(".*multiple-outputs-a-second"))))
|
||||
(.second | match(".*multiple-outputs-a-second"))))
|
||||
'
|
||||
|
||||
nix build "$drv^*" --no-link --json | jq --exit-status '
|
||||
|
@ -97,14 +98,14 @@ nix build "$drv^*" --no-link --json | jq --exit-status '
|
|||
(.outputs |
|
||||
(keys | length == 2) and
|
||||
(.first | match(".*multiple-outputs-a-first")) and
|
||||
(.second | match(".*multiple-outputs-a-second"))))
|
||||
(.second | match(".*multiple-outputs-a-second"))))
|
||||
'
|
||||
|
||||
# Make sure that `--impure` works (regression test for https://github.com/NixOS/nix/issues/6488)
|
||||
nix build --impure -f multiple-outputs.nix --json e --no-link | jq --exit-status '
|
||||
(.[0] |
|
||||
(.drvPath | match(".*multiple-outputs-e.drv")) and
|
||||
(.outputs | keys == ["a", "b"]))
|
||||
(.outputs | keys == ["a_a", "b"]))
|
||||
'
|
||||
|
||||
testNormalization () {
|
||||
|
|
|
@ -1 +1 @@
|
|||
true
|
||||
[ true true true true true true ]
|
||||
|
|
|
@ -18,7 +18,24 @@ let
|
|||
};
|
||||
};
|
||||
|
||||
legit-context = builtins.getContext "${path}${drv.outPath}${drv.foo.outPath}${drv.drvPath}";
|
||||
combo-path = "${path}${drv.outPath}${drv.foo.outPath}${drv.drvPath}";
|
||||
legit-context = builtins.getContext combo-path;
|
||||
|
||||
constructed-context = builtins.getContext (builtins.appendContext "" desired-context);
|
||||
in legit-context == constructed-context
|
||||
reconstructed-path = builtins.appendContext
|
||||
(builtins.unsafeDiscardStringContext combo-path)
|
||||
desired-context;
|
||||
|
||||
# Eta rule for strings with context.
|
||||
etaRule = str:
|
||||
str == builtins.appendContext
|
||||
(builtins.unsafeDiscardStringContext str)
|
||||
(builtins.getContext str);
|
||||
|
||||
in [
|
||||
(legit-context == desired-context)
|
||||
(reconstructed-path == combo-path)
|
||||
(etaRule "foo")
|
||||
(etaRule drv.drvPath)
|
||||
(etaRule drv.foo.outPath)
|
||||
(etaRule (builtins.unsafeDiscardOutputDependency drv.drvPath))
|
||||
]
|
||||
|
|
|
@ -1 +1 @@
|
|||
{ bar = "regular"; foo = "directory"; }
|
||||
{ bar = "regular"; foo = "directory"; ldir = "symlink"; linked = "symlink"; }
|
||||
|
|
1
tests/lang/eval-okay-readFileType.exp
Normal file
1
tests/lang/eval-okay-readFileType.exp
Normal file
|
@ -0,0 +1 @@
|
|||
{ bar = "regular"; foo = "directory"; ldir = "symlink"; linked = "symlink"; }
|
6
tests/lang/eval-okay-readFileType.nix
Normal file
6
tests/lang/eval-okay-readFileType.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
bar = builtins.readFileType ./readDir/bar;
|
||||
foo = builtins.readFileType ./readDir/foo;
|
||||
linked = builtins.readFileType ./readDir/linked;
|
||||
ldir = builtins.readFileType ./readDir/ldir;
|
||||
}
|
1
tests/lang/readDir/ldir
Symbolic link
1
tests/lang/readDir/ldir
Symbolic link
|
@ -0,0 +1 @@
|
|||
foo
|
1
tests/lang/readDir/linked
Symbolic link
1
tests/lang/readDir/linked
Symbolic link
|
@ -0,0 +1 @@
|
|||
foo/git-hates-directories
|
|
@ -91,9 +91,9 @@ rec {
|
|||
|
||||
e = mkDerivation {
|
||||
name = "multiple-outputs-e";
|
||||
outputs = [ "a" "b" "c" ];
|
||||
meta.outputsToInstall = [ "a" "b" ];
|
||||
buildCommand = "mkdir $a $b $c";
|
||||
outputs = [ "a_a" "b" "c" ];
|
||||
meta.outputsToInstall = [ "a_a" "b" ];
|
||||
buildCommand = "mkdir $a_a $b $c";
|
||||
};
|
||||
|
||||
independent = mkDerivation {
|
||||
|
@ -117,4 +117,14 @@ rec {
|
|||
'';
|
||||
};
|
||||
|
||||
invalid-output-name-1 = mkDerivation {
|
||||
name = "invalid-output-name-1";
|
||||
outputs = [ "out/"];
|
||||
};
|
||||
|
||||
invalid-output-name-2 = mkDerivation {
|
||||
name = "invalid-output-name-2";
|
||||
outputs = [ "x" "foo$"];
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -83,3 +83,6 @@ nix-store --gc --keep-derivations --keep-outputs
|
|||
nix-store --gc --print-roots
|
||||
rm -rf $NIX_STORE_DIR/.links
|
||||
rmdir $NIX_STORE_DIR
|
||||
|
||||
nix build -f multiple-outputs.nix invalid-output-name-1 2>&1 | grep 'contains illegal character'
|
||||
nix build -f multiple-outputs.nix invalid-output-name-2 2>&1 | grep 'contains illegal character'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue