Skip to content

Commit 8a8d739

Browse files
authored
Merge pull request #1322 from haskell/Cabal-3.12
Cabal 3.12
2 parents 7b34592 + 54f3385 commit 8a8d739

File tree

9 files changed

+184
-82
lines changed

9 files changed

+184
-82
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

cabal.project

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,6 @@ packages:
66

77
-- This project config requires cabal 2.4 or later
88

9-
-- If in doubt, use GHC 8.8 to build hackage-server; see
10-
-- 'tested-with' in 'hackage-server.cabal' for a list of currently
11-
-- CI-validated GHC versions
12-
--
13-
-- with-compiler: ghc-8.8
14-
15-
16-
allow-newer: rss:time, rss:base
17-
189
-----------------------------------------------------------------------------
1910
-- Anti-constraints
2011

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: 34 additions & 29 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,32 +149,33 @@ 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.12.1.0 && < 3.14
153+
, Cabal-syntax >= 3.12.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

165-
ghc-options: -Wall -fwarn-tabs -fno-warn-unused-do-bind -fno-warn-deprecated-flags -funbox-strict-fields
166-
167-
if impl(ghc >= 8.2)
168-
ghc-options: -Werror=incomplete-patterns -Werror=missing-methods
166+
ghc-options:
167+
-funbox-strict-fields
168+
-Wall -fwarn-tabs -fno-warn-unused-do-bind -fno-warn-deprecated-flags
169+
-Werror=incomplete-patterns -Werror=missing-methods
169170

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

176-
library lib-server
178+
library
177179
import: defaults
178180
hs-source-dirs: src
179181

@@ -407,7 +409,7 @@ library lib-server
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 lib-server
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 lib-server
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

@@ -472,7 +474,7 @@ library lib-server
472474
common exe-defaults
473475
import: defaults
474476

475-
build-depends: lib-server
477+
build-depends: hackage-server
476478
hs-source-dirs: exes
477479
ghc-options: -threaded -rtsopts
478480

@@ -493,7 +495,7 @@ executable hackage-mirror
493495
main-is: MirrorClient.hs
494496

495497
build-depends:
496-
-- version constraints inherited from lib-server
498+
-- version constraints inherited from hackage-server
497499
, HTTP
498500
, hackage-security
499501

@@ -503,7 +505,7 @@ executable hackage-build
503505
main-is: BuildClient.hs
504506

505507
build-depends:
506-
-- version constraints inherited from lib-server
508+
-- version constraints inherited from hackage-server
507509
, HTTP
508510

509511
-- Runtime dependency only;
@@ -523,7 +525,7 @@ executable hackage-import
523525
main-is: ImportClient.hs
524526

525527
build-depends:
526-
-- version constraints inherited from lib-server
528+
-- version constraints inherited from hackage-server
527529
, HTTP
528530
, async
529531
, csv
@@ -533,7 +535,7 @@ executable hackage-import
533535
common test-defaults
534536
import: defaults
535537

536-
build-depends: lib-server
538+
build-depends: hackage-server
537539
hs-source-dirs: tests
538540
ghc-options: -threaded -rtsopts -fno-warn-orphans
539541

@@ -563,9 +565,9 @@ test-suite HighLevelTest
563565
-- so if this works, it's accidental!
564566
build-tool-depends: hackage-server:hackage-server
565567

566-
-- NOTE: lib-server is not a real dependency; it's only used to inherit version constraints
568+
-- NOTE: hackage-server is not a real dependency; it's only used to inherit version constraints
567569
build-depends:
568-
-- version constraints inherited from lib-server
570+
-- version constraints inherited from hackage-server
569571
, HTTP
570572
, attoparsec-aeson >= 2.1.0.0 && < 2.3
571573
, base64-bytestring
@@ -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

@@ -640,9 +645,9 @@ test-suite CreateUserTest
640645
-- see note in 'Test-Suite HighLevelTest'
641646
build-tool-depends: hackage-server:hackage-server
642647

643-
-- NOTE: lib-server is not a real dependency; it's only used to inherit version constraints
648+
-- NOTE: hackage-server is not a real dependency; it's only used to inherit version constraints
644649
build-depends:
645-
-- version constraints inherited from lib-server
650+
-- version constraints inherited from hackage-server
646651
, HTTP
647652
, base64-bytestring
648653
, random
@@ -657,7 +662,7 @@ test-suite PackageTests
657662
other-modules: Distribution.Server.Packages.UnpackTest
658663

659664
build-depends:
660-
-- version constraints inherited from lib-server
665+
-- version constraints inherited from hackage-server
661666
-- component-specific dependencies
662667
, tasty ^>= 1.5
663668
, tasty-hunit ^>= 0.10
@@ -670,7 +675,7 @@ test-suite HashTests
670675
main-is: HashTestMain.hs
671676

672677
build-depends:
673-
-- version constraints inherited from lib-server
678+
-- version constraints inherited from hackage-server
674679
, base16-bytestring
675680
, cereal
676681
, cryptohash-md5
@@ -686,7 +691,7 @@ test-suite DocTests
686691
type: exitcode-stdio-1.0
687692
main-is: DocTestMain.hs
688693
build-depends:
689-
, lib-server
694+
, hackage-server
690695
, doctest-parallel ^>= 0.3.0
691696
-- doctest-parallel-0.2.2 is the first to filter out autogen-modules
692697

src/Distribution/Server/Features/Tags/State.hs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ import Control.Monad (liftM2)
2020
import Data.SafeCopy (base, deriveSafeCopy)
2121
import Data.Typeable (Typeable)
2222
import qualified Data.Char as Char
23+
import Data.Functor ( (<&>) )
2324
import Data.Maybe (fromMaybe)
24-
import Data.List (foldl')
25+
import Data.List (find, foldl')
2526
import Control.Monad.State (get, put, modify)
2627
import Control.Monad.Reader (ask, asks)
2728
import Control.DeepSeq
@@ -87,13 +88,9 @@ lookupTagAlias tag
8788
return (Map.lookup tag m)
8889

8990
getTagAlias :: Tag -> Query TagAlias Tag
90-
getTagAlias tag
91-
= do TagAlias m <- ask
92-
if tag `elem` Map.keys m
93-
then return tag
94-
else if tag `Set.member` foldr Set.union Set.empty (Map.elems m)
95-
then return $ head (Map.keys $ Map.filter (tag `Set.member`) m)
96-
else return tag
91+
getTagAlias tag = ask <&> \ (TagAlias m) ->
92+
if Map.member tag m then tag
93+
else maybe tag fst $ find (Set.member tag . snd) $ Map.toList m
9794

9895
emptyPackageTags :: PackageTags
9996
emptyPackageTags = PackageTags Map.empty Map.empty Map.empty
@@ -279,4 +276,3 @@ $(makeAcidic ''PackageTags ['tagsForPackage
279276
,'lookupReviewTags
280277
,'clearReviewTags
281278
])
282-

0 commit comments

Comments
 (0)