forked from mirrors/nixpkgs
haskell-packages.nix: fix the implementation of 'cabalNoTest'
The previous implementation used the following tying-the-knot trickery to override 'doCheck' to false for the given build: cabalNoTest = { mkDerivation = x: rec { final = self.cabal.mkDerivation (self: (x final) // { doCheck = false; }); }.final; }; That seemed to work, but for some reason it caused trouble with some builds -- not all -- that use jailbreakCabal. The problem was the 'stdenv' attribute couldn't be evaluated properly anymore: $ nix-build ~/pkgs/top-level/release-haskell.nix -A optparseApplicative.ghc6104.x86_64-linux --show-trace error: while evaluating the attribute `drvPath' at `/nix/store/qkj5cxknwspz8ak0ganm97zfr2bhksgn-nix-1.5.2pre3082_2398417/share/nix/corepkgs/derivation.nix:19:9': while evaluating the builtin function `derivationStrict': while instantiating the derivation named `haskell-optparse-applicative-ghc6.10.4-0.5.2.1' at `/home/simons/.nix-defexpr/pkgs/build-support/cabal/default.nix:40:13': while evaluating the derivation attribute `configurePhase' at `/home/simons/.nix-defexpr/pkgs/build-support/cabal/default.nix:107:13': while evaluating the function at `/home/simons/.nix-defexpr/pkgs/lib/strings.nix:55:26': while evaluating the attribute `outPath' at `/nix/store/qkj5cxknwspz8ak0ganm97zfr2bhksgn-nix-1.5.2pre3082_2398417/share/nix/corepkgs/derivation.nix:18:9': while evaluating the builtin function `getAttr': while evaluating the builtin function `derivationStrict': while instantiating the derivation named `jailbreak-cabal-1.1' at `/home/simons/.nix-defexpr/pkgs/build-support/cabal/default.nix:40:13': while evaluating the derivation attribute `nativeBuildInputs' at `/home/simons/.nix-defexpr/pkgs/stdenv/generic/default.nix:76:17': while evaluating the function at `/home/simons/.nix-defexpr/pkgs/lib/lists.nix:135:21': while evaluating the attribute `buildInputs' at `/home/simons/.nix-defexpr/pkgs/build-support/cabal/default.nix:22:17': while evaluating the builtin function `filter': while evaluating the function at `/home/simons/.nix-defexpr/pkgs/build-support/cabal/default.nix:22:60': while evaluating the function at `/home/simons/.nix-defexpr/pkgs/top-level/haskell-packages.nix:119:17': while evaluating the function at `/home/simons/.nix-defexpr/pkgs/lib/customisation.nix:61:22': while evaluating the function at `/home/simons/.nix-defexpr/pkgs/lib/customisation.nix:56:24': while evaluating the builtin function `isAttrs': while evaluating the function at `/home/simons/.nix-defexpr/pkgs/development/libraries/haskell/Cabal/1.14.0.nix:1:1': while evaluating the function at `/home/simons/.nix-defexpr/pkgs/top-level/haskell-packages.nix:113:20': while evaluating the attribute `final' at `/home/simons/.nix-defexpr/pkgs/top-level/haskell-packages.nix:114:7': while evaluating the function at `/home/simons/.nix-defexpr/pkgs/build-support/cabal/default.nix:9:5': while evaluating the function at `/home/simons/.nix-defexpr/pkgs/stdenv/generic/default.nix:51:24': while evaluating the attribute `meta.license' at `/home/simons/.nix-defexpr/pkgs/development/libraries/haskell/Cabal/1.14.0.nix:17:5': infinite recursion encountered I tried to figure out why this happens, but eventually gave up. The new implementation passes an argument called 'enableCheckPhase' to the Cabal builder, which determines whether the user-specified doCheck value has any effect or not. Now, a normal override can be used to disable unit testing.
This commit is contained in:
parent
67acbf8f37
commit
6f1cec9acb
|
@ -1,6 +1,13 @@
|
|||
# generic builder for Cabal packages
|
||||
|
||||
{ stdenv, fetchurl, lib, pkgconfig, ghc, Cabal, jailbreakCabal, enableLibraryProfiling ? false }:
|
||||
{ stdenv, fetchurl, lib, pkgconfig, ghc, Cabal, jailbreakCabal
|
||||
, enableLibraryProfiling ? false
|
||||
, enableCheckPhase ? true
|
||||
}:
|
||||
|
||||
# The Cabal library shipped with GHC versions older than 7.x doesn't accept the --enable-tests configure flag.
|
||||
assert enableCheckPhase -> stdenv.lib.versionOlder "7" ghc.ghcVersion;
|
||||
|
||||
{
|
||||
mkDerivation =
|
||||
args : # arguments for the individual package, can modify the defaults
|
||||
|
@ -18,6 +25,7 @@
|
|||
x : (removeAttrs x internalAttrs) // {
|
||||
buildInputs = stdenv.lib.filter (y : ! (y == null)) x.buildInputs;
|
||||
propagatedBuildInputs = stdenv.lib.filter (y : ! (y == null)) x.propagatedBuildInputs;
|
||||
doCheck = enableCheckPhase && x.doCheck;
|
||||
};
|
||||
|
||||
defaults =
|
||||
|
@ -92,7 +100,7 @@
|
|||
|
||||
# pass the '--enable-tests' flag to cabal in the configure stage
|
||||
# and run any regression test suites the package might have
|
||||
doCheck = stdenv.lib.versionOlder "7.4" ghc.ghcVersion;
|
||||
doCheck = enableCheckPhase;
|
||||
|
||||
extraConfigureFlags = [
|
||||
(stdenv.lib.enableFeature enableLibraryProfiling "library-profiling")
|
||||
|
|
|
@ -104,16 +104,13 @@ let result = let callPackage = x : y : modifyPrio (newScope result.final x y);
|
|||
|
||||
cabal = callPackage ../build-support/cabal {
|
||||
enableLibraryProfiling = enableLibraryProfiling;
|
||||
enableCheckPhase = pkgs.stdenv.lib.versionOlder "7.4" self.ghc.ghcVersion;
|
||||
};
|
||||
|
||||
# A variant of the cabal build driver that disables unit testing.
|
||||
# Useful for breaking cycles, where the unit test of a package A
|
||||
# depends on package B, which has A as a regular build input.
|
||||
cabalNoTest = {
|
||||
mkDerivation = x: rec {
|
||||
final = self.cabal.mkDerivation (self: (x final) // { doCheck = false; });
|
||||
}.final;
|
||||
};
|
||||
cabalNoTest = self.cabal.override { enableCheckPhase = false; };
|
||||
|
||||
# Convenience helper function.
|
||||
disableTest = x: x.override { cabal = self.cabalNoTest; };
|
||||
|
|
Loading…
Reference in a new issue