Install build tools one at a time

This commit is contained in:
Michael Snoyman 2013-01-28 14:40:07 +02:00
parent e1d3714e8c
commit f9999a5b57

View File

@ -44,11 +44,9 @@ build settings' bp = do
let runCabal args handle = runProcess "cabal" args Nothing menv Nothing (Just handle) (Just handle) let runCabal args handle = runProcess "cabal" args Nothing menv Nothing (Just handle) (Just handle)
-- First install build tools so they can be used below. -- First install build tools so they can be used below.
case bpTools bp of let installBuildTool tool = do
[] -> putStrLn "No build tools required" putStrLn $ "Installing build tool: " ++ tool
tools -> do ec <- withBinaryFile "build-tools.log" WriteMode $ \handle -> do
putStrLn $ "Installing the following build tools: " ++ unwords tools
ph1 <- withBinaryFile "build-tools.log" WriteMode $ \handle -> do
let args = addCabalArgs settings let args = addCabalArgs settings
$ "install" $ "install"
: ("--cabal-lib-version=" ++ libVersion) : ("--cabal-lib-version=" ++ libVersion)
@ -56,15 +54,20 @@ build settings' bp = do
: "-j" : "-j"
: concat : concat
[ extraArgs settings [ extraArgs settings
, tools , [tool]
] ]
hPutStrLn handle ("cabal " ++ unwords (map (\s -> "'" ++ s ++ "'") args)) hPutStrLn handle ("cabal " ++ unwords (map (\s -> "'" ++ s ++ "'") args))
runCabal args handle ph <- runCabal args handle
ec2 <- waitForProcess ph1 waitForProcess ph
unless (ec2 == ExitSuccess) $ do unless (ec == ExitSuccess) $ do
putStrLn "Building of build tools failed, please see build-tools.log" putStrLn $ concat
exitWith ec2 [ "Building of "
putStrLn "Build tools built" , tool
, " failed, please see build-tools.log"
]
exitWith ec
putStrLn $ tool ++ " built"
mapM_ installBuildTool $ bpTools bp
ph <- withBinaryFile "build.log" WriteMode $ \handle -> do ph <- withBinaryFile "build.log" WriteMode $ \handle -> do
let args = addCabalArgs settings let args = addCabalArgs settings