More replacement tarball tweaks

This commit is contained in:
Michael Snoyman 2013-09-01 13:20:40 +03:00
parent 529a846188
commit f8d7858fb8
6 changed files with 11 additions and 10 deletions

View File

@ -81,7 +81,7 @@ build settings' bp = do
putStrLn "Beginning Stackage build" putStrLn "Beginning Stackage build"
ph <- withBinaryFile "build.log" WriteMode $ \handle -> do ph <- withBinaryFile "build.log" WriteMode $ \handle -> do
packageList <- mapM (replaceTarball settings) $ bpPackageList bp packageList <- mapM (replaceTarball $ tarballDir settings) $ bpPackageList bp
let args = addCabalArgs settings BSBuild let args = addCabalArgs settings BSBuild
$ "install" $ "install"
: ("--cabal-lib-version=" ++ libVersion) : ("--cabal-lib-version=" ++ libVersion)

View File

@ -17,18 +17,19 @@ import System.Process (readProcessWithExitCode)
data Mismatch = OnlyDryRun String | OnlySimpleList String data Mismatch = OnlyDryRun String | OnlySimpleList String
deriving Show deriving Show
checkPlan :: BuildPlan -> IO () checkPlan :: BuildSettings -> BuildPlan -> IO ()
checkPlan bp = do checkPlan settings bp = do
_ <- checkCabalVersion _ <- checkCabalVersion
putStrLn "Checking build plan" putStrLn "Checking build plan"
packages <- mapM (replaceTarball $ tarballDir settings) (bpPackageList bp)
(ec, dryRun', stderr) <- readProcessWithExitCode "cabal" (ec, dryRun', stderr) <- readProcessWithExitCode "cabal"
( addCabalArgsOnlyGlobal ( addCabalArgsOnlyGlobal
$ "install" $ "install"
: "--dry-run" : "--dry-run"
: "--max-backjumps=-1" : "--max-backjumps=-1"
: "--reorder-goals" : "--reorder-goals"
: bpPackageList bp : packages
) "" ) ""
when (ec /= ExitSuccess || "Warning:" `isPrefixOf` stderr) $ do when (ec /= ExitSuccess || "Warning:" `isPrefixOf` stderr) $ do
putStr stderr putStr stderr

View File

@ -44,7 +44,7 @@ defaultSelectSettings version = SelectSettings
, useGlobalDatabase = False , useGlobalDatabase = False
, skippedTests = empty , skippedTests = empty
, selectGhcVersion = version , selectGhcVersion = version
, selectTarballDir = "tarballs" , selectTarballDir = "patching/tarballs"
} }
select :: SelectSettings -> IO BuildPlan select :: SelectSettings -> IO BuildPlan

View File

@ -97,7 +97,7 @@ runTestSuite settings testdir (packageName, SelectedPackageInfo {..}) = do
runGhcPackagePath = runGen True runGhcPackagePath = runGen True
passed <- handle (\TestException -> return False) $ do passed <- handle (\TestException -> return False) $ do
package' <- replaceTarball settings package package' <- replaceTarball (tarballDir settings) package
getHandle WriteMode $ run "cabal" ["unpack", package'] testdir getHandle WriteMode $ run "cabal" ["unpack", package'] testdir
getHandle AppendMode $ run "cabal" (addCabalArgs settings BSTest ["configure", "--enable-tests"]) dir getHandle AppendMode $ run "cabal" (addCabalArgs settings BSTest ["configure", "--enable-tests"]) dir
when spiHasTests $ do when spiHasTests $ do

View File

@ -158,13 +158,13 @@ fixBuildSettings settings' = do
-- | Check if a tarball exists in the tarball directory and, if so, use that -- | Check if a tarball exists in the tarball directory and, if so, use that
-- instead of the given name. -- instead of the given name.
replaceTarball :: BuildSettings replaceTarball :: FilePath -- ^ tarball directory
-> String -> String
-> IO String -> IO String
replaceTarball bs pkgname = do replaceTarball tarballdir pkgname = do
exists <- doesFileExist fp exists <- doesFileExist fp
if exists if exists
then canonicalizePath fp then canonicalizePath fp
else return pkgname else return pkgname
where where
fp = tarballDir bs </> pkgname <.> "tar.gz" fp = tarballdir </> pkgname <.> "tar.gz"

View File

@ -100,7 +100,7 @@ main = do
, useGlobalDatabase = globalDB , useGlobalDatabase = globalDB
} }
writeBuildPlan buildPlanDest bp writeBuildPlan buildPlanDest bp
("check":rest) -> withBuildSettings rest $ const checkPlan ("check":rest) -> withBuildSettings rest checkPlan
("build":rest) -> withBuildSettings rest build ("build":rest) -> withBuildSettings rest build
("test":rest) -> withBuildSettings rest runTestSuites ("test":rest) -> withBuildSettings rest runTestSuites
("tarballs":rest) -> withBuildSettings rest $ const makeTarballs ("tarballs":rest) -> withBuildSettings rest $ const makeTarballs