packages feed

stackage-curator 0.7.0.2 → 0.7.0.3

raw patch · 4 files changed

+44/−9 lines, 4 files

Files

ChangeLog.md view
@@ -1,3 +1,7 @@+## 0.7.0.3++* LTS bumps: specify a goal+ ## 0.7.0.2  * Deal better with invariant violations around unregistered packages
Stackage/CompleteBuild.hs view
@@ -1,6 +1,7 @@-{-# LANGUAGE NoImplicitPrelude #-}-{-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE RecordWildCards   #-}+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE NoImplicitPrelude  #-}+{-# LANGUAGE OverloadedStrings  #-}+{-# LANGUAGE RecordWildCards    #-} module Stackage.CompleteBuild     ( BuildType (..)     , BumpType (..)@@ -45,7 +46,7 @@     , bfBuildHoogle      :: !Bool     } deriving (Show) -data BuildType = Nightly | LTS BumpType+data BuildType = Nightly | LTS BumpType Text     deriving (Show, Read, Eq, Ord)  data BumpType = Major | Minor@@ -93,6 +94,20 @@   where     slug' = "nightly-" ++ day +parseGoal :: MonadThrow m => Text -> m (LTSVer -> Bool)+parseGoal "" = return $ const True+parseGoal t =+    case decimal t of+        Right (major, "") -> return $ \(LTSVer major' _) -> major' <= major+        _ ->+            case parseLTSRaw t of+                Nothing -> throwM $ ParseGoalFailure t+                Just x -> return (< x)++data ParseGoalFailure = ParseGoalFailure Text+    deriving (Show, Typeable)+instance Exception ParseGoalFailure+ getSettings :: Manager -> BuildType -> IO Settings getSettings man Nightly = do     day <- tshow . utctDay <$> getCurrentTime@@ -100,10 +115,13 @@     pkgs <- getLatestAllowedPlans bc     plan' <- newBuildPlan pkgs bc     return $ nightlySettings day plan'-getSettings man (LTS bumpType) = do+getSettings man (LTS bumpType goal) = do+    matchesGoal <- parseGoal goal     Option mlts <- fmap (fmap getMax) $ runResourceT         $ sourceDirectory "."-       $$ foldMapC (Option . fmap Max . parseLTSVer . filename)+       $= concatMapC (parseLTSVer . filename)+       $= filterC matchesGoal+       $$ foldMapC (Option . Just . Max)      (new, plan') <- case bumpType of         Major -> do@@ -167,10 +185,15 @@ parseLTSVer fp = do     w <- stripPrefix "lts-" $ fpToText fp     x <- stripSuffix ".yaml" w+    parseLTSRaw x++parseLTSRaw :: Text -> Maybe LTSVer+parseLTSRaw x = do     Right (major, y) <- Just $ decimal x     z <- stripPrefix "." y     Right (minor, "") <- Just $ decimal z     return $ LTSVer major minor+ renderLTSVer :: LTSVer -> FilePath renderLTSVer lts = fpFromText $ concat     [ "lts-"
app/stackage.hs view
@@ -44,12 +44,12 @@                   "Build, test and upload the Nightly snapshot"             , cmnd                   (uncurry completeBuild)-                  (fmap (LTS Major, ) buildFlags)+                  (lts Major)                   "lts-major"                   "Build, test and upload the LTS (major) snapshot"             , cmnd                   (uncurry completeBuild)-                  (fmap (LTS Minor, ) buildFlags)+                  (lts Minor)                   "lts-minor"                   "Build, test and upload the LTS (minor) snapshot"             , cmnd@@ -208,3 +208,11 @@                  metavar "SERVER-URL" <>                  showDefault <> value (T.unpack $ unStackageServer def) <>                  help "Server to upload bundle to")++    lts bumpType = (\x y -> (y, x)) -- get the order of arguments correct+        <$> buildFlags+        <*> (LTS bumpType <$> (T.pack <$> argument str+                ( metavar "TARGET-VERSION"+               <> help "Used to run old LTS minor bumps, and rerun broken builds"+               <> value ""+                ) ) )
stackage-curator.cabal view
@@ -1,5 +1,5 @@ name:                stackage-curator-version:             0.7.0.2+version:             0.7.0.3 synopsis:            Tools for curating Stackage bundles description:         Please see <http://www.stackage.org/package/stackage-curator> for a description and documentation. homepage:            https://github.com/fpco/stackage