Skip to content

Commit 649896f

Browse files
committed
Cabal(-syntax)-3.10 and GHC 9.6
- changes needed for Cabal-3.9 and unix-2.8 - bump to Cabal-(syntax-)-3.10.1.0 and allow base-4.18 - new autmatic flag `doctests` to control build of DocTests
1 parent 6dfd5f3 commit 649896f

File tree

5 files changed

+45
-25
lines changed

5 files changed

+45
-25
lines changed

cabal.project

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,6 @@ packages: .
1010

1111
allow-newer: rss:time, rss:base
1212

13-
-- Andreas, 2022-10-28: `Cabal-3.8.1.0` wants `process >= 1.6.14`
14-
-- which is too new for the `ghc < 9.4` package that is pulled in
15-
-- by `doctest-parallel`.
16-
-- Since, Cabal-3.8.1.0 has no reason to want such a new version
17-
-- of process, we can solve the conflict here by allowing
18-
-- `Cabal` to use the shipped version of `process`.
19-
-- This workaround can be removed once `Cabal-3.8` drops
20-
-- its (unreasonable) constraint on `process`.
21-
-- See: https://github.com/haskell/cabal/issues/8554
22-
allow-older: Cabal:process
23-
2413
-----------------------------------------------------------------------------
2514
-- Anti-constraints
2615

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.10.1.0
134+
, Cabal-syntax ^>= 3.10.1.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
@@ -649,3 +655,6 @@ test-suite DocTests
649655
, lib-server
650656
, doctest-parallel ^>= 0.3.0
651657
-- doctest-parallel-0.2.2 is the first to filter out autogen-modules
658+
659+
if !flag(doctests)
660+
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)