Skip to content

Commit c322e12

Browse files
committed
Support Cabal-3.12 and GHC 9.10
1 parent c7f3edd commit c322e12

File tree

6 files changed

+161
-46
lines changed

6 files changed

+161
-46
lines changed

.github/workflows/haskell-ci.yml

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
#
99
# For more information, see https://github.com/andreasabel/haskell-ci
1010
#
11-
# version: 0.17.20231012
11+
# version: 0.19.20240630
1212
#
13-
# REGENDATA ("0.17.20231012",["github","hackage-server.cabal"])
13+
# REGENDATA ("0.19.20240630",["github","hackage-server.cabal"])
1414
#
1515
name: Haskell-CI
1616
on:
@@ -32,19 +32,24 @@ jobs:
3232
strategy:
3333
matrix:
3434
include:
35-
- compiler: ghc-9.8.1
35+
- compiler: ghc-9.10.1
3636
compilerKind: ghc
37-
compilerVersion: 9.8.1
37+
compilerVersion: 9.10.1
3838
setup-method: ghcup
3939
allow-failure: false
40-
- compiler: ghc-9.6.3
40+
- compiler: ghc-9.8.2
4141
compilerKind: ghc
42-
compilerVersion: 9.6.3
42+
compilerVersion: 9.8.2
4343
setup-method: ghcup
4444
allow-failure: false
45-
- compiler: ghc-9.4.7
45+
- compiler: ghc-9.6.5
4646
compilerKind: ghc
47-
compilerVersion: 9.4.7
47+
compilerVersion: 9.6.5
48+
setup-method: ghcup
49+
allow-failure: false
50+
- compiler: ghc-9.4.8
51+
compilerKind: ghc
52+
compilerVersion: 9.4.8
4853
setup-method: ghcup
4954
allow-failure: false
5055
- compiler: ghc-9.2.8
@@ -74,11 +79,10 @@ jobs:
7479
apt-get update
7580
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5
7681
mkdir -p "$HOME/.ghcup/bin"
77-
curl -sL https://downloads.haskell.org/ghcup/0.1.19.5/x86_64-linux-ghcup-0.1.19.5 > "$HOME/.ghcup/bin/ghcup"
82+
curl -sL https://downloads.haskell.org/ghcup/0.1.20.0/x86_64-linux-ghcup-0.1.20.0 > "$HOME/.ghcup/bin/ghcup"
7883
chmod a+x "$HOME/.ghcup/bin/ghcup"
79-
"$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml;
8084
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
81-
"$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
85+
"$HOME/.ghcup/bin/ghcup" install cabal 3.12.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
8286
apt-get update
8387
apt-get install -y libbrotli-dev libgd-dev
8488
env:
@@ -98,7 +102,7 @@ jobs:
98102
echo "HC=$HC" >> "$GITHUB_ENV"
99103
echo "HCPKG=$HCPKG" >> "$GITHUB_ENV"
100104
echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV"
101-
echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.1.0 -vnormal+nowrap" >> "$GITHUB_ENV"
105+
echo "CABAL=$HOME/.ghcup/bin/cabal-3.12.1.0 -vnormal+nowrap" >> "$GITHUB_ENV"
102106
HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')
103107
echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV"
104108
echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV"
@@ -183,7 +187,7 @@ jobs:
183187
echo " ghc-options: -Werror=missing-methods" >> cabal.project
184188
cat >> cabal.project <<EOF
185189
EOF
186-
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(Cabal|Cabal-syntax|hackage-server|parsec|process|text)$/; }' >> cabal.project.local
190+
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(Cabal|Cabal-syntax|hackage-server|parsec|process|text)$/; }' >> cabal.project.local
187191
cat cabal.project
188192
cat cabal.project.local
189193
- name: dump install plan

exes/Main.hs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
{-# LANGUAGE CPP #-}
2+
13
{-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns #-}
4+
25
module Main where
36

47
import qualified Distribution.Server as Server
@@ -65,7 +68,11 @@ main :: IO ()
6568
main = topHandler $ do
6669
hSetBuffering stdout LineBuffering
6770
args <- getArgs
71+
#if !MIN_VERSION_Cabal(3,12,0)
6872
case commandsRun (globalCommand commands) commands args of
73+
#else
74+
commandsRun (globalCommand commands) commands args >>= \case
75+
#endif
6976
CommandHelp help -> printHelp help
7077
CommandList opts -> printOptionsList opts
7178
CommandErrors errs -> printErrors errs
@@ -79,6 +86,7 @@ main = topHandler $ do
7986

8087
where
8188
printHelp help = getProgName >>= putStr . help
89+
printOptionsList :: [String] -> IO ()
8290
printOptionsList = putStr . unlines
8391
printErrors errs = do
8492
putStr (intercalate "\n" errs)
@@ -154,7 +162,11 @@ optionVerbosity getter setter =
154162
"Control verbosity (n is 0--3, default verbosity level is 1)"
155163
getter setter
156164
(optArg "n" (fmap Flag Verbosity.flagToVerbosity)
157-
(Flag Verbosity.verbose)
165+
(
166+
#if MIN_VERSION_Cabal(3,12,0)
167+
show Verbosity.verbose,
168+
#endif
169+
Flag Verbosity.verbose)
158170
(fmap (Just . showForCabal) . flagToList))
159171

160172
optionStateDir :: (a -> Flag FilePath)

hackage-server.cabal

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ license: BSD-3-Clause
2828
license-file: LICENSE
2929

3030
tested-with:
31-
GHC == 9.8.1
32-
GHC == 9.6.3
33-
GHC == 9.4.7
31+
GHC == 9.10.1
32+
GHC == 9.8.2
33+
GHC == 9.6.5
34+
GHC == 9.4.8
3435
GHC == 9.2.8
3536
GHC == 9.0.2
3637
GHC == 8.10.7
@@ -129,13 +130,13 @@ common defaults
129130
-- see `cabal.project.local-ghc-${VERSION}` files
130131
build-depends:
131132
, array >= 0.5 && < 0.6
132-
, base >= 4.13 && < 4.20
133+
, base >= 4.13 && < 4.21
133134
, binary >= 0.8 && < 0.9
134135
, bytestring >= 0.10 && < 0.13
135136
, containers >= 0.6.0 && < 0.8
136137
, deepseq >= 1.4 && < 1.6
137138
, directory >= 1.3 && < 1.4
138-
, filepath >= 1.4 && < 1.5
139+
, filepath >= 1.4 && < 1.6
139140
, mtl >= 2.2.1 && < 2.4
140141
-- we use Control.Monad.Except, introduced in mtl-2.2.1
141142
, pretty >= 1.1 && < 1.2
@@ -148,19 +149,19 @@ common defaults
148149
-- other dependencies shared by most components
149150
build-depends:
150151
, aeson >= 2.1.0.0 && < 2.3
151-
, Cabal >= 3.10.1.0 && < 3.12
152-
, Cabal-syntax >= 3.10.1.0 && < 3.12
152+
, Cabal >= 3.10.1.0 && < 3.14
153+
, Cabal-syntax >= 3.10.1.0 && < 3.14
153154
-- Cabal-syntax needs to be bound to constrain hackage-security
154155
-- see https://github.com/haskell/hackage-server/issues/1130
155156
, fail ^>= 4.9.0
156-
, network >= 3 && < 3.2
157+
, network >= 3 && < 3.3
157158
, network-bsd ^>= 2.8
158159
, network-uri ^>= 2.6
159160
, parsec ^>= 3.1.13
160161
, tar ^>= 0.6
161162
, unordered-containers ^>= 0.2.10
162163
, vector ^>= 0.12 || ^>= 0.13.0.0
163-
, zlib ^>= 0.6.2
164+
, zlib ^>= 0.6.2 || ^>= 0.7.0.0
164165

165166
ghc-options:
166167
-funbox-strict-fields
@@ -170,6 +171,7 @@ common defaults
170171
if impl(ghc >= 8.10)
171172
ghc-options: -Wno-unused-record-wildcards
172173

174+
default-extensions: LambdaCase, TupleSections
173175
other-extensions: CPP, TemplateHaskell
174176

175177

@@ -407,7 +409,7 @@ library
407409
build-depends:
408410
, HStringTemplate ^>= 0.8
409411
, HTTP ^>= 4000.3.16 || ^>= 4000.4.1
410-
, QuickCheck ^>= 2.14
412+
, QuickCheck >= 2.14 && < 2.16
411413
, acid-state ^>= 0.16
412414
, async ^>= 2.2.1
413415
-- requires bumping http-io-streams
@@ -438,7 +440,7 @@ library
438440
, haddock-library ^>= 1.11.0
439441
-- haddock-library-1.11.0 changed type of markupOrderedList
440442
-- see https://github.com/haskell/hackage-server/issues/1128
441-
, happstack-server ^>= 7.7.1 || ^>= 7.8.0
443+
, happstack-server ^>= 7.7.1 || ^>= 7.8.0 || ^>= 7.9.0
442444
, hashable ^>= 1.3 || ^>= 1.4
443445
, hs-captcha ^>= 1.0
444446
, hslogger ^>= 1.3.1
@@ -452,7 +454,7 @@ library
452454
, stm ^>= 2.5.0
453455
, stringsearch ^>= 0.3.6.6
454456
, tagged ^>= 0.8.5
455-
, xhtml ^>= 3000.2.0.0
457+
, xhtml >= 3000.2.0.0 && < 3000.4
456458
, xmlgen ^>= 0.6
457459
, xss-sanitize ^>= 0.3.6
458460

@@ -611,6 +613,9 @@ benchmark RevDeps
611613
build-depends:
612614
, random ^>= 1.2
613615
, gauge
616+
-- gauge does not support base-4.20
617+
if impl(ghc >= 9.10)
618+
buildable: False
614619
ghc-options: -with-rtsopts=-s
615620
other-modules: RevDepCommon
616621

src/Distribution/Server/Framework/Instances.hs

Lines changed: 93 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ instance SafeCopy VersionRange where
117117
10 -> majorBoundVersion <$> safeGet -- since Cabal-2.0
118118
_ -> fail "VersionRange.getCopy: bad tag"
119119

120+
-- !! KEEP IN SYNC with instance Arbitrary OS
120121
instance SafeCopy OS where
121122
errorTypeName _ = "OS"
122123

@@ -173,6 +174,7 @@ instance SafeCopy OS where
173174
#endif
174175
_ -> fail "SafeCopy OS getCopy: unexpected tag"
175176

177+
-- !! KEEP IN SYNC with instance Arbitrary Arch
176178
instance SafeCopy Arch where
177179
errorTypeName _ = "Arch"
178180

@@ -196,6 +198,12 @@ instance SafeCopy Arch where
196198
putCopy AArch64 = contain $ putWord8 17
197199
putCopy S390X = contain $ putWord8 18
198200
putCopy Wasm32 = contain $ putWord8 19
201+
#if MIN_VERSION_Cabal_syntax(3,12,0)
202+
putCopy PPC64LE = contain $ putWord8 20
203+
putCopy Sparc64 = contain $ putWord8 21
204+
putCopy RISCV64 = contain $ putWord8 22
205+
putCopy LoongArch64 = contain $ putWord8 23
206+
#endif
199207

200208
getCopy = contain $ do
201209
tag <- getWord8
@@ -220,8 +228,15 @@ instance SafeCopy Arch where
220228
17 -> return AArch64
221229
18 -> return S390X
222230
19 -> return Wasm32
231+
#if MIN_VERSION_Cabal_syntax(3,12,0)
232+
20 -> return PPC64LE
233+
21 -> return Sparc64
234+
22 -> return RISCV64
235+
23 -> return LoongArch64
236+
#endif
223237
_ -> fail "SafeCopy Arch getCopy: unexpected tag"
224238

239+
-- !! KEEP IN SYNC with instance Arbitrary CompilerFlavor
225240
instance SafeCopy CompilerFlavor where
226241
errorTypeName _ = "CompilerFlavor"
227242

@@ -238,6 +253,9 @@ instance SafeCopy CompilerFlavor where
238253
putCopy (HaskellSuite s) = contain $ putWord8 10 >> safePut s
239254
putCopy GHCJS = contain $ putWord8 11
240255
putCopy Eta = contain $ putWord8 12
256+
#if MIN_VERSION_Cabal_syntax(3,12,1)
257+
putCopy MHS = contain $ putWord8 13
258+
#endif
241259

242260
getCopy = contain $ do
243261
tag <- getWord8
@@ -255,6 +273,9 @@ instance SafeCopy CompilerFlavor where
255273
10 -> return HaskellSuite <*> safeGet
256274
11 -> return GHCJS
257275
12 -> return Eta
276+
#if MIN_VERSION_Cabal_syntax(3,12,1)
277+
13 -> return MHS
278+
#endif
258279
_ -> fail "SafeCopy CompilerFlavor getCopy: unexpected tag"
259280

260281

@@ -363,6 +384,7 @@ instance Parsec UTCTime where
363384
Just t -> return t
364385
where
365386
digit2 = replicateM 2 P.digit
387+
366388
-------------------
367389
-- Arbitrary instances
368390
--
@@ -376,31 +398,88 @@ instance Arbitrary Version where
376398
instance Arbitrary PackageIdentifier where
377399
arbitrary = PackageIdentifier <$> arbitrary <*> arbitrary
378400

401+
-- !! KEEP IN SYNC with instance SafeCopy CompilerFlavor
379402
instance Arbitrary CompilerFlavor where
380-
arbitrary = oneof [ pure OtherCompiler <*> vectorOf 3 (choose ('A', 'Z'))
381-
, pure GHC, pure NHC, pure YHC, pure Hugs, pure HBC
382-
, pure Helium, pure JHC, pure LHC, pure UHC ]
403+
arbitrary = oneof
404+
[ pure OtherCompiler <*> vectorOf 3 (choose ('A', 'Z'))
405+
, pure GHC
406+
, pure NHC
407+
, pure YHC
408+
, pure Hugs
409+
, pure HBC
410+
, pure Helium
411+
, pure JHC
412+
, pure LHC
413+
, pure UHC
414+
, pure HaskellSuite <*> vectorOf 3 (choose ('A', 'Z'))
415+
, pure GHCJS
416+
, pure Eta
417+
#if MIN_VERSION_Cabal_syntax(3,12,1)
418+
, pure MHS
419+
#endif
420+
]
383421

384422
instance Arbitrary CompilerId where
385423
arbitrary = CompilerId <$> arbitrary <*> arbitrary
386424

425+
-- !! KEEP IN SYNC with instance SafeCopy Arch
387426
instance Arbitrary Arch where
388-
arbitrary = oneof [ pure OtherArch <*> vectorOf 3 (choose ('A', 'Z'))
389-
, pure I386, pure X86_64, pure PPC, pure PPC64, pure Sparc
390-
, pure Arm, pure Mips, pure SH, pure IA64, pure S390
391-
, pure Alpha, pure Hppa, pure Rs6000, pure M68k, pure Vax ]
427+
arbitrary = oneof
428+
[ pure OtherArch <*> vectorOf 3 (choose ('A', 'Z'))
429+
, pure I386
430+
, pure X86_64
431+
, pure PPC
432+
, pure PPC64
433+
, pure Sparc
434+
, pure Arm
435+
, pure Mips
436+
, pure SH
437+
, pure IA64
438+
, pure S390
439+
, pure Alpha
440+
, pure Hppa
441+
, pure Rs6000
442+
, pure M68k
443+
, pure Vax
444+
, pure JavaScript
445+
, pure AArch64
446+
, pure S390X
447+
, pure Wasm32
448+
#if MIN_VERSION_Cabal_syntax(3,12,0)
449+
, pure PPC64LE
450+
, pure Sparc64
451+
, pure RISCV64
452+
, pure LoongArch64
453+
#endif
454+
]
392455

456+
-- !! KEEP IN SYNC with instance SafeCopy OS
393457
instance Arbitrary OS where
394-
arbitrary = oneof [ pure OtherOS <*> vectorOf 3 (choose ('A', 'Z'))
395-
, pure Linux, pure Windows, pure OSX, pure FreeBSD
396-
, pure OpenBSD, pure NetBSD, pure Solaris, pure AIX
397-
, pure HPUX, pure IRIX, pure HaLVM, pure IOS
458+
arbitrary = oneof
459+
[ pure OtherOS <*> vectorOf 3 (choose ('A', 'Z'))
460+
, pure Linux
461+
, pure Windows
462+
, pure OSX
463+
, pure FreeBSD
464+
, pure OpenBSD
465+
, pure NetBSD
466+
, pure Solaris
467+
, pure AIX
468+
, pure HPUX
469+
, pure IRIX
470+
, pure HaLVM
471+
, pure IOS
472+
, pure DragonFly
473+
, pure Ghcjs
474+
, pure Hurd
475+
, pure Android
476+
, pure Wasi
398477
#if MIN_VERSION_Cabal_syntax(3,11,0)
399-
, pure Haiku
478+
, pure Haiku
400479
#else
401-
, pure $ OtherOS "haiku"
480+
, pure $ OtherOS "haiku"
402481
#endif
403-
]
482+
]
404483

405484
instance Arbitrary FlagName where
406485
arbitrary = mkFlagName <$> vectorOf 4 (choose ('a', 'z'))

0 commit comments

Comments
 (0)