Skip to content

Commit 85c2fad

Browse files
committed
Minimal migration to Cabal-3.6.3.0
This patch makes the minimal changes to compile with Cabal-3.6.3.0. Cabal-3.6 intends a semantics of the caret operator ^>= that is more subtle than expanding it into its version interval. We do not pick up this intention in this patch, but fall back to Distribution.Types.VersionInterval.Legacy See haskell/cabal#7916 for a in-depth discussion.
1 parent 1543b15 commit 85c2fad

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

hackage-server.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ common defaults
113113
-- other dependencies shared by most components
114114
build-depends:
115115
, aeson ^>= 1.5
116-
, Cabal ^>= 3.4.1.0
116+
, Cabal ^>= 3.6.3.0
117117
, fail ^>= 4.9.0
118118
-- we use Control.Monad.Except, introduced in mtl-2.2.1
119119
, network >= 3 && < 3.2

src/Distribution/Server/Packages/Render.hs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,15 @@ import Distribution.PackageDescription.Configuration
3131
import Distribution.Package
3232
import Distribution.Text
3333
import Distribution.Pretty (prettyShow)
34-
import Distribution.Version
34+
import Distribution.Version (noVersion)
35+
import Distribution.Types.VersionInterval.Legacy
36+
-- Andreas Abel, 2022-03-27:
37+
-- Note that this "Legacy" module is both new and deprecated in Cabal-3.6.
38+
-- However, the non-deprecated module "Distribution.Types.VersionInterval"
39+
-- does not define the functions anymore we rely on here, namely
40+
-- @{union,intersect}VersionIntervals@.
41+
-- I criticized this unfortunate development at length at:
42+
-- https://github.com/haskell/cabal/issues/7916
3543
import Distribution.ModuleName as ModuleName
3644
import Distribution.Types.ModuleReexport
3745

@@ -41,7 +49,9 @@ import Distribution.Server.Packages.Types
4149
import Distribution.Server.Packages.ModuleForest
4250
import qualified Distribution.Server.Users.Users as Users
4351
import Distribution.Server.Users.Types
52+
import Distribution.Utils.Path (getSymbolicPath)
4453
import Distribution.Utils.ShortText (fromShortText)
54+
4555
import qualified Data.TarIndex as TarIndex
4656
import Data.TarIndex (TarIndex, TarEntryOffset)
4757

@@ -95,7 +105,7 @@ doPackageRender users info = PackageRender
95105
, rendSublibraryDeps = (unUnqualComponentName *** depTree libBuildInfo)
96106
`map` condSubLibraries genDesc
97107
, rendLicenseName = prettyShow (license desc) -- maybe make this a bit more human-readable
98-
, rendLicenseFiles = licenseFiles desc
108+
, rendLicenseFiles = map getSymbolicPath $ licenseFiles desc
99109
, rendMaintainer = case fromShortText $ maintainer desc of
100110
"None" -> Nothing
101111
"none" -> Nothing

src/Distribution/Server/Util/ParseSpecVer.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,8 @@ decodeVerFallback v0 = simpleParse v <|> parseSpecVR
239239
parseSpecVR = do
240240
vr <- simpleParse v
241241
case asVersionIntervals vr of
242-
[] -> Just $ mkVersion [0]
243-
((LowerBound version _, _):_) -> Just $ version
242+
VersionInterval (LowerBound version _) _ : _ -> Just version
243+
[] -> Just $ mkVersion [0]
244244

245245
v = BC8.unpack v0
246246

0 commit comments

Comments
 (0)