Version LTS file

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

View File

@ -2,11 +2,18 @@
# Convenience script for checking constraints locally
set -euxo pipefail
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 constraints --target=$LTS &&
curator snapshot-incomplete --target=$LTS &&

View File

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

View File