Merge pull request #141789 from pennae/eval-opt

lib: make extendDerivation lighter on eval
This commit is contained in:
Silvan Mosberger 2021-10-21 20:17:32 +02:00 committed by GitHub
commit 98f82e9c35
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 40 additions and 41 deletions

View file

@ -487,7 +487,7 @@ rec {
=> "/nix/store/9rz8gxhzf8sw4kf2j2f1grr49w8zx5vj-openssl-1.0.1r-dev"
*/
getOutput = output: pkg:
if pkg.outputUnspecified or false
if ! pkg ? outputSpecified || ! pkg.outputSpecified
then pkg.${output} or pkg.out or pkg
else pkg;

View file

@ -145,14 +145,14 @@ rec {
let
outputs = drv.outputs or [ "out" ];
commonAttrs = (removeAttrs drv [ "outputUnspecified" ]) //
(builtins.listToAttrs outputsList) //
commonAttrs = drv // (builtins.listToAttrs outputsList) //
({ all = map (x: x.value) outputsList; }) // passthru;
outputToAttrListElement = outputName:
{ name = outputName;
value = commonAttrs // {
inherit (drv.${outputName}) type outputName;
outputSpecified = true;
drvPath = assert condition; drv.${outputName}.drvPath;
outPath = assert condition; drv.${outputName}.outPath;
};
@ -160,7 +160,6 @@ rec {
outputsList = map outputToAttrListElement outputs;
in commonAttrs // {
outputUnspecified = true;
drvPath = assert condition; drv.drvPath;
outPath = assert condition; drv.outPath;
};

View file

@ -62,7 +62,7 @@ runCommand name
# and otherwise use `meta.outputsToInstall`. The attribute is guaranteed
# to exist in mkDerivation-created cases. The other cases (e.g. runCommand)
# aren't expected to have multiple outputs.
(if drv.outputUnspecified or false
(if (! drv ? outputSpecified || ! drv.outputSpecified)
&& drv.meta.outputsToInstall or null != null
then map (outName: drv.${outName}) drv.meta.outputsToInstall
else [ drv ])

View file

@ -63,14 +63,14 @@ let
};
# `llvm` historically had the binaries. When choosing an output explicitly,
# we need to reintroduce `outputUnspecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputUnspecified = true; };
# we need to reintroduce `outputSpecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputSpecified = false; };
libclang = callPackage ./clang {
inherit clang-tools-extra_src llvm_meta;
};
clang-unwrapped = tools.libclang.out // { outputUnspecified = true; };
clang-unwrapped = tools.libclang.out // { outputSpecified = false; };
# disabled until recommonmark supports sphinx 3
#Llvm-manpages = lowPrio (tools.libllvm.override {

View file

@ -65,21 +65,21 @@ let
};
# `llvm` historically had the binaries. When choosing an output explicitly,
# we need to reintroduce `outputUnspecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputUnspecified = true; };
# we need to reintroduce `outputSpecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputSpecified = false; };
libllvm-polly = callPackage ./llvm {
inherit llvm_meta;
enablePolly = true;
};
llvm-polly = tools.libllvm-polly.lib // { outputUnspecified = true; };
llvm-polly = tools.libllvm-polly.lib // { outputSpecified = false; };
libclang = callPackage ./clang {
inherit clang-tools-extra_src llvm_meta;
};
clang-unwrapped = tools.libclang.out // { outputUnspecified = true; };
clang-unwrapped = tools.libclang.out // { outputSpecified = false; };
clang-polly-unwrapped = callPackage ./clang {
inherit llvm_meta;

View file

@ -66,14 +66,14 @@ let
};
# `llvm` historically had the binaries. When choosing an output explicitly,
# we need to reintroduce `outputUnspecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputUnspecified = true; };
# we need to reintroduce `outputSpecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputSpecified = false; };
libclang = callPackage ./clang {
inherit clang-tools-extra_src llvm_meta;
};
clang-unwrapped = tools.libclang.out // { outputUnspecified = true; };
clang-unwrapped = tools.libclang.out // { outputSpecified = false; };
# disabled until recommonmark supports sphinx 3
#Llvm-manpages = lowPrio (tools.libllvm.override {

View file

@ -68,14 +68,14 @@ let
};
# `llvm` historically had the binaries. When choosing an output explicitly,
# we need to reintroduce `outputUnspecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputUnspecified = true; };
# we need to reintroduce `outputSpecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputSpecified = false; };
libclang = callPackage ./clang {
inherit llvm_meta;
};
clang-unwrapped = tools.libclang.out // { outputUnspecified = true; };
clang-unwrapped = tools.libclang.out // { outputSpecified = false; };
llvm-manpages = lowPrio (tools.libllvm.override {
enableManpages = true;

View file

@ -39,21 +39,21 @@ let
};
# `llvm` historically had the binaries. When choosing an output explicitly,
# we need to reintroduce `outputUnspecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputUnspecified = true; };
# we need to reintroduce `outputSpecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputSpecified = false; };
libllvm-polly = callPackage ./llvm {
inherit llvm_meta;
enablePolly = true;
};
llvm-polly = tools.libllvm-polly.lib // { outputUnspecified = true; };
llvm-polly = tools.libllvm-polly.lib // { outputSpecified = false; };
libclang = callPackage ./clang {
inherit clang-tools-extra_src llvm_meta;
};
clang-unwrapped = tools.libclang.out // { outputUnspecified = true; };
clang-unwrapped = tools.libclang.out // { outputSpecified = false; };
llvm-manpages = lowPrio (tools.libllvm.override {
enableManpages = true;

View file

@ -39,21 +39,21 @@ let
};
# `llvm` historically had the binaries. When choosing an output explicitly,
# we need to reintroduce `outputUnspecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputUnspecified = true; };
# we need to reintroduce `outputSpecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputSpecified = false; };
libllvm-polly = callPackage ./llvm {
inherit llvm_meta;
enablePolly = true;
};
llvm-polly = tools.libllvm-polly.lib // { outputUnspecified = true; };
llvm-polly = tools.libllvm-polly.lib // { outputSpecified = false; };
libclang = callPackage ./clang {
inherit clang-tools-extra_src llvm_meta;
};
clang-unwrapped = tools.libclang.out // { outputUnspecified = true; };
clang-unwrapped = tools.libclang.out // { outputSpecified = false; };
llvm-manpages = lowPrio (tools.libllvm.override {
enableManpages = true;

View file

@ -63,21 +63,21 @@ let
};
# `llvm` historically had the binaries. When choosing an output explicitly,
# we need to reintroduce `outputUnspecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputUnspecified = true; };
# we need to reintroduce `outputSpecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputSpecified = false; };
libllvm-polly = callPackage ./llvm {
inherit llvm_meta;
enablePolly = true;
};
llvm-polly = tools.libllvm-polly.lib // { outputUnspecified = true; };
llvm-polly = tools.libllvm-polly.lib // { outputSpecified = false; };
libclang = callPackage ./clang {
inherit clang-tools-extra_src llvm_meta;
};
clang-unwrapped = tools.libclang.out // { outputUnspecified = true; };
clang-unwrapped = tools.libclang.out // { outputSpecified = false; };
clang-polly-unwrapped = callPackage ./clang {
inherit llvm_meta;

View file

@ -63,21 +63,21 @@ let
};
# `llvm` historically had the binaries. When choosing an output explicitly,
# we need to reintroduce `outputUnspecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputUnspecified = true; };
# we need to reintroduce `outputSpecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputSpecified = false; };
libllvm-polly = callPackage ./llvm {
inherit llvm_meta;
enablePolly = true;
};
llvm-polly = tools.libllvm-polly.lib // { outputUnspecified = true; };
llvm-polly = tools.libllvm-polly.lib // { outputSpecified = false; };
libclang = callPackage ./clang {
inherit clang-tools-extra_src llvm_meta;
};
clang-unwrapped = tools.libclang.out // { outputUnspecified = true; };
clang-unwrapped = tools.libclang.out // { outputSpecified = false; };
clang-polly-unwrapped = callPackage ./clang {
inherit llvm_meta;

View file

@ -63,21 +63,21 @@ let
};
# `llvm` historically had the binaries. When choosing an output explicitly,
# we need to reintroduce `outputUnspecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputUnspecified = true; };
# we need to reintroduce `outputSpecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputSpecified = false; };
libllvm-polly = callPackage ./llvm {
inherit llvm_meta;
enablePolly = true;
};
llvm-polly = tools.libllvm-polly.lib // { outputUnspecified = true; };
llvm-polly = tools.libllvm-polly.lib // { outputSpecified = false; };
libclang = callPackage ./clang {
inherit clang-tools-extra_src llvm_meta;
};
clang-unwrapped = tools.libclang.out // { outputUnspecified = true; };
clang-unwrapped = tools.libclang.out // { outputSpecified = false; };
clang-polly-unwrapped = callPackage ./clang {
inherit llvm_meta;

View file

@ -68,14 +68,14 @@ let
};
# `llvm` historically had the binaries. When choosing an output explicitly,
# we need to reintroduce `outputUnspecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputUnspecified = true; };
# we need to reintroduce `outputSpecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputSpecified = false; };
libclang = callPackage ./clang {
inherit llvm_meta;
};
clang-unwrapped = tools.libclang.out // { outputUnspecified = true; };
clang-unwrapped = tools.libclang.out // { outputSpecified = false; };
llvm-manpages = lowPrio (tools.libllvm.override {
enableManpages = true;