Version LTS file

This commit is contained in:
Adam Bergmark 2023-12-22 14:40:41 +01:00 committed by Jens Petersen
parent 7b7c7be134
commit 821abc97ef
3 changed files with 20 additions and 6 deletions

View File

@ -2,11 +2,18 @@
# Convenience script for checking constraints locally # Convenience script for checking constraints locally
set -euxo pipefail
cd `dirname $0` cd `dirname $0`
export GHCVER=$(sed -n "s/^ghc-version: \"\(.*\)\"/\1/p" "lts-build-constraints.yaml") MAJOR=$1
MINOR=$2
LTS="lts-$MAJOR.$MINOR"
echo "$MAJOR $MINOR $LTS"
export GHCVER=$(sed -n "s/^ghc-version: \"\(.*\)\"/\1/p" "lts-$MAJOR-build-constraints.yaml")
LTS="lts-$@"
curator update && curator update &&
curator constraints --target=$LTS && curator constraints --target=$LTS &&
curator snapshot-incomplete --target=$LTS && curator snapshot-incomplete --target=$LTS &&

View File

@ -1,5 +1,6 @@
{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# OPTIONS -Wno-name-shadowing #-} {-# OPTIONS -Wno-name-shadowing #-}
module Main (main) where module Main (main) where
@ -11,6 +12,8 @@ import RIO.Map (Map)
import System.IO (openFile, IOMode (..), hFlush, hClose) import System.IO (openFile, IOMode (..), hFlush, hClose)
import qualified Data.Text as T import qualified Data.Text as T
import qualified Data.Text.IO as T import qualified Data.Text.IO as T
import Safe (at)
import System.Environment (getArgs)
import BuildConstraints (parsePackageDecl, handlePackage) import BuildConstraints (parsePackageDecl, handlePackage)
import Snapshot (snapshotMap, loadSnapshot) import Snapshot (snapshotMap, loadSnapshot)
@ -19,8 +22,8 @@ import Types (PackageName, Version)
src :: String src :: String
src = "../../build-constraints.yaml" src = "../../build-constraints.yaml"
target :: String target :: Int -> String
target = "../../lts-build-constraints.yaml" target major = "../../lts-" <> show major <> "-build-constraints.yaml"
data State data State
= LookingForLibBounds = LookingForLibBounds
@ -29,14 +32,18 @@ data State
main :: IO () main :: IO ()
main = do main = do
map <- snapshotMap <$> loadSnapshot "../../../stackage-snapshots/lts/22/0.yaml" args :: [String] <- getArgs
output <- openFile target WriteMode print args
let major :: Int = read . (`at` 0) $ args
map <- snapshotMap <$> loadSnapshot ("../../../stackage-snapshots/lts/" <> show major <> "/0.yaml")
output <- openFile (target major) WriteMode
let putLine = liftIO . T.hPutStrLn output let putLine = liftIO . T.hPutStrLn output
lines <- T.lines <$> T.readFile src lines <- T.lines <$> T.readFile src
void $ flip runStateT LookingForLibBounds $ do void $ flip runStateT LookingForLibBounds $ do
forM_ lines $ putLine <=< processLine map forM_ lines $ putLine <=< processLine map
hFlush output hFlush output
hClose output hClose output
putStrLn $ "Done. Wrote to " <> (target major)
processLine :: MonadState State m => Map PackageName Version -> Text -> m Text processLine :: MonadState State m => Map PackageName Version -> Text -> m Text
processLine map line = do processLine map line = do

View File