7import Distribution.Text (simpleParse)
8import Control.Monad (unless)
10import Stackage.CheckPlan
11import Stackage.InstallInfo
12import Stackage.Tarballs
16import System.Exit (ExitCode (ExitSuccess), exitWith)
17import System.IO (IOMode (WriteMode), withBinaryFile)
18import System.Process (runProcess, waitForProcess, rawSystem, readProcess)
19import System.Directory (createDirectoryIfMissing, canonicalizePath)
20import Distribution.Version (thisVersion, withinRange)
21import Control.Exception (assert)
23defaultBuildSettings :: BuildSettings
24defaultBuildSettings = BuildSettings
25 { sandboxRoot = "sandbox"
27 , extraCore = defaultExtraCore
28 , expectedFailures = defaultExpectedFailures
29 , stablePackages = defaultStablePackages
30 , extraArgs = ["-fnetwork23"]
33build :: BuildSettings -> IO ()
35 putStrLn "Creating a build plan"
36 ii <- getInstallInfo settings'
38 putStrLn "Wiping out old sandbox folder"
39 let root' = sandboxRoot settings'
42 createDirectoryIfMissing True root'
43 root <- canonicalizePath root'
44 let settings = settings' { sandboxRoot = root }
46 ec1 <- rawSystem "ghc-pkg" ["init", packageDir settings]
47 unless (ec1 == ExitSuccess) $ do
48 putStrLn "Unable to create package database via ghc-pkg init"
52 putStrLn "No mismatches, starting the sandboxed build."
54 versionString <- readProcess "cabal" ["--version"] ""
56 case map words $ lines versionString of
57 [_,["using","version",libVersion,"of","the","Cabal","library"]] -> return libVersion
58 _ -> error "Did not understand cabal --version output"
60 case (simpleParse libVersion, simpleParse ">= 1.16") of
61 (Nothing, _) -> error $ "Invalid Cabal library version: " ++ libVersion
62 (_, Nothing) -> assert False $ return ()
64 | v `withinRange` vr -> return ()
65 | otherwise -> error $ "Unsupported Cabal version: " ++ libVersion
67 ph <- withBinaryFile "build.log" WriteMode $ \handle ->
68 let args = addCabalArgs settings
70 : ("--cabal-lib-version=" ++ libVersion)
71 : "--build-log=logs/$pkg.log"
74 [ extraBuildArgs settings
78 in runProcess "cabal" args Nothing Nothing Nothing (Just handle) (Just handle)
79 ec <- waitForProcess ph
80 unless (ec == ExitSuccess) $ do
81 putStrLn "Build failed, please see build.log"
84 putStrLn "Sandbox built, beginning individual test suites"
85 runTestSuites settings ii
87 putStrLn "All test suites that were expected to pass did pass, building tarballs."
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list