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