Skip to content

Commit e8a8287

Browse files
authored
Merge pull request #5766 from 23Skidoo/travis-fixes-from-2.4
[WIP] Port Travis fixes from the 2.4 branch
2 parents ec6966e + b4ea814 commit e8a8287

File tree

11 files changed

+132
-34
lines changed

11 files changed

+132
-34
lines changed

Cabal/Distribution/Compat/Directory.hs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@ makeAbsolute p | Path.isAbsolute p = return p
3838
#if !MIN_VERSION_directory(1,2,7)
3939

4040
doesPathExist :: FilePath -> IO Bool
41-
doesPathExist path = (||) <$> doesDirectoryExist path <*> doesFileExist path
41+
doesPathExist path = do
42+
-- not using Applicative, as this way we can do less IO
43+
e <- doesDirectoryExist path
44+
if e
45+
then return True
46+
else doesFileExist path
4247

4348
#endif
4449

cabal-install/cabal-install.cabal

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -305,31 +305,31 @@ executable cabal
305305
Paths_cabal_install
306306

307307
build-depends:
308-
async >= 2.0 && < 3,
308+
async >= 2.0 && < 2.3,
309309
array >= 0.4 && < 0.6,
310-
base >= 4.6 && < 5,
310+
base >= 4.8 && < 4.13,
311311
base16-bytestring >= 0.1.1 && < 0.2,
312-
binary >= 0.7 && < 0.9,
313-
bytestring >= 0.10.2 && < 1,
312+
binary >= 0.7.3 && < 0.9,
313+
bytestring >= 0.10.6.0 && < 0.11,
314314
Cabal == 2.5.*,
315-
containers >= 0.5 && < 0.7,
315+
containers >= 0.5.6.2 && < 0.7,
316316
cryptohash-sha256 >= 0.11 && < 0.12,
317-
deepseq >= 1.3 && < 1.5,
317+
deepseq >= 1.4.1.1 && < 1.5,
318318
directory >= 1.2.2.0 && < 1.4,
319319
echo >= 0.1.3 && < 0.2,
320320
edit-distance >= 0.2.2 && < 0.3,
321-
filepath >= 1.3 && < 1.5,
322-
hashable >= 1.0 && < 2,
321+
filepath >= 1.4.0.0 && < 1.5,
322+
hashable >= 1.0 && < 1.3,
323323
HTTP >= 4000.1.5 && < 4000.4,
324-
mtl >= 2.0 && < 3,
324+
mtl >= 2.0 && < 2.3,
325325
network-uri >= 2.6.0.2 && < 2.7,
326326
network >= 2.6 && < 2.9,
327327
pretty >= 1.1 && < 1.2,
328-
process >= 1.1.0.2 && < 1.7,
328+
process >= 1.2.3.0 && < 1.7,
329329
random >= 1 && < 1.2,
330-
stm >= 2.0 && < 3,
330+
stm >= 2.0 && < 2.6,
331331
tar >= 0.5.0.3 && < 0.6,
332-
time >= 1.4 && < 1.10,
332+
time >= 1.5.0.1 && < 1.10,
333333
zlib >= 0.5.3 && < 0.7,
334334
hackage-security >= 0.5.2.2 && < 0.6,
335335
text >= 1.2.3 && < 1.3,

cabal-install/cabal-install.cabal.pp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,31 @@
1616
#
1717
%def CABAL_BUILDDEPENDS
1818
build-depends:
19-
async >= 2.0 && < 3,
19+
async >= 2.0 && < 2.3,
2020
array >= 0.4 && < 0.6,
21-
base >= 4.6 && < 5,
21+
base >= 4.8 && < 4.13,
2222
base16-bytestring >= 0.1.1 && < 0.2,
23-
binary >= 0.7 && < 0.9,
24-
bytestring >= 0.10.2 && < 1,
23+
binary >= 0.7.3 && < 0.9,
24+
bytestring >= 0.10.6.0 && < 0.11,
2525
Cabal == 2.5.*,
26-
containers >= 0.5 && < 0.7,
26+
containers >= 0.5.6.2 && < 0.7,
2727
cryptohash-sha256 >= 0.11 && < 0.12,
28-
deepseq >= 1.3 && < 1.5,
28+
deepseq >= 1.4.1.1 && < 1.5,
2929
directory >= 1.2.2.0 && < 1.4,
3030
echo >= 0.1.3 && < 0.2,
3131
edit-distance >= 0.2.2 && < 0.3,
32-
filepath >= 1.3 && < 1.5,
33-
hashable >= 1.0 && < 2,
32+
filepath >= 1.4.0.0 && < 1.5,
33+
hashable >= 1.0 && < 1.3,
3434
HTTP >= 4000.1.5 && < 4000.4,
35-
mtl >= 2.0 && < 3,
35+
mtl >= 2.0 && < 2.3,
3636
network-uri >= 2.6.0.2 && < 2.7,
3737
network >= 2.6 && < 2.9,
3838
pretty >= 1.1 && < 1.2,
39-
process >= 1.1.0.2 && < 1.7,
39+
process >= 1.2.3.0 && < 1.7,
4040
random >= 1 && < 1.2,
41-
stm >= 2.0 && < 3,
41+
stm >= 2.0 && < 2.6,
4242
tar >= 0.5.0.3 && < 0.6,
43-
time >= 1.4 && < 1.10,
43+
time >= 1.5.0.1 && < 1.10,
4444
zlib >= 0.5.3 && < 0.7,
4545
hackage-security >= 0.5.2.2 && < 0.6,
4646
text >= 1.2.3 && < 1.3,

cabal-testsuite/PackageTests/Exec/sandbox-hc-pkg.test.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import Test.Cabal.Prelude
22
import Data.Maybe
3-
import System.Directory
3+
import Distribution.Compat.Directory
44
import Control.Monad.IO.Class
5+
56
main = cabalTest $ do
67
withPackageDb $ do
78
withSandbox $ do

cabal-testsuite/Test/Cabal/Server.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,15 @@ initServer s0 = do
254254
#else
255255
pid <- withProcessHandle (serverProcessHandle s0) $ \ph ->
256256
case ph of
257+
#if MIN_VERSION_process(1,2,0)
257258
OpenHandle x -> return (show x)
258259
-- TODO: handle OpenExtHandle?
259260
_ -> return (serverProcessId s0)
261+
#else
262+
OpenHandle x -> return (ph, show x)
263+
-- TODO: handle OpenExtHandle?
264+
_ -> return (ph, serverProcessId s0)
265+
#endif
260266
#endif
261267
let s = s0 { serverProcessId = pid }
262268
-- We will read/write a line at a time, including for

cabal-testsuite/main/cabal-tests.hs

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{-# LANGUAGE CPP #-}
12
{-# LANGUAGE NondecreasingIndentation #-}
23
{-# LANGUAGE PatternGuards #-}
34
{-# LANGUAGE ScopedTypeVariables #-}
@@ -20,13 +21,25 @@ import Control.Monad
2021
import qualified Control.Exception as E
2122
import GHC.Conc (numCapabilities)
2223
import Data.List
23-
import Data.Monoid (mempty, (<>))
2424
import Text.Printf
2525
import qualified System.Clock as Clock
2626
import System.IO
2727
import System.FilePath
2828
import System.Exit
29-
import System.Process (callProcess, showCommandForUser)
29+
import System.Process (
30+
#if MIN_VERSION_process(1,2,0)
31+
callProcess,
32+
#else
33+
proc, createProcess, waitForProcess, terminateProcess,
34+
#endif
35+
showCommandForUser)
36+
37+
#if !MIN_VERSION_base(4,12,0)
38+
import Data.Monoid ((<>))
39+
#endif
40+
#if !MIN_VERSION_base(4,8,0)
41+
import Data.Monoid (mempty)
42+
#endif
3043

3144
-- | Record for arguments that can be passed to @cabal-tests@ executable.
3245
data MainArgs = MainArgs {
@@ -298,3 +311,20 @@ getTime = do
298311
t <- Clock.getTime Clock.Monotonic
299312
let ns = realToFrac $ Clock.toNanoSecs t
300313
return $ ns / 10 ^ (9 :: Int)
314+
315+
-------------------------------------------------------------------------------
316+
-- compat
317+
-------------------------------------------------------------------------------
318+
319+
#if !MIN_VERSION_process(1,2,0)
320+
callProcess :: FilePath -> [String] -> IO ()
321+
callProcess cmd args = do
322+
exit_code <- bracket (createProcess (proc cmd args)) cleanupProcess
323+
$ \(_, _, _, ph) -> waitForProcess ph
324+
case exit_code of
325+
ExitSuccess -> return ()
326+
ExitFailure r -> fail $ "processFailedException " ++ show (cmd, args, r)
327+
where
328+
cleanupProcess (_, _, _, ph) = terminateProcess ph
329+
330+
#endif

cabal.project

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
packages: Cabal/ cabal-testsuite/ cabal-install/ solver-benchmarks/ pretty-show-1.6.16/
2-
constraints: unix >= 2.7.1.0
32

43
-- Uncomment to allow picking up extra local unpacked deps:
54
--optional-packages: */

cabal.project.local.travis

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
-- Force error messages to be better
2+
-- Parallel new-build error messages are non-existent.
3+
-- Turn off parallelization to get good errors.
4+
jobs: 1
5+
6+
-- We vendor a copy of hackage-repo-tool so that we can
7+
-- build it reliably. If we eventually get new-install
8+
-- in the bootstrap, this can go away.
9+
optional-packages: hackage-repo-tool-*/
10+
-- hackage-repo-tool has upper bound on time
11+
allow-newer: hackage-repo-tool:time
12+
13+
-- The -fno-warn-orphans is a hack to make Cabal-1.24
14+
-- build properly (unfortunately the flags here get applied
15+
-- to the dependencies too!)
16+
package Cabal
17+
ghc-options: -Werror -fno-warn-orphans
18+
19+
constraints:
20+
binary installed,
21+
bytestring installed,
22+
containers installed,
23+
deepseq installed,
24+
directory installed,
25+
filepath installed,
26+
pretty installed,
27+
process installed,
28+
time installed,
29+
unix installed
30+
31+
package cabal-install
32+
ghc-options: -Werror

cabal.project.travis.libonly

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
-- A copy of cabal.project, but with a trimmed down 'packages'
2+
-- field. Needed for LIB_ONLY configurations that can't build cabal-install,
3+
-- only lib:Cabal.
4+
5+
packages: Cabal/ cabal-testsuite/
6+
7+
-- Uncomment to allow picking up extra local unpacked deps:
8+
--optional-packages: */
9+
10+
program-options
11+
-- So us hackers get all the assertion failures early:
12+
--
13+
-- NOTE: currently commented out, see
14+
-- https://github.com/haskell/cabal/issues/3911
15+
--
16+
-- ghc-options: -fno-ignore-asserts
17+
--
18+
-- as a workaround we specify it for each package individually:
19+
package Cabal
20+
ghc-options: -fno-ignore-asserts
21+
package cabal-testsuite
22+
ghc-options: -fno-ignore-asserts
23+
package cabal-install
24+
ghc-options: -fno-ignore-asserts

cabal.project.validate

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
packages: Cabal/ cabal-testsuite/ cabal-install/
1+
packages: Cabal/ cabal-testsuite/
22

33
package Cabal
44
ghc-options: -Werror -fno-ignore-asserts
55
package cabal-testsuite
66
ghc-options: -Werror -fno-ignore-asserts
7-
package cabal-install
8-
ghc-options: -Werror -fno-ignore-asserts

travis-script.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,13 @@ timed cabal update
8282
# ---------------------------------------------------------------------
8383

8484
make cabal-install-monolithic
85-
cp cabal.project.travis cabal.project.local
85+
if [ "x$CABAL_LIB_ONLY" = "xYES" ]; then
86+
cp cabal.project.travis.libonly cabal.project
87+
fi
88+
cp cabal.project.local.travis cabal.project.local
8689

8790
# hackage-repo-tool is a bit touchy to install on GHC 8.0, so instead we
88-
# do it via new-build. See also cabal.project.travis. The downside of
91+
# do it via new-build. See also cabal.project.local.travis. The downside of
8992
# doing it this way is that the build product cannot be cached, but
9093
# hackage-repo-tool is a relatively small package so it's good.
9194
timed cabal unpack hackage-repo-tool-${HACKAGE_REPO_TOOL_VERSION}

0 commit comments

Comments
 (0)