mirror of
https://github.com/commercialhaskell/stackage.git
synced 2026-01-11 23:08:30 +01:00
More fixes for #35
This commit is contained in:
parent
7de4bb6cb0
commit
c46a308724
@ -41,7 +41,6 @@ defaultBuildSettings = BuildSettings
|
||||
|
||||
build :: BuildSettings -> BuildPlan -> IO ()
|
||||
build settings' bp = do
|
||||
putStrLn "Checking Cabal version"
|
||||
libVersion <- checkCabalVersion
|
||||
|
||||
putStrLn "Wiping out old sandbox folder"
|
||||
|
||||
@ -11,7 +11,6 @@ import qualified Data.Set as Set
|
||||
import Distribution.Text (simpleParse)
|
||||
import Distribution.Version (withinRange)
|
||||
import Prelude hiding (pi)
|
||||
import Stackage.CheckPlan
|
||||
import Stackage.Config
|
||||
import Stackage.InstallInfo
|
||||
import Stackage.Tarballs
|
||||
@ -29,6 +28,7 @@ import System.Process (rawSystem, readProcess, runProcess,
|
||||
|
||||
checkCabalVersion :: IO String
|
||||
checkCabalVersion = do
|
||||
putStrLn "Checking Cabal version"
|
||||
versionString <- readProcess "cabal" ["--version"] ""
|
||||
libVersion <-
|
||||
case map words $ lines versionString of
|
||||
@ -36,10 +36,10 @@ checkCabalVersion = do
|
||||
_ -> error "Did not understand cabal --version output"
|
||||
|
||||
case (simpleParse libVersion, simpleParse ">= 1.16") of
|
||||
(Nothing, _) -> error $ "Invalid Cabal library version: " ++ libVersion
|
||||
(Nothing, _) -> error $ "cabal binary reported an invalid Cabal library version: " ++ libVersion
|
||||
(_, Nothing) -> assert False $ return ()
|
||||
(Just v, Just vr)
|
||||
| v `withinRange` vr -> return ()
|
||||
| otherwise -> error $ "Unsupported Cabal library version: " ++ libVersion
|
||||
| otherwise -> error $ "cabal binary build against unsupported Cabal library version: " ++ libVersion
|
||||
|
||||
return libVersion
|
||||
|
||||
@ -12,12 +12,15 @@ import Stackage.Util
|
||||
import System.Exit (ExitCode (ExitFailure, ExitSuccess),
|
||||
exitWith)
|
||||
import System.Process (readProcessWithExitCode)
|
||||
import Stackage.CheckCabalVersion (checkCabalVersion)
|
||||
|
||||
data Mismatch = OnlyDryRun String | OnlySimpleList String
|
||||
deriving Show
|
||||
|
||||
checkPlan :: BuildPlan -> IO ()
|
||||
checkPlan bp = do
|
||||
_ <- checkCabalVersion
|
||||
|
||||
putStrLn "Checking build plan"
|
||||
(ec, dryRun', stderr) <- readProcessWithExitCode "cabal" (addCabalArgsOnlyGlobal $ "install":"--dry-run":bpPackageList bp) ""
|
||||
when (ec /= ExitSuccess || "Warning:" `isPrefixOf` stderr) $ do
|
||||
|
||||
Loading…
Reference in New Issue
Block a user