aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/patches/cabal-install-ghc8.10.patch
blob: 67c0953058de89ce9345a151692de72467a855de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
From ac9b41eef3c781ce188ded2551f98fe75152e30c Mon Sep 17 00:00:00 2001
From: Oleg Grenrus <oleg.grenrus@iki.fi>
Date: Tue, 14 Apr 2020 11:31:34 +0300
Subject: [PATCH] GHC-8.10 support for 3.2

Includes cherry-picked commits:

- Test cabal-install with GHC-8.10 #6709
- Add GHC-8.10.1 job. Only tests Cabal-the-lib part atm. #6617

Also add topHandler' signature.
---
 .docker/validate-8.10.1.dockerfile            |  60 ++++++
 .github/workflows/artifacts.yml               |   6 +-
 .github/workflows/bootstrap.yml               |   4 +-
 .github/workflows/linux.yml                   | 179 ++++++++++++------
 .github/workflows/macos.yml                   |  40 ++--
 .github/workflows/quick-jobs.yml              |   4 +-
 .github/workflows/windows.yml                 | 117 +++++++++++-
 .../Distribution/PackageDescription/Quirks.hs |  19 +-
 Makefile                                      |   4 +
 boot/ci-artifacts.template.yml                |   6 +-
 boot/ci-bootstrap.template.yml                |   4 +-
 boot/ci-linux.template.yml                    |   8 +-
 boot/ci-macos.template.yml                    |   7 +-
 boot/ci-quick-jobs.template.yml               |   4 +-
 boot/ci-windows.template.yml                  |   8 +-
 cabal-dev-scripts/src/GenValidate.hs          |  33 ++--
 Distribution/Client/CmdSdist.hs |   3 +
 .../Distribution/Client/FetchUtils.hs         |   4 +-
 .../Distribution/Client/IndexUtils.hs         |   2 +-
 Distribution/Client/Sandbox.hs  |   5 +-
 .../Distribution/Client/TargetSelector.hs     |   2 +-
 Distribution/Client/Update.hs   |   4 +-
 .../Distribution/Client/Utils/Json.hs         |  13 +-
 .../Distribution/Solver/Modular/Assignment.hs |  11 +-
 .../Distribution/Solver/Modular/Builder.hs    |  10 +-
 .../Distribution/Solver/Modular/Index.hs      |   6 +-
 .../Solver/Modular/IndexConversion.hs         |   8 +-
 .../Distribution/Solver/Modular/Solver.hs     |  12 +-
 .../Distribution/Solver/Modular/Validate.hs   |   5 +-
 bootstrap.sh                    |   6 +-
 cabal-install.cabal             |   4 +-
 cabal-install.cabal.pp          |   4 +-
 .../targets/complex/q/q.cabal                 |   3 +-
 cabal-testsuite/cabal-testsuite.cabal         |   4 +-
 validate.sh                                   |  21 +-
 35 files changed, 461 insertions(+), 169 deletions(-)
 create mode 100644 .docker/validate-8.10.1.dockerfile
diff --git a/Distribution/Client/CmdSdist.hs b/Distribution/Client/CmdSdist.hs
index 9ce0c80100e..a22317004c4 100644
--- a/Distribution/Client/CmdSdist.hs
+++ b/Distribution/Client/CmdSdist.hs
@@ -237,7 +237,10 @@ packageToSdist verbosity projectRootDir format outputFile pkg = do
         (norm NoExec -> nonexec, norm Exec -> exec) <-
            listPackageSources verbosity (flattenPackageDescription $ packageDescription pkg) knownSuffixHandlers
 
+        print $ map snd exec
+        print $ map snd nonexec
         let files =  nub . sortOn snd $ nonexec ++ exec
+        print files
 
         case format of
             SourceList nulSep -> do
diff --git a/Distribution/Client/FetchUtils.hs b/Distribution/Client/FetchUtils.hs
index e9a31a91f84..4e5e581f9ec 100644
--- a/Distribution/Client/FetchUtils.hs
+++ b/Distribution/Client/FetchUtils.hs
@@ -176,8 +176,8 @@ fetchRepoTarball verbosity' repoCtxt repo pkgid = do
     verbosity = verboseUnmarkOutput verbosity'
 
     downloadRepoPackage = case repo of
-      RepoLocal{..} -> return (packageFile repo pkgid)
-      RepoLocalNoIndex{..} -> return (packageFile repo pkgid)
+      RepoLocal{} -> return (packageFile repo pkgid)
+      RepoLocalNoIndex{} -> return (packageFile repo pkgid)
 
       RepoRemote{..} -> do
         transport <- repoContextGetTransport repoCtxt
diff --git a/Distribution/Client/IndexUtils.hs b/Distribution/Client/IndexUtils.hs
index a76becc05ba..bf0ff7cf5ba 100644
--- a/Distribution/Client/IndexUtils.hs
+++ b/Distribution/Client/IndexUtils.hs
@@ -634,7 +634,7 @@ withIndexEntries
     -> ([IndexCacheEntry] -> IO a)
     -> ([NoIndexCacheEntry] -> IO a)
     -> IO a
-withIndexEntries _ (RepoIndex repoCtxt repo@RepoSecure{..}) callback _ =
+withIndexEntries _ (RepoIndex repoCtxt repo@RepoSecure{}) callback _ =
     repoContextWithSecureRepo repoCtxt repo $ \repoSecure ->
       Sec.withIndex repoSecure $ \Sec.IndexCallbacks{..} -> do
         -- Incrementally (lazily) read all the entries in the tar file in order,
diff --git a/Distribution/Client/Sandbox.hs b/Distribution/Client/Sandbox.hs
index 66b415d7239..14bad3f2135 100644
--- a/Distribution/Client/Sandbox.hs
+++ b/Distribution/Client/Sandbox.hs
@@ -666,7 +666,7 @@ reinstallAddSourceDeps :: Verbosity
                           -> FilePath
                           -> IO WereDepsReinstalled
 reinstallAddSourceDeps verbosity configFlags' configExFlags
-                       installFlags globalFlags sandboxDir = topHandler' $ do
+                       installFlags globalFlags sandboxDir = topHandlerWith errorMsg $ do
   let sandboxDistPref     = sandboxBuildDir sandboxDir
       configFlags         = configFlags'
                             { configDistPref  = Flag sandboxDistPref }
@@ -710,7 +710,8 @@ reinstallAddSourceDeps verbosity configFlags' configExFlags
         ++ "offending packages or recreating the sandbox."
       logMsg message rest = debugNoWrap verbosity message >> rest
 
-      topHandler' = topHandlerWith $ \_ -> do
+      errorMsg :: a -> IO WereDepsReinstalled
+      errorMsg _ = do
         warn verbosity "Couldn't reinstall some add-source dependencies."
         -- Here we can't know whether any deps have been reinstalled, so we have
         -- to be conservative.
diff --git a/Distribution/Client/TargetSelector.hs b/Distribution/Client/TargetSelector.hs
index 23d92f580fd..f8f683d9875 100644
--- a/Distribution/Client/TargetSelector.hs
+++ b/Distribution/Client/TargetSelector.hs
@@ -222,7 +222,7 @@ readTargetSelectorsWith :: (Applicative m, Monad m) => DirActions m
                         -> Maybe ComponentKindFilter
                         -> [String]
                         -> m (Either [TargetSelectorProblem] [TargetSelector])
-readTargetSelectorsWith dirActions@DirActions{..} pkgs mfilter targetStrs =
+readTargetSelectorsWith dirActions@DirActions{} pkgs mfilter targetStrs =
     case parseTargetStrings targetStrs of
       ([], usertargets) -> do
         usertargets' <- mapM (getTargetStringFileStatus dirActions) usertargets
diff --git a/Distribution/Client/Update.hs b/Distribution/Client/Update.hs
index 52bb1f76c96..8ded78b9d2e 100644
--- a/Distribution/Client/Update.hs
+++ b/Distribution/Client/Update.hs
@@ -73,8 +73,8 @@ updateRepo :: Verbosity -> UpdateFlags -> RepoContext -> Repo -> IO ()
 updateRepo verbosity updateFlags repoCtxt repo = do
   transport <- repoContextGetTransport repoCtxt
   case repo of
-    RepoLocal{..} -> return ()
-    RepoLocalNoIndex{..} -> return ()
+    RepoLocal{} -> return ()
+    RepoLocalNoIndex{} -> return ()
     RepoRemote{..} -> do
       downloadResult <- downloadIndex transport verbosity repoRemote repoLocalDir
       case downloadResult of
diff --git a/Distribution/Client/Utils/Json.hs b/Distribution/Client/Utils/Json.hs
index 89a13af87a4..01d5753136b 100644
--- a/Distribution/Client/Utils/Json.hs
+++ b/Distribution/Client/Utils/Json.hs
@@ -15,12 +15,9 @@ module Distribution.Client.Utils.Json
     )
     where
 
-import Data.Char
-import Data.Int
-import Data.String
-import Data.Word
-import Data.List
-import Data.Monoid
+import Distribution.Client.Compat.Prelude
+
+import Data.Char (intToDigit)
 
 import Data.ByteString.Builder (Builder)
 import qualified Data.ByteString.Builder as BB
@@ -135,13 +132,13 @@ encodeArrayBB :: [Value] -> Builder
 encodeArrayBB [] = "[]"
 encodeArrayBB jvs = BB.char8 '[' <> go jvs <> BB.char8 ']'
   where
-    go = Data.Monoid.mconcat . intersperse (BB.char8 ',') . map encodeValueBB
+    go = mconcat . intersperse (BB.char8 ',') . map encodeValueBB
 
 encodeObjectBB :: Object -> Builder
 encodeObjectBB [] = "{}"
 encodeObjectBB jvs = BB.char8 '{' <> go jvs <> BB.char8 '}'
   where
-    go = Data.Monoid.mconcat . intersperse (BB.char8 ',') . map encPair
+    go = mconcat . intersperse (BB.char8 ',') . map encPair
     encPair (l,x) = encodeStringBB l <> BB.char8 ':' <> encodeValueBB x
 
 encodeStringBB :: String -> Builder
diff --git a/Distribution/Solver/Modular/Assignment.hs b/Distribution/Solver/Modular/Assignment.hs
index be5e63bfbc1..b05a099ec5a 100644
--- a/Distribution/Solver/Modular/Assignment.hs
+++ b/Distribution/Solver/Modular/Assignment.hs
@@ -9,10 +9,11 @@ module Distribution.Solver.Modular.Assignment
 import Prelude ()
 import Distribution.Solver.Compat.Prelude hiding (pi)
 
-import Data.Array as A
-import Data.List as L
-import Data.Map as M
-import Data.Maybe
+import qualified Data.Array as A
+import qualified Data.List as L
+import qualified Data.Map as M
+
+import Data.Maybe (fromJust)
 
 import Distribution.PackageDescription (FlagAssignment, mkFlagAssignment) -- from Cabal
 
@@ -79,7 +80,7 @@ toCPs (A pa fa sa) rdm =
     -- Dependencies per package.
     depp :: QPN -> [(Component, PI QPN)]
     depp qpn = let v :: Vertex
-                   v   = fromJust (cvm qpn)
+                   v   = fromJust (cvm qpn) -- TODO: why this is safe?
                    dvs :: [(Component, Vertex)]
                    dvs = tg A.! v
                in L.map (\ (comp, dv) -> case vm dv of (_, x, _) -> (comp, PI x (pa M.! x))) dvs
diff --git a/Distribution/Solver/Modular/Builder.hs b/Distribution/Solver/Modular/Builder.hs
index eb11a36aa16..5d196f4fd9f 100644
--- a/Distribution/Solver/Modular/Builder.hs
+++ b/Distribution/Solver/Modular/Builder.hs
@@ -19,10 +19,10 @@ module Distribution.Solver.Modular.Builder (
 -- flag-guarded dependencies, we cannot introduce them immediately. Instead, we
 -- store the entire dependency.
 
-import Data.List as L
-import Data.Map as M
-import Data.Set as S
-import Prelude hiding (sequence, mapM)
+import qualified Data.List as L
+import qualified Data.Map as M
+import qualified Data.Set as S
+import Prelude
 
 import qualified Distribution.Solver.Modular.ConflictSet as CS
 import Distribution.Solver.Modular.Dependency
@@ -55,7 +55,7 @@ data BuildState = BS {
 }
 
 -- | Map of available linking targets.
-type LinkingState = Map (PN, I) [PackagePath]
+type LinkingState = M.Map (PN, I) [PackagePath]
 
 -- | Extend the set of open goals with the new goals listed.
 --
diff --git a/Distribution/Solver/Modular/Index.hs b/Distribution/Solver/Modular/Index.hs
index fdddfc8237a..ac60fec7d65 100644
--- a/Distribution/Solver/Modular/Index.hs
+++ b/Distribution/Solver/Modular/Index.hs
@@ -6,10 +6,12 @@ module Distribution.Solver.Modular.Index
     , mkIndex
     ) where
 
-import Data.List as L
-import Data.Map as M
 import Prelude hiding (pi)
 
+import Data.Map (Map)
+import qualified Data.List as L
+import qualified Data.Map as M
+
 import Distribution.Solver.Modular.Dependency
 import Distribution.Solver.Modular.Flag
 import Distribution.Solver.Modular.Package
diff --git a/Distribution/Solver/Modular/IndexConversion.hs b/Distribution/Solver/Modular/IndexConversion.hs
index c9565c80dba..8e9ef614184 100644
--- a/Distribution/Solver/Modular/IndexConversion.hs
+++ b/Distribution/Solver/Modular/IndexConversion.hs
@@ -2,12 +2,12 @@ module Distribution.Solver.Modular.IndexConversion
     ( convPIs
     ) where
 
-import Data.List as L
+import qualified Data.List as L
 import Data.Map.Strict (Map)
 import qualified Data.Map.Strict as M
-import Data.Maybe
+import Data.Maybe (mapMaybe, fromMaybe, maybeToList)
 import Data.Monoid as Mon
-import Data.Set as S
+import qualified Data.Set as S
 
 import Distribution.Compiler
 import Distribution.InstalledPackageInfo as IPI
@@ -330,7 +330,7 @@ flagInfo (StrongFlags strfl) =
 
 -- | Internal package names, which should not be interpreted as true
 -- dependencies.
-type IPNs = Set PN
+type IPNs = S.Set PN
 
 -- | Convenience function to delete a 'Dependency' if it's
 -- for a 'PN' that isn't actually real.
diff --git a/Distribution/Solver/Modular/Solver.hs b/Distribution/Solver/Modular/Solver.hs
index 32452550556..e6aa1fb4374 100644
--- a/Distribution/Solver/Modular/Solver.hs
+++ b/Distribution/Solver/Modular/Solver.hs
@@ -9,9 +9,9 @@ module Distribution.Solver.Modular.Solver
     , PruneAfterFirstSuccess(..)
     ) where
 
-import Data.Map as M
-import Data.List as L
-import Data.Set as S
+import qualified Data.Map as M
+import qualified Data.List as L
+import qualified Data.Set as S
 import Distribution.Verbosity
 
 import Distribution.Compiler (CompilerInfo)
@@ -91,8 +91,8 @@ solve :: SolverConfig                         -- ^ solver parameters
       -> Index                                -- ^ all available packages as an index
       -> PkgConfigDb                          -- ^ available pkg-config pkgs
       -> (PN -> PackagePreferences)           -- ^ preferences
-      -> Map PN [LabeledPackageConstraint]    -- ^ global constraints
-      -> Set PN                               -- ^ global goals
+      -> M.Map PN [LabeledPackageConstraint]  -- ^ global constraints
+      -> S.Set PN                             -- ^ global goals
       -> RetryLog Message SolverFailure (Assignment, RevDepMap)
 solve sc cinfo idx pkgConfigDB userPrefs userConstraints userGoals =
   explorePhase     $
@@ -232,7 +232,7 @@ instance GSimpleTree (Tree d c) where
 
       -- Show conflict set
       goCS :: ConflictSet -> String
-      goCS cs = "{" ++ (intercalate "," . L.map showVar . CS.toList $ cs) ++ "}"
+      goCS cs = "{" ++ (L.intercalate "," . L.map showVar . CS.toList $ cs) ++ "}"
 #endif
 
 -- | Replace all goal reasons with a dummy goal reason in the tree
diff --git a/Distribution/Solver/Modular/Validate.hs b/Distribution/Solver/Modular/Validate.hs
index 6195d101b02..a3dec6e1f67 100644
--- a/Distribution/Solver/Modular/Validate.hs
+++ b/Distribution/Solver/Modular/Validate.hs
@@ -15,11 +15,12 @@ module Distribution.Solver.Modular.Validate (validateTree) where
 import Control.Applicative
 import Control.Monad.Reader hiding (sequence)
 import Data.Function (on)
-import Data.List as L
-import Data.Set as S
 import Data.Traversable
 import Prelude hiding (sequence)
 
+import qualified Data.List as L
+import qualified Data.Set as S
+
 import Language.Haskell.Extension (Extension, Language)
 
 import Data.Map.Strict as M
diff --git a/bootstrap.sh b/bootstrap.sh
index 077d7f4efd2..d5141660474 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -260,9 +260,9 @@ EDIT_DISTANCE_VER="0.2.2.1"; EDIT_DISTANCE_VER_REGEXP="0\.2\.2\.?"
                        # 0.2.2.*
 ED25519_VER="0.0.5.0"; ED25519_VER_REGEXP="0\.0\.?"
                        # 0.0.*
-HACKAGE_SECURITY_VER="0.6.0.0"; HACKAGE_SECURITY_VER_REGEXP="0\.6\."
-                       # >= 0.7.0.0 && < 0.7
-TAR_VER="0.5.1.0";     TAR_VER_REGEXP="0\.5\.([1-9]|1[0-9]|0\.[3-9]|0\.1[0-9])\.?"
+HACKAGE_SECURITY_VER="0.6.0.1"; HACKAGE_SECURITY_VER_REGEXP="0\.6\."
+                       # >= 0.6.0.0 && < 0.7
+TAR_VER="0.5.1.1";     TAR_VER_REGEXP="0\.5\.([1-9]|1[0-9]|0\.[3-9]|0\.1[0-9])\.?"
                        # >= 0.5.0.3  && < 0.6
 DIGEST_VER="0.0.1.2"; DIGEST_REGEXP="0\.0\.(1\.[2-9]|[2-9]\.?)"
                        # >= 0.0.1.2 && < 0.1
diff --git a/cabal-install.cabal b/cabal-install.cabal
index 985ea9a5a69..c9d713c29fe 100644
--- a/cabal-install.cabal
+++ b/cabal-install.cabal
@@ -316,7 +316,7 @@ executable cabal
     build-depends:
         async      >= 2.0      && < 2.3,
         array      >= 0.4      && < 0.6,
-        base       >= 4.8      && < 4.14,
+        base       >= 4.8      && < 4.15,
         base16-bytestring >= 0.1.1 && < 0.2,
         binary     >= 0.7.3    && < 0.9,
         bytestring >= 0.10.6.0 && < 0.11,
@@ -341,7 +341,7 @@ executable cabal
         time       >= 1.5.0.1  && < 1.10,
         transformers >= 0.4.2.0 && < 0.6,
         zlib       >= 0.5.3    && < 0.7,
-        hackage-security >= 0.6.0.0 && < 0.7,
+        hackage-security >= 0.6.0.1 && < 0.7,
         text       >= 1.2.3    && < 1.3,
         parsec     >= 3.1.13.0 && < 3.2
 
diff --git a/tests/IntegrationTests2/targets/complex/q/q.cabal b/tests/IntegrationTests2/targets/complex/q/q.cabal
index 556fa4a4202..7ee22fcb28d 100644
--- a/tests/IntegrationTests2/targets/complex/q/q.cabal
+++ b/tests/IntegrationTests2/targets/complex/q/q.cabal
@@ -5,7 +5,8 @@ cabal-version: >= 1.2
 
 library
   exposed-modules: Q
-  build-depends: base, filepath
+  -- we rely that filepath has filepath-tests component
+  build-depends: base, filepath >=1.4.0.0
 
 executable buildable-false
   main-is: Main.hs