Bring test suite up to date
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
module CabalHelper.Common where
|
||||
|
||||
import Control.Applicative
|
||||
import Control.Exception
|
||||
import Control.Exception as E
|
||||
import Control.Monad
|
||||
import Data.List
|
||||
import Data.Maybe
|
||||
@@ -40,7 +40,7 @@ panic msg = throw $ Panic msg
|
||||
|
||||
handlePanic :: IO a -> IO a
|
||||
handlePanic action =
|
||||
action `catch` \(Panic msg) -> errMsg msg >> exitFailure
|
||||
action `E.catch` \(Panic msg) -> errMsg msg >> exitFailure
|
||||
|
||||
errMsg :: String -> IO ()
|
||||
errMsg str = do
|
||||
|
||||
@@ -114,7 +114,7 @@ main = do
|
||||
errMsg $ "distdir '"++distdir++"' does not exist"
|
||||
exitFailure
|
||||
|
||||
v <- maybe silent (const deafening) <$> lookupEnv "GHC_MOD_DEBUG"
|
||||
v <- maybe silent (const deafening) . lookup "GHC_MOD_DEBUG" <$> getEnvironment
|
||||
lbi <- unsafeInterleaveIO $ getPersistBuildConfig distdir
|
||||
let pd = localPkgDescr lbi
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ module Main where
|
||||
|
||||
import Control.Applicative
|
||||
import Control.Arrow
|
||||
import Control.Exception as E
|
||||
import Control.Monad
|
||||
import Control.Monad.Trans.Maybe
|
||||
import Data.Char
|
||||
@@ -133,7 +134,8 @@ compileHelper cabalVer = do
|
||||
else do
|
||||
-- otherwise compile the requested cabal version into an isolated
|
||||
-- package-db
|
||||
db <- installCabal cabalVer
|
||||
db <- installCabal cabalVer `E.catch`
|
||||
\(SomeException _) -> errorInstallCabal cabalVer
|
||||
compileWithPkg chdir (Just db)
|
||||
Just _ ->
|
||||
compileWithPkg chdir Nothing
|
||||
@@ -149,12 +151,27 @@ compileHelper cabalVer = do
|
||||
|
||||
-- errorNoCabal :: Version -> a
|
||||
-- errorNoCabal cabalVer = panic $ printf "\
|
||||
-- \No appropriate Cabal package found, wanted version %s.\n\
|
||||
-- \- Check output of: $ ghc-pkg list Cabal\n\
|
||||
-- \- Maybe try: $ cabal install Cabal --constraint 'Cabal == %s'" sver sver
|
||||
-- \No appropriate Cabal package found, wanted version %s.\n"
|
||||
-- where
|
||||
-- sver = showVersion cabalVer
|
||||
|
||||
errorInstallCabal :: Version -> a
|
||||
errorInstallCabal cabalVer = panic $ printf "\
|
||||
\Installing Cabal version %s failed.\n\
|
||||
\n\
|
||||
\You have two choices now:\n\
|
||||
\- Either you install this version of Cabal in your globa/luser package-db\n\
|
||||
\ somehow\n\
|
||||
\n\
|
||||
\- Or you can see if you can update your cabal-install to use a different\n\
|
||||
\ version of the Cabal library that we can build with:\n\
|
||||
\ $ cabal install cabal-install --constraint 'Cabal > %s'\n\
|
||||
\n\
|
||||
\To check the version cabal-install is currently using try:\n\
|
||||
\ $ cabal --version\n" sver sver
|
||||
where
|
||||
sver = showVersion cabalVer
|
||||
|
||||
errorNoMain :: FilePath -> a
|
||||
errorNoMain datadir = panic $ printf "\
|
||||
\Could not find $datadir/CabalHelper/Main.hs!\n\
|
||||
|
||||
Reference in New Issue
Block a user