stackage check

This commit is contained in:
Michael Snoyman 2014-12-25 19:14:05 +02:00
parent 203ba99ed9
commit 4396bed20c
4 changed files with 30 additions and 5 deletions

View File

@ -1,3 +1,7 @@
## 0.3.1
* Added `justCheck` and `stackage check` command line.
## 0.3.0.1
Pre-fetch all packages from Hackage to catch Hackage downtime early.

View File

@ -5,6 +5,7 @@ module Stackage.CompleteBuild
( BuildType (..)
, BumpType (..)
, completeBuild
, justCheck
) where
import Data.Default.Class (def)
import Data.Semigroup (Max (..), Option (..))
@ -129,6 +130,25 @@ renderLTSVer lts = fpFromText $ concat
, ".yaml"
]
-- | Generate and check a new build plan, but do not execute it.
--
-- Since 0.3.1
justCheck :: IO ()
justCheck = withManager tlsManagerSettings $ \man -> do
putStrLn "Loading build constraints"
bc <- defaultBuildConstraints man
putStrLn "Creating build plan"
plan <- newBuildPlan bc
putStrLn $ "Writing build plan to check-plan.yaml"
encodeFile "check-plan.yaml" plan
putStrLn "Checking plan"
checkBuildPlan plan
putStrLn "Plan seems valid!"
completeBuild :: BuildType -> IO ()
completeBuild buildType = withManager tlsManagerSettings $ \man -> do
hSetBuffering stdout LineBuffering

View File

@ -5,11 +5,12 @@ main :: IO ()
main = do
args <- getArgs
case args of
[x] | Just y <- lookup x m -> completeBuild y
[x] | Just y <- lookup x m -> y
_ -> error $ "Expected one argument, one of: " ++ unwords (map fst m)
where
m =
[ ("nightly", Nightly)
, ("lts-major", LTS Major)
, ("lts-minor", LTS Minor)
[ ("nightly", completeBuild Nightly)
, ("lts-major", completeBuild $ LTS Major)
, ("lts-minor", completeBuild $ LTS Minor)
, ("check", justCheck)
]

View File

@ -1,5 +1,5 @@
name: stackage
version: 0.3.0.1
version: 0.3.1
synopsis: "Stable Hackage," tools for creating a vetted set of packages from Hackage.
description: Please see <http://www.stackage.org/package/stackage> for a description and documentation.
homepage: https://github.com/fpco/stackage