Skip to content

Commit 32cfdc7

Browse files
committed
WIP: Cabal 3.9 and GHC 9.6
1 parent ff98d03 commit 32cfdc7

File tree

4 files changed

+45
-14
lines changed

4 files changed

+45
-14
lines changed

hackage-server.cabal

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,14 @@ flag test-create-user
9191

9292
flag cabal-parsers
9393
description: Enable experimental @cabal-parsers@ checks
94-
manual: True
9594
default: False
95+
manual: True
96+
97+
-- Automatic flag to turn off the DocTests suite if its dependencies are not available.
98+
flag doctests
99+
description: Build DocTests test-suite
100+
-- default: True
101+
-- manual: False
96102

97103
----------------------------------------------------------------------------
98104

@@ -105,7 +111,7 @@ common defaults
105111
-- see `cabal.project.local-ghc-${VERSION}` files
106112
build-depends:
107113
, array >= 0.5 && < 0.6
108-
, base >= 4.13 && < 4.18
114+
, base >= 4.13 && < 4.19
109115
, binary >= 0.8 && < 0.9
110116
, bytestring >= 0.10 && < 0.12
111117
, containers ^>= 0.6.0
@@ -119,13 +125,13 @@ common defaults
119125
, text ^>= 1.2.5.0 || ^>= 2.0
120126
, time >= 1.9 && < 1.13
121127
, transformers >= 0.5 && < 0.7
122-
, unix >= 2.7 && < 2.8
128+
, unix >= 2.7 && < 2.9
123129
, scientific
124130
-- other dependencies shared by most components
125131
build-depends:
126132
, aeson ^>= 2.0.3.0 || ^>= 2.1.0.0
127-
, Cabal ^>= 3.8.1.0
128-
, Cabal-syntax ^>= 3.8.1.0
133+
, Cabal ^>= 3.8.1.0 || ^>= 3.9.0.0
134+
, Cabal-syntax ^>= 3.8.1.0 || ^>= 3.9.0.0
129135
-- Cabal-syntax needs to be bound to constrain hackage-security
130136
-- see https://github.com/haskell/hackage-server/issues/1130
131137
, fail ^>= 4.9.0
@@ -650,3 +656,6 @@ test-suite DocTests
650656
, lib-server
651657
, doctest-parallel ^>= 0.3.0
652658
-- doctest-parallel-0.2.2 is the first to filter out autogen-modules
659+
660+
if !flag(doctests)
661+
buildable: False

src/Distribution/Server/Framework/BlobStorage.hs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
{-# LANGUAGE DeriveDataTypeable, GeneralizedNewtypeDeriving,
2-
ScopedTypeVariables, TypeFamilies, CPP,
3-
RecordWildCards #-}
1+
{-# LANGUAGE CPP #-}
2+
{-# LANGUAGE DeriveDataTypeable #-}
3+
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
4+
{-# LANGUAGE RecordWildCards #-}
5+
{-# LANGUAGE ScopedTypeVariables #-}
6+
{-# LANGUAGE TypeFamilies #-}
7+
48
-----------------------------------------------------------------------------
59
-- |
610
-- Module : Distribution.Server.BlobStorage
@@ -199,7 +203,11 @@ withIncoming' store file blobId action = do
199203
if commit
200204
then do
201205
#ifndef mingw32_HOST_OS
206+
#if !MIN_VERSION_unix(2,8,0)
202207
fd <- openFd (directory store blobId) ReadOnly Nothing defaultFileFlags
208+
#else
209+
fd <- openFd (directory store blobId) ReadOnly defaultFileFlags
210+
#endif
203211
#endif
204212
-- TODO: if the target already exists then there is no need to overwrite
205213
-- it since it will have the same content. Checking and then renaming

src/Distribution/Server/Packages/Unpack.hs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
-- Unpack a tarball containing a Cabal package
2-
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
1+
{-# LANGUAGE CPP #-}
32
{-# LANGUAGE FlexibleContexts #-}
3+
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
44
{-# LANGUAGE RankNTypes #-}
55
{-# LANGUAGE ScopedTypeVariables #-}
6+
7+
-- | Unpack a tarball containing a Cabal package
8+
69
module Distribution.Server.Packages.Unpack (
710
CombinedTarErrs(..),
811
checkEntries,
@@ -32,7 +35,11 @@ import Distribution.PackageDescription.Configuration
3235
( flattenPackageDescription )
3336
import Distribution.PackageDescription.Check
3437
( PackageCheck(..), checkPackage, CheckPackageContentOps(..)
35-
, checkPackageContent )
38+
, checkPackageContent
39+
#if MIN_VERSION_Cabal(3,9,0)
40+
, ppPackageCheck
41+
#endif
42+
)
3643
import Distribution.Parsec
3744
( showPError, showPWarning )
3845
import Distribution.Text
@@ -293,8 +300,11 @@ extraChecks genPkgDesc pkgId tarIndex = do
293300
isDistError (PackageDistSuspiciousWarn {}) = False -- just a warning
294301
isDistError _ = True
295302
(errors, warnings) = partition isDistError checks
296-
mapM_ (throwError . explanation) errors
297-
mapM_ (warn . explanation) warnings
303+
#if !MIN_VERSION_Cabal(3,9,0)
304+
ppPackageCheck = explanation
305+
#endif
306+
mapM_ (throwError . ppPackageCheck) errors
307+
mapM_ (warn . ppPackageCheck) warnings
298308

299309
-- Proprietary License check (only active in central-server branch)
300310
unless (allowAllRightsReserved || isAcceptableLicense pkgDesc) $

src/Distribution/Server/Util/CabalRevisions.hs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,16 @@ checkCabalFileRevision checkXRevision old new = do
176176
newwarns -> fail $ "New parse warning: "
177177
++ unlines (map (showPWarning filename) newwarns)
178178

179+
checkPackageChecks :: Check GenericPackageDescription
179180
checkPackageChecks pkg pkg' =
180181
let checks = checkPackage pkg Nothing
181182
checks' = checkPackage pkg' Nothing
182183
in case checks' \\ checks of
183184
[] -> return ()
184-
newchecks -> fail $ unlines (map explanation newchecks)
185+
newchecks -> fail $ unlines (map ppPackageCheck newchecks)
186+
#if !MIN_VERSION_Cabal(3,9,0)
187+
where ppPackageCheck = explanation
188+
#endif
185189

186190
checkGenericPackageDescription :: Bool -> Check GenericPackageDescription
187191
checkGenericPackageDescription checkXRevision

0 commit comments

Comments
 (0)