on master help sign in
Install build tools one at a time
commitf9999a5b5714415d80ecd4c0420cffb648f97780 authorMichael Snoyman <michael@snoyman.com> dateMon 28 Jan 2013, 14:40 (14 years ago) parente1d3714
1 file changed+15−12
Stackage/Build.hs+15−12
Stackage/Build.hs+15−12
@@ -44,11 +44,9 @@ build settings' bp = do
4444 let runCabal args handle = runProcess "cabal" args Nothing menv Nothing (Just handle) (Just handle)
4545
4646 -- First install build tools so they can be used below.
47− case bpTools bp of
48− [] -> putStrLn "No build tools required"
49− tools -> do
50− putStrLn $ "Installing the following build tools: " ++ unwords tools
51− ph1 <- withBinaryFile "build-tools.log" WriteMode $ \handle -> do
47+ let installBuildTool tool = do
48+ putStrLn $ "Installing build tool: " ++ tool
49+ ec <- withBinaryFile "build-tools.log" WriteMode $ \handle -> do
5250 let args = addCabalArgs settings
5351 $ "install"
5452 : ("--cabal-lib-version=" ++ libVersion)
@@ -56,15 +54,20 @@ build settings' bp = do
5654 : "-j"
5755 : concat
5856 [ extraArgs settings
59− , tools
57+ , [tool]
6058 ]
6159 hPutStrLn handle ("cabal " ++ unwords (map (\s -> "'" ++ s ++ "'") args))
62− runCabal args handle
63− ec2 <- waitForProcess ph1
64− unless (ec2 == ExitSuccess) $ do
65− putStrLn "Building of build tools failed, please see build-tools.log"
66− exitWith ec2
67− putStrLn "Build tools built"
60+ ph <- runCabal args handle
61+ waitForProcess ph
62+ unless (ec == ExitSuccess) $ do
63+ putStrLn $ concat
64+ [ "Building of "
65+ , tool
66+ , " failed, please see build-tools.log"
67+ ]
68+ exitWith ec
69+ putStrLn $ tool ++ " built"
70+ mapM_ installBuildTool $ bpTools bp
6871
6972 ph <- withBinaryFile "build.log" WriteMode $ \handle -> do
7073 let args = addCabalArgs settings