mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 22:16:16 +02:00
Merge pull request #10825 from tie/output-spec-assert
Fix empty outputsToInstall for InstallableAttrPath
This commit is contained in:
commit
b74a0df645
3 changed files with 16 additions and 0 deletions
|
@ -75,6 +75,8 @@ DerivedPathsWithInfo InstallableAttrPath::toDerivedPaths()
|
||||||
std::set<std::string> outputsToInstall;
|
std::set<std::string> outputsToInstall;
|
||||||
for (auto & output : packageInfo.queryOutputs(false, true))
|
for (auto & output : packageInfo.queryOutputs(false, true))
|
||||||
outputsToInstall.insert(output.first);
|
outputsToInstall.insert(output.first);
|
||||||
|
if (outputsToInstall.empty())
|
||||||
|
outputsToInstall.insert("out");
|
||||||
return OutputsSpec::Names { std::move(outputsToInstall) };
|
return OutputsSpec::Names { std::move(outputsToInstall) };
|
||||||
},
|
},
|
||||||
[&](const ExtendedOutputsSpec::Explicit & e) -> OutputsSpec {
|
[&](const ExtendedOutputsSpec::Explicit & e) -> OutputsSpec {
|
||||||
|
|
|
@ -45,6 +45,14 @@ nix build -f multiple-outputs.nix --json e --no-link | jq --exit-status '
|
||||||
(.outputs | keys == ["a_a", "b"]))
|
(.outputs | keys == ["a_a", "b"]))
|
||||||
'
|
'
|
||||||
|
|
||||||
|
# Tests that we can handle empty 'outputsToInstall' (assuming that default
|
||||||
|
# output "out" exists).
|
||||||
|
nix build -f multiple-outputs.nix --json nothing-to-install --no-link | jq --exit-status '
|
||||||
|
(.[0] |
|
||||||
|
(.drvPath | match(".*nothing-to-install.drv")) and
|
||||||
|
(.outputs | keys == ["out"]))
|
||||||
|
'
|
||||||
|
|
||||||
# But not when it's overriden.
|
# But not when it's overriden.
|
||||||
nix build -f multiple-outputs.nix --json e^a_a --no-link
|
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 '
|
nix build -f multiple-outputs.nix --json e^a_a --no-link | jq --exit-status '
|
||||||
|
|
|
@ -96,6 +96,12 @@ rec {
|
||||||
buildCommand = "mkdir $a_a $b $c";
|
buildCommand = "mkdir $a_a $b $c";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nothing-to-install = mkDerivation {
|
||||||
|
name = "nothing-to-install";
|
||||||
|
meta.outputsToInstall = [ ];
|
||||||
|
buildCommand = "mkdir $out";
|
||||||
|
};
|
||||||
|
|
||||||
independent = mkDerivation {
|
independent = mkDerivation {
|
||||||
name = "multiple-outputs-independent";
|
name = "multiple-outputs-independent";
|
||||||
outputs = [ "first" "second" ];
|
outputs = [ "first" "second" ];
|
||||||
|
|
Loading…
Reference in a new issue