forked from lix-project/lix
Fix bug, test more, document more
This commit is contained in:
parent
f3262bc216
commit
8735f55dec
|
@ -97,8 +97,12 @@ DerivedPath::Built DerivedPath::Built::parse(const Store & store, std::string_vi
|
||||||
{
|
{
|
||||||
auto drvPath = store.parseStorePath(drvS);
|
auto drvPath = store.parseStorePath(drvS);
|
||||||
std::set<std::string> outputs;
|
std::set<std::string> outputs;
|
||||||
if (outputsS != "*")
|
if (outputsS != "*") {
|
||||||
outputs = tokenizeString<std::set<std::string>>(outputsS, ",");
|
outputs = tokenizeString<std::set<std::string>>(outputsS, ",");
|
||||||
|
if (outputs.empty())
|
||||||
|
throw Error(
|
||||||
|
"Explicit list of wanted outputs '%s' must not be empty. Consider using '*' as a wildcard meaning all outputs if no output in particular is wanted.", outputsS);
|
||||||
|
}
|
||||||
return {drvPath, outputs};
|
return {drvPath, outputs};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,8 +134,9 @@ the Nix store. Here are the recognised types of installables:
|
||||||
|
|
||||||
*(Experimental, part of by the `computed-derivations` experimental feature.)*
|
*(Experimental, part of by the `computed-derivations` experimental feature.)*
|
||||||
|
|
||||||
Store derivations can be indexed with a specific output name. This
|
Store derivations can be indexed with a non-empty comma-separated list
|
||||||
allows finer control versus just specifying a derivation (without
|
of specific output names, or `*` meaning all ouptuts. This allows
|
||||||
|
finer control versus just specifying a derivation (without
|
||||||
`--derivation`) and getting all the outputs.
|
`--derivation`) and getting all the outputs.
|
||||||
|
|
||||||
This is especially useful for (currently unstable) floating content
|
This is especially useful for (currently unstable) floating content
|
||||||
|
|
|
@ -1,14 +1,24 @@
|
||||||
source common.sh
|
source common.sh
|
||||||
|
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
enableFeatures "computed-derivations"
|
enableFeatures "computed-derivations"
|
||||||
restartDaemon
|
restartDaemon
|
||||||
|
|
||||||
drv=$(nix eval -f multiple-outputs.nix --raw a.drvPath)
|
drv=$(nix eval -f multiple-outputs.nix --raw a.drvPath)
|
||||||
if nix build "$drv^not-an-output" --json; then
|
if nix build "$drv^not-an-output" --no-link --json; then
|
||||||
fail "'not-an-output' should fail to build"
|
fail "'not-an-output' should fail to build"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
nix build "$drv^first" --json | jq --exit-status '
|
if nix build "$drv^" --no-link --json; then
|
||||||
|
fail "'empty outputs list' should fail to build"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if nix build "$drv^*nope" --no-link --json; then
|
||||||
|
fail "'* must be entire string' should fail to build"
|
||||||
|
fi
|
||||||
|
|
||||||
|
nix build "$drv^first" --no-link --json | jq --exit-status '
|
||||||
(.[0] |
|
(.[0] |
|
||||||
(.drvPath | match(".*multiple-outputs-a.drv")) and
|
(.drvPath | match(".*multiple-outputs-a.drv")) and
|
||||||
(.outputs |
|
(.outputs |
|
||||||
|
@ -16,3 +26,21 @@ nix build "$drv^first" --json | jq --exit-status '
|
||||||
(.first | match(".*multiple-outputs-a-first")) and
|
(.first | match(".*multiple-outputs-a-first")) and
|
||||||
(has("second") | not)))
|
(has("second") | not)))
|
||||||
'
|
'
|
||||||
|
|
||||||
|
nix build "$drv^first,second" --no-link --json | jq --exit-status '
|
||||||
|
(.[0] |
|
||||||
|
(.drvPath | match(".*multiple-outputs-a.drv")) and
|
||||||
|
(.outputs |
|
||||||
|
(keys | length == 2) and
|
||||||
|
(.first | match(".*multiple-outputs-a-first")) and
|
||||||
|
(.second | match(".*multiple-outputs-a-second"))))
|
||||||
|
'
|
||||||
|
|
||||||
|
nix build "$drv^*" --no-link --json | jq --exit-status '
|
||||||
|
(.[0] |
|
||||||
|
(.drvPath | match(".*multiple-outputs-a.drv")) and
|
||||||
|
(.outputs |
|
||||||
|
(keys | length == 2) and
|
||||||
|
(.first | match(".*multiple-outputs-a-first")) and
|
||||||
|
(.second | match(".*multiple-outputs-a-second"))))
|
||||||
|
'
|
||||||
|
|
Loading…
Reference in a new issue