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 ## 0.3.0.1
Pre-fetch all packages from Hackage to catch Hackage downtime early. Pre-fetch all packages from Hackage to catch Hackage downtime early.

View File

@ -5,6 +5,7 @@ module Stackage.CompleteBuild
( BuildType (..) ( BuildType (..)
, BumpType (..) , BumpType (..)
, completeBuild , completeBuild
, justCheck
) where ) where
import Data.Default.Class (def) import Data.Default.Class (def)
import Data.Semigroup (Max (..), Option (..)) import Data.Semigroup (Max (..), Option (..))
@ -129,6 +130,25 @@ renderLTSVer lts = fpFromText $ concat
, ".yaml" , ".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 -> IO ()
completeBuild buildType = withManager tlsManagerSettings $ \man -> do completeBuild buildType = withManager tlsManagerSettings $ \man -> do
hSetBuffering stdout LineBuffering hSetBuffering stdout LineBuffering

View File

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

View File

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