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"
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
$ "install"
: ("--cabal-lib-version=" ++ libVersion)

View File

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

View File

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

View File

@ -97,7 +97,7 @@ runTestSuite settings testdir (packageName, SelectedPackageInfo {..}) = do
runGhcPackagePath = runGen True
passed <- handle (\TestException -> return False) $ do
package' <- replaceTarball settings package
package' <- replaceTarball (tarballDir settings) package
getHandle WriteMode $ run "cabal" ["unpack", package'] testdir
getHandle AppendMode $ run "cabal" (addCabalArgs settings BSTest ["configure", "--enable-tests"]) dir
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
-- instead of the given name.
replaceTarball :: BuildSettings
replaceTarball :: FilePath -- ^ tarball directory
-> String
-> IO String
replaceTarball bs pkgname = do
replaceTarball tarballdir pkgname = do
exists <- doesFileExist fp
if exists
then canonicalizePath fp
else return pkgname
where
fp = tarballDir bs </> pkgname <.> "tar.gz"
fp = tarballdir </> pkgname <.> "tar.gz"

View File

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