Skip to content

Commit b3ae6f9

Browse files
Merge pull request #572 from NixOS/Cabal-3.8
Fix test suites with Cabal >= 3.8
2 parents 0d1a5a7 + 19621c9 commit b3ae6f9

File tree

4 files changed

+33
-5
lines changed

4 files changed

+33
-5
lines changed

cabal2nix/test/Main.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{-# LANGUAGE OverloadedStrings #-}
22
{-# LANGUAGE LambdaCase #-}
3+
{-# LANGUAGE CPP #-}
34

45
module Main ( main ) where
56

@@ -13,8 +14,13 @@ import Control.Monad
1314
import qualified Data.Set as Set
1415
import Distribution.Compiler
1516
import Distribution.Package
17+
#if MIN_VERSION_Cabal(3,8,1)
18+
import Distribution.Simple.PackageDescription
19+
import Distribution.Types.GenericPackageDescription
20+
#else
1621
import Distribution.PackageDescription
1722
import Distribution.PackageDescription.Parsec
23+
#endif
1824
import Distribution.System
1925
import Distribution.Verbosity
2026
import Distribution.Version
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
["aarch64-darwin","aarch64-genode","aarch64-linux","aarch64-netbsd","aarch64-none","aarch64_be-none","arm-none","armv5tel-linux","armv6l-linux","armv6l-netbsd","armv6l-none","armv7a-darwin","armv7a-linux","armv7a-netbsd","armv7l-linux","armv7l-netbsd","avr-none","i686-cygwin","i686-darwin","i686-freebsd","i686-genode","i686-linux","i686-netbsd","i686-none","i686-openbsd","i686-windows","js-ghcjs","m68k-linux","m68k-netbsd","m68k-none","mips-linux","mips64-linux","mips64el-linux","mipsel-linux","mipsel-netbsd","mmix-mmixware","msp430-none","or1k-none","powerpc-netbsd","powerpc-none","powerpc64-linux","powerpc64le-linux","powerpcle-none","riscv32-linux","riscv32-netbsd","riscv32-none","riscv64-linux","riscv64-netbsd","riscv64-none","s390-linux","s390-none","s390x-linux","s390x-none","vc4-none","wasm32-wasi","wasm64-wasi","x86_64-cygwin","x86_64-darwin","x86_64-freebsd","x86_64-genode","x86_64-linux","x86_64-netbsd","x86_64-none","x86_64-openbsd","x86_64-redox","x86_64-solaris","x86_64-windows"]
1+
["aarch64-darwin","aarch64-genode","aarch64-linux","aarch64-netbsd","aarch64-none","aarch64_be-none","arm-none","armv5tel-linux","armv6l-linux","armv6l-netbsd","armv6l-none","armv7a-darwin","armv7a-linux","armv7a-netbsd","armv7l-linux","armv7l-netbsd","avr-none","i686-cygwin","i686-darwin","i686-freebsd","i686-genode","i686-linux","i686-netbsd","i686-none","i686-openbsd","i686-windows","js-ghcjs","m68k-linux","m68k-netbsd","m68k-none","microblaze-linux","microblaze-none","microblazeel-linux","microblazeel-none","mips-linux","mips64-linux","mips64el-linux","mipsel-linux","mipsel-netbsd","mmix-mmixware","msp430-none","or1k-none","powerpc-netbsd","powerpc-none","powerpc64-linux","powerpc64le-linux","powerpcle-none","riscv32-linux","riscv32-netbsd","riscv32-none","riscv64-linux","riscv64-netbsd","riscv64-none","rx-none","s390-linux","s390-none","s390x-linux","s390x-none","vc4-none","wasm32-wasi","wasm64-wasi","x86_64-cygwin","x86_64-darwin","x86_64-freebsd","x86_64-genode","x86_64-linux","x86_64-netbsd","x86_64-none","x86_64-openbsd","x86_64-redox","x86_64-solaris","x86_64-windows"]

distribution-nixpkgs/test/hspec.hs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{-# LANGUAGE CPP #-}
12
module Main ( main ) where
23

34
import Control.DeepSeq
@@ -29,7 +30,7 @@ main = hspec $ do
2930
]
3031

3132
describe "Platform rendering and parsing:" $ do
32-
it "Checks cover all systems from all-system-tuples.json" $do
33+
it "Checks cover all systems from all-system-tuples.json" $ do
3334
let allSystemTuplesJson = "test/data/all-system-tuples.json"
3435
available <- doesFileExist allSystemTuplesJson
3536
if not available
@@ -78,6 +79,10 @@ nixpkgsSystemMapping =
7879
, ("m68k-linux", Platform M68k Linux)
7980
, ("m68k-netbsd", Platform M68k NetBSD)
8081
, ("m68k-none", Platform M68k (OtherOS "none"))
82+
, ("microblaze-linux", Platform (OtherArch "microblaze") Linux)
83+
, ("microblazeel-linux", Platform (OtherArch "microblazeel") Linux)
84+
, ("microblaze-none", Platform (OtherArch "microblaze") (OtherOS "none"))
85+
, ("microblazeel-none", Platform (OtherArch "microblazeel") (OtherOS "none"))
8186
, ("mips64el-linux", Platform (OtherArch "mips64el") Linux)
8287
, ("mipsel-linux", Platform (OtherArch "mipsel") Linux)
8388
, ("mipsel-netbsd", Platform (OtherArch "mipsel") NetBSD)
@@ -95,13 +100,24 @@ nixpkgsSystemMapping =
95100
, ("riscv64-linux", Platform (OtherArch "riscv64") Linux)
96101
, ("riscv64-netbsd", Platform (OtherArch "riscv64") NetBSD)
97102
, ("riscv64-none", Platform (OtherArch "riscv64") (OtherOS "none"))
103+
, ("rx-none", Platform (OtherArch "rx") (OtherOS "none"))
98104
, ("s390-linux", Platform S390 Linux)
99105
, ("s390-none", Platform S390 (OtherOS "none"))
106+
#if MIN_VERSION_Cabal(3,8,1)
107+
, ("s390x-linux", Platform S390X Linux)
108+
, ("s390x-none", Platform S390X (OtherOS "none"))
109+
#else
100110
, ("s390x-linux", Platform (OtherArch "s390x") Linux)
101111
, ("s390x-none", Platform (OtherArch "s390x") (OtherOS "none"))
112+
#endif
102113
, ("vc4-none", Platform (OtherArch "vc4") (OtherOS "none"))
114+
#if MIN_VERSION_Cabal(3,8,1)
115+
, ("wasm32-wasi", Platform Wasm32 Wasi)
116+
, ("wasm64-wasi", Platform (OtherArch "wasm64") Wasi)
117+
#else
103118
, ("wasm32-wasi", Platform (OtherArch "wasm32") (OtherOS "wasi"))
104119
, ("wasm64-wasi", Platform (OtherArch "wasm64") (OtherOS "wasi"))
120+
#endif
105121
, ("x86_64-cygwin", Platform X86_64 (OtherOS "cygwin"))
106122
, ("x86_64-darwin", Platform X86_64 OSX)
107123
, ("x86_64-freebsd", Platform X86_64 FreeBSD)

shell.nix

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
{ pkgs ? import <nixpkgs> { } }:
1+
{ pkgs ? import <nixpkgs> { }
2+
, ghcVersion ? pkgs.haskellPackages.ghc.version
3+
, withHls ? true
4+
}:
25

36
let
4-
haskellPackages = pkgs.haskellPackages;
7+
haskellPackages = pkgs.haskell.packages."ghc${
8+
builtins.replaceStrings [ "." ] [ "" ] ghcVersion
9+
}";
510
ghc = haskellPackages.ghcWithHoogle (hps: [
611
hps.ansi-wl-pprint
712
hps.hopenssl
@@ -26,7 +31,8 @@ in pkgs.mkShell {
2631
ghc
2732
pkgs.cabal-install
2833
pkgs.haskell-ci
29-
haskellPackages.haskell-language-server
3034
(pkgs.lib.getLib pkgs.openssl)
35+
] ++ pkgs.lib.optionals withHls [
36+
haskellPackages.haskell-language-server
3137
];
3238
}

0 commit comments

Comments
 (0)