mirror of
https://github.com/commercialhaskell/stackage.git
synced 2026-01-12 07:18:31 +01:00
Version LTS file
This commit is contained in:
parent
9f73118cb7
commit
d49e1b107a
11
check-lts
11
check-lts
@ -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 &&
|
||||
|
||||
@ -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
|
||||
|
||||
0
lts-build-constraints.yaml → lts-22-build-constraints.yaml
Executable file → Normal file
0
lts-build-constraints.yaml → lts-22-build-constraints.yaml
Executable file → Normal file
Loading…
Reference in New Issue
Block a user