Compare commits
2 Commits
fix-bootst
...
remove-zip
| Author | SHA1 | Date | |
|---|---|---|---|
|
2d25c865cc
|
|||
|
ca0c20552e
|
121
README.md
121
README.md
@@ -24,7 +24,6 @@ Similar in scope to [rustup](https://github.com/rust-lang-nursery/rustup.rs), [p
|
|||||||
* [Env variables](#env-variables)
|
* [Env variables](#env-variables)
|
||||||
* [Installing custom bindists](#installing-custom-bindists)
|
* [Installing custom bindists](#installing-custom-bindists)
|
||||||
* [Isolated Installs](#isolated-installs)
|
* [Isolated Installs](#isolated-installs)
|
||||||
* [CI](#ci)
|
|
||||||
* [Tips and tricks](#tips-and-tricks)
|
* [Tips and tricks](#tips-and-tricks)
|
||||||
* [Design goals](#design-goals)
|
* [Design goals](#design-goals)
|
||||||
* [How](#how)
|
* [How](#how)
|
||||||
@@ -192,126 +191,6 @@ Examples:-
|
|||||||
- `ghcup compile ghc -j 4 -v 9.0.1 -b 8.10.5 -i /home/username/my/dir/ghc`
|
- `ghcup compile ghc -j 4 -v 9.0.1 -b 8.10.5 -i /home/username/my/dir/ghc`
|
||||||
---
|
---
|
||||||
|
|
||||||
### CI
|
|
||||||
|
|
||||||
On windows, ghcup can be installed automatically on a CI runner like so:
|
|
||||||
|
|
||||||
```ps
|
|
||||||
Set-ExecutionPolicy Bypass -Scope Process -Force;[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;Invoke-Command -ScriptBlock ([ScriptBlock]::Create((Invoke-WebRequest https://www.haskell.org/ghcup/sh/bootstrap-haskell.ps1 -UseBasicParsing))) -ArgumentList $false,$true,$true,$false,$false,$false,$false,"C:\"
|
|
||||||
```
|
|
||||||
|
|
||||||
On linux/darwin/freebsd, run the following on your runner:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_MINIMAL=1 sh
|
|
||||||
```
|
|
||||||
|
|
||||||
This will just install `ghcup` and on windows additionally `msys2`.
|
|
||||||
|
|
||||||
#### Example github workflow
|
|
||||||
|
|
||||||
On github workflows you can use https://github.com/haskell/actions/
|
|
||||||
|
|
||||||
If you want to install ghcup manually though, here's an example config:
|
|
||||||
|
|
||||||
```yml
|
|
||||||
name: Haskell CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ master ]
|
|
||||||
pull_request:
|
|
||||||
branches: [ master ]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-cabal:
|
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, macOS-latest, windows-latest]
|
|
||||||
ghc: ['8.10.7', '9.0.1']
|
|
||||||
cabal: ['3.4.0.0']
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- if: matrix.os == 'windows-latest'
|
|
||||||
name: Install ghcup on windows
|
|
||||||
run: Set-ExecutionPolicy Bypass -Scope Process -Force;[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;Invoke-Command -ScriptBlock ([ScriptBlock]::Create((Invoke-WebRequest https://www.haskell.org/ghcup/sh/bootstrap-haskell.ps1 -UseBasicParsing))) -ArgumentList $false,$true,$true,$false,$false,$false,$false,"C:\"
|
|
||||||
|
|
||||||
- if: matrix.os != 'windows-latest'
|
|
||||||
name: Install ghcup on non-windows
|
|
||||||
run: curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_MINIMAL=1 sh
|
|
||||||
|
|
||||||
- if: matrix.os == 'windows-latest'
|
|
||||||
run: echo "/c/ghcup/bin" >> $GITHUB_PATH
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Install ghc/cabal
|
|
||||||
run: |
|
|
||||||
ghcup install ghc ${{ matrix.ghc }}
|
|
||||||
ghcup install cabal ${{ matrix.cabal }}
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Update cabal index
|
|
||||||
run: cabal update
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: cabal build --enable-tests --enable-benchmarks
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Run tests
|
|
||||||
run: cabal test
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Run benches
|
|
||||||
run: cabal bench
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
build-stack:
|
|
||||||
name: Stack ${{ matrix.stack }} ${{ matrix.os }}
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, macOS-latest, windows-latest]
|
|
||||||
stack: ['latest']
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- if: matrix.os == 'windows-latest'
|
|
||||||
name: Install ghcup on windows
|
|
||||||
run: Set-ExecutionPolicy Bypass -Scope Process -Force;[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;Invoke-Command -ScriptBlock ([ScriptBlock]::Create((Invoke-WebRequest https://www.haskell.org/ghcup/sh/bootstrap-haskell.ps1 -UseBasicParsing))) -ArgumentList $false,$true,$true,$false,$false,$false,$false,"C:\"
|
|
||||||
|
|
||||||
- if: matrix.os != 'windows-latest'
|
|
||||||
name: Install ghcup on non-windows
|
|
||||||
run: curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_MINIMAL=1 sh
|
|
||||||
|
|
||||||
- if: matrix.os == 'windows-latest'
|
|
||||||
run: echo "/c/ghcup/bin" >> $GITHUB_PATH
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Install stack
|
|
||||||
run: ghcup install stack ${{ matrix.stack }}
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: stack build
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Run tests
|
|
||||||
run: stack test
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Run benches
|
|
||||||
run: stack bench
|
|
||||||
shell: bash
|
|
||||||
```
|
|
||||||
|
|
||||||
### Tips and tricks
|
### Tips and tricks
|
||||||
|
|
||||||
#### with_ghc wrapper (e.g. for HLS)
|
#### with_ghc wrapper (e.g. for HLS)
|
||||||
|
|||||||
@@ -11,31 +11,22 @@
|
|||||||
module Main where
|
module Main where
|
||||||
|
|
||||||
import GHCup.Types
|
import GHCup.Types
|
||||||
import GHCup.Types.Optics
|
|
||||||
import GHCup.Errors
|
|
||||||
import GHCup.Platform
|
|
||||||
import GHCup.Utils.Dirs
|
|
||||||
import GHCup.Types.JSON ( )
|
import GHCup.Types.JSON ( )
|
||||||
|
import GHCup.Utils.Logger
|
||||||
|
|
||||||
import Control.Monad.Trans.Reader ( runReaderT )
|
|
||||||
import Control.Monad.IO.Class
|
|
||||||
import Data.Char ( toLower )
|
import Data.Char ( toLower )
|
||||||
#if !MIN_VERSION_base(4,13,0)
|
#if !MIN_VERSION_base(4,13,0)
|
||||||
import Data.Semigroup ( (<>) )
|
import Data.Semigroup ( (<>) )
|
||||||
#endif
|
#endif
|
||||||
import Options.Applicative hiding ( style )
|
import Options.Applicative hiding ( style )
|
||||||
import Haskus.Utils.Variant.Excepts
|
|
||||||
import System.Console.Pretty
|
import System.Console.Pretty
|
||||||
import System.Exit
|
import System.Exit
|
||||||
import System.IO ( stderr )
|
import System.IO ( stdout )
|
||||||
import Text.Regex.Posix
|
import Text.Regex.Posix
|
||||||
import Validate
|
import Validate
|
||||||
import Text.PrettyPrint.HughesPJClass ( prettyShow )
|
|
||||||
|
|
||||||
import qualified Data.Text.IO as T
|
|
||||||
import qualified Data.Text as T
|
|
||||||
import qualified Data.ByteString as B
|
import qualified Data.ByteString as B
|
||||||
import qualified Data.YAML.Aeson as Y
|
import qualified Data.Yaml as Y
|
||||||
|
|
||||||
|
|
||||||
data Options = Options
|
data Options = Options
|
||||||
@@ -114,27 +105,10 @@ com = subparser
|
|||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = do
|
main = do
|
||||||
let loggerConfig = LoggerConfig { lcPrintDebug = True
|
|
||||||
, colorOutter = T.hPutStr stderr
|
|
||||||
, rawOutter = \_ -> pure ()
|
|
||||||
}
|
|
||||||
dirs <- liftIO getAllDirs
|
|
||||||
let leanAppstate = LeanAppState (Settings True False Never Curl True GHCupURL False) dirs defaultKeyBindings loggerConfig
|
|
||||||
|
|
||||||
pfreq <- (
|
|
||||||
flip runReaderT leanAppstate . runE @'[NoCompatiblePlatform, NoCompatibleArch, DistroNotFound] $ platformRequest
|
|
||||||
) >>= \case
|
|
||||||
VRight r -> pure r
|
|
||||||
VLeft e -> do
|
|
||||||
flip runReaderT leanAppstate $ logError $ T.pack $ prettyShow e
|
|
||||||
liftIO $ exitWith (ExitFailure 2)
|
|
||||||
|
|
||||||
let appstate = AppState (Settings True False Never Curl True GHCupURL False) dirs defaultKeyBindings (GHCupInfo mempty mempty mempty) pfreq loggerConfig
|
|
||||||
|
|
||||||
_ <- customExecParser (prefs showHelpOnError) (info (opts <**> helper) idm)
|
_ <- customExecParser (prefs showHelpOnError) (info (opts <**> helper) idm)
|
||||||
>>= \Options {..} -> case optCommand of
|
>>= \Options {..} -> case optCommand of
|
||||||
ValidateYAML vopts -> withValidateYamlOpts vopts (\dl m -> flip runReaderT appstate $ validate dl m)
|
ValidateYAML vopts -> withValidateYamlOpts vopts validate
|
||||||
ValidateTarballs vopts tarballFilter -> withValidateYamlOpts vopts (\dl m -> flip runReaderT appstate $ validateTarballs tarballFilter dl m)
|
ValidateTarballs vopts tarballFilter -> withValidateYamlOpts vopts (validateTarballs tarballFilter)
|
||||||
pure ()
|
pure ()
|
||||||
|
|
||||||
where
|
where
|
||||||
@@ -146,8 +120,8 @@ main = do
|
|||||||
ValidateYAMLOpts { vInput = Just (FileInput file) } ->
|
ValidateYAMLOpts { vInput = Just (FileInput file) } ->
|
||||||
B.readFile file >>= valAndExit f
|
B.readFile file >>= valAndExit f
|
||||||
valAndExit f contents = do
|
valAndExit f contents = do
|
||||||
(GHCupInfo _ av gt) <- case Y.decode1Strict contents of
|
(GHCupInfo _ av gt) <- case Y.decodeEither' contents of
|
||||||
Right r -> pure r
|
Right r -> pure r
|
||||||
Left (_, e) -> die (color Red $ show e)
|
Left e -> die (color Red $ show e)
|
||||||
f av gt
|
myLoggerT (LoggerConfig True (B.hPut stdout) (\_ -> pure ())) (f av gt)
|
||||||
>>= exitWith
|
>>= exitWith
|
||||||
|
|||||||
@@ -12,9 +12,11 @@ module Validate where
|
|||||||
import GHCup
|
import GHCup
|
||||||
import GHCup.Download
|
import GHCup.Download
|
||||||
import GHCup.Errors
|
import GHCup.Errors
|
||||||
import GHCup.Types
|
import GHCup.Platform
|
||||||
|
import GHCup.Types hiding ( LeanAppState (..) )
|
||||||
import GHCup.Types.Optics
|
import GHCup.Types.Optics
|
||||||
import GHCup.Utils
|
import GHCup.Utils
|
||||||
|
import GHCup.Utils.Logger
|
||||||
import GHCup.Utils.Version.QQ
|
import GHCup.Utils.Version.QQ
|
||||||
|
|
||||||
import Codec.Archive
|
import Codec.Archive
|
||||||
@@ -22,6 +24,7 @@ import Control.Applicative
|
|||||||
import Control.Exception.Safe
|
import Control.Exception.Safe
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
import Control.Monad.IO.Class
|
import Control.Monad.IO.Class
|
||||||
|
import Control.Monad.Logger
|
||||||
import Control.Monad.Reader.Class
|
import Control.Monad.Reader.Class
|
||||||
import Control.Monad.Trans.Class ( lift )
|
import Control.Monad.Trans.Class ( lift )
|
||||||
import Control.Monad.Trans.Reader ( runReaderT )
|
import Control.Monad.Trans.Reader ( runReaderT )
|
||||||
@@ -36,10 +39,12 @@ import Haskus.Utils.Variant.Excepts
|
|||||||
import Optics
|
import Optics
|
||||||
import System.FilePath
|
import System.FilePath
|
||||||
import System.Exit
|
import System.Exit
|
||||||
|
import System.IO
|
||||||
import Text.ParserCombinators.ReadP
|
import Text.ParserCombinators.ReadP
|
||||||
import Text.PrettyPrint.HughesPJClass ( prettyShow )
|
import Text.PrettyPrint.HughesPJClass ( prettyShow )
|
||||||
import Text.Regex.Posix
|
import Text.Regex.Posix
|
||||||
|
|
||||||
|
import qualified Data.ByteString as B
|
||||||
import qualified Data.Map.Strict as M
|
import qualified Data.Map.Strict as M
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
import qualified Data.Version as V
|
import qualified Data.Version as V
|
||||||
@@ -57,7 +62,7 @@ addError = do
|
|||||||
liftIO $ modifyIORef ref (+ 1)
|
liftIO $ modifyIORef ref (+ 1)
|
||||||
|
|
||||||
|
|
||||||
validate :: (Monad m, MonadReader env m, HasLog env, MonadThrow m, MonadIO m, MonadUnliftIO m)
|
validate :: (Monad m, MonadLogger m, MonadThrow m, MonadIO m, MonadUnliftIO m)
|
||||||
=> GHCupDownloads
|
=> GHCupDownloads
|
||||||
-> M.Map GlobalTool DownloadInfo
|
-> M.Map GlobalTool DownloadInfo
|
||||||
-> m ExitCode
|
-> m ExitCode
|
||||||
@@ -84,23 +89,23 @@ validate dls _ = do
|
|||||||
if e > 0
|
if e > 0
|
||||||
then pure $ ExitFailure e
|
then pure $ ExitFailure e
|
||||||
else do
|
else do
|
||||||
lift $ logInfo "All good"
|
lift $ $(logInfo) "All good"
|
||||||
pure ExitSuccess
|
pure ExitSuccess
|
||||||
where
|
where
|
||||||
checkHasRequiredPlatforms t v tags arch pspecs = do
|
checkHasRequiredPlatforms t v tags arch pspecs = do
|
||||||
let v' = prettyVer v
|
let v' = prettyVer v
|
||||||
arch' = prettyShow arch
|
arch' = prettyShow arch
|
||||||
when (notElem (Linux UnknownLinux) pspecs) $ do
|
when (notElem (Linux UnknownLinux) pspecs) $ do
|
||||||
lift $ logError $
|
lift $ $(logError) $
|
||||||
"Linux UnknownLinux missing for for " <> T.pack (prettyShow t) <> " " <> v' <> " " <> T.pack arch'
|
"Linux UnknownLinux missing for for " <> T.pack (prettyShow t) <> " " <> v' <> " " <> T.pack arch'
|
||||||
addError
|
addError
|
||||||
when ((notElem Darwin pspecs) && arch == A_64) $ do
|
when ((notElem Darwin pspecs) && arch == A_64) $ do
|
||||||
lift $ logError $ "Darwin missing for for " <> T.pack (prettyShow t) <> " " <> v' <> " " <> T.pack arch'
|
lift $ $(logError) $ "Darwin missing for for " <> T.pack (prettyShow t) <> " " <> v' <> " " <> T.pack arch'
|
||||||
addError
|
addError
|
||||||
when ((notElem FreeBSD pspecs) && arch == A_64) $ lift $ logWarn $
|
when ((notElem FreeBSD pspecs) && arch == A_64) $ lift $ $(logWarn) $
|
||||||
"FreeBSD missing for for " <> T.pack (prettyShow t) <> " " <> v' <> " " <> T.pack arch'
|
"FreeBSD missing for for " <> T.pack (prettyShow t) <> " " <> v' <> " " <> T.pack arch'
|
||||||
when (notElem Windows pspecs && arch == A_64) $ do
|
when (notElem Windows pspecs && arch == A_64) $ do
|
||||||
lift $ logError $ "Windows missing for for " <> T.pack (prettyShow t) <> " " <> v' <> " " <> T.pack arch'
|
lift $ $(logError) $ "Windows missing for for " <> T.pack (prettyShow t) <> " " <> v' <> " " <> T.pack arch'
|
||||||
addError
|
addError
|
||||||
|
|
||||||
-- alpine needs to be set explicitly, because
|
-- alpine needs to be set explicitly, because
|
||||||
@@ -108,12 +113,12 @@ validate dls _ = do
|
|||||||
-- (although it could be static)
|
-- (although it could be static)
|
||||||
when (notElem (Linux Alpine) pspecs) $
|
when (notElem (Linux Alpine) pspecs) $
|
||||||
case t of
|
case t of
|
||||||
GHCup | arch `elem` [A_64, A_32] -> lift (logError $ "Linux Alpine missing for " <> T.pack (prettyShow t) <> " " <> v' <> " " <> T.pack (prettyShow arch)) >> addError
|
GHCup | arch `elem` [A_64, A_32] -> lift ($(logError) $ "Linux Alpine missing for " <> T.pack (prettyShow t) <> " " <> v' <> " " <> T.pack (prettyShow arch)) >> addError
|
||||||
Cabal | v > [vver|2.4.1.0|]
|
Cabal | v > [vver|2.4.1.0|]
|
||||||
, arch `elem` [A_64, A_32] -> lift (logError $ "Linux Alpine missing for " <> T.pack (prettyShow t) <> " " <> v' <> " " <> T.pack (prettyShow arch)) >> addError
|
, arch `elem` [A_64, A_32] -> lift ($(logError) $ "Linux Alpine missing for " <> T.pack (prettyShow t) <> " " <> v' <> " " <> T.pack (prettyShow arch)) >> addError
|
||||||
GHC | Latest `elem` tags || Recommended `elem` tags
|
GHC | Latest `elem` tags || Recommended `elem` tags
|
||||||
, arch `elem` [A_64, A_32] -> lift (logError $ "Linux Alpine missing for " <> T.pack (prettyShow t) <> " " <> v' <> " " <> T.pack (prettyShow arch))
|
, arch `elem` [A_64, A_32] -> lift ($(logError) $ "Linux Alpine missing for " <> T.pack (prettyShow t) <> " " <> v' <> " " <> T.pack (prettyShow arch))
|
||||||
_ -> lift $ logWarn $ "Linux Alpine missing for " <> T.pack (prettyShow t) <> " " <> v' <> " " <> T.pack (prettyShow arch)
|
_ -> lift $ $(logWarn) $ "Linux Alpine missing for " <> T.pack (prettyShow t) <> " " <> v' <> " " <> T.pack (prettyShow arch)
|
||||||
|
|
||||||
checkUniqueTags tool = do
|
checkUniqueTags tool = do
|
||||||
let allTags = join $ fmap _viTags $ M.elems $ availableToolVersions dls tool
|
let allTags = join $ fmap _viTags $ M.elems $ availableToolVersions dls tool
|
||||||
@@ -133,7 +138,7 @@ validate dls _ = do
|
|||||||
case join nonUnique of
|
case join nonUnique of
|
||||||
[] -> pure ()
|
[] -> pure ()
|
||||||
xs -> do
|
xs -> do
|
||||||
lift $ logError $ "Tags not unique for " <> T.pack (prettyShow tool) <> ": " <> T.pack (prettyShow xs)
|
lift $ $(logError) $ "Tags not unique for " <> T.pack (prettyShow tool) <> ": " <> T.pack (prettyShow xs)
|
||||||
addError
|
addError
|
||||||
where
|
where
|
||||||
isUniqueTag Latest = True
|
isUniqueTag Latest = True
|
||||||
@@ -149,7 +154,7 @@ validate dls _ = do
|
|||||||
case [ x | (x,"") <- readP_to_S V.parseVersion (T.unpack . prettyVer $ v) ] of
|
case [ x | (x,"") <- readP_to_S V.parseVersion (T.unpack . prettyVer $ v) ] of
|
||||||
[_] -> pure ()
|
[_] -> pure ()
|
||||||
_ -> do
|
_ -> do
|
||||||
lift $ logError $ "GHC version " <> prettyVer v <> " is not valid"
|
lift $ $(logError) $ "GHC version " <> prettyVer v <> " is not valid"
|
||||||
addError
|
addError
|
||||||
|
|
||||||
-- a tool must have at least one of each mandatory tags
|
-- a tool must have at least one of each mandatory tags
|
||||||
@@ -157,7 +162,7 @@ validate dls _ = do
|
|||||||
let allTags = join $ fmap _viTags $ M.elems $ availableToolVersions dls tool
|
let allTags = join $ fmap _viTags $ M.elems $ availableToolVersions dls tool
|
||||||
forM_ [Latest, Recommended] $ \t -> case elem t allTags of
|
forM_ [Latest, Recommended] $ \t -> case elem t allTags of
|
||||||
False -> do
|
False -> do
|
||||||
lift $ logError $ "Tag " <> T.pack (prettyShow t) <> " missing from " <> T.pack (prettyShow tool)
|
lift $ $(logError) $ "Tag " <> T.pack (prettyShow t) <> " missing from " <> T.pack (prettyShow tool)
|
||||||
addError
|
addError
|
||||||
True -> pure ()
|
True -> pure ()
|
||||||
|
|
||||||
@@ -166,7 +171,7 @@ validate dls _ = do
|
|||||||
let allTags = M.toList $ availableToolVersions dls GHC
|
let allTags = M.toList $ availableToolVersions dls GHC
|
||||||
forM allTags $ \(ver, _viTags -> tags) -> case any isBase tags of
|
forM allTags $ \(ver, _viTags -> tags) -> case any isBase tags of
|
||||||
False -> do
|
False -> do
|
||||||
lift $ logError $ "Base tag missing from GHC ver " <> prettyVer ver
|
lift $ $(logError) $ "Base tag missing from GHC ver " <> prettyVer ver
|
||||||
addError
|
addError
|
||||||
True -> pure ()
|
True -> pure ()
|
||||||
|
|
||||||
@@ -179,10 +184,7 @@ data TarballFilter = TarballFilter
|
|||||||
}
|
}
|
||||||
|
|
||||||
validateTarballs :: ( Monad m
|
validateTarballs :: ( Monad m
|
||||||
, MonadReader env m
|
, MonadLogger m
|
||||||
, HasLog env
|
|
||||||
, HasDirs env
|
|
||||||
, HasSettings env
|
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, MonadUnliftIO m
|
, MonadUnliftIO m
|
||||||
@@ -197,37 +199,45 @@ validateTarballs :: ( Monad m
|
|||||||
validateTarballs (TarballFilter etool versionRegex) dls gt = do
|
validateTarballs (TarballFilter etool versionRegex) dls gt = do
|
||||||
ref <- liftIO $ newIORef 0
|
ref <- liftIO $ newIORef 0
|
||||||
|
|
||||||
-- download/verify all tarballs
|
flip runReaderT ref $ do
|
||||||
let dlis = either (const []) (\tool -> nubOrd $ dls ^.. each %& indices (maybe (const True) (==) tool) %> each %& indices (matchTest versionRegex . T.unpack . prettyVer) % (viSourceDL % _Just `summing` viArch % each % each % each)) etool
|
-- download/verify all tarballs
|
||||||
let gdlis = nubOrd $ gt ^.. each
|
let dlis = either (const []) (\tool -> nubOrd $ dls ^.. each %& indices (maybe (const True) (==) tool) %> each %& indices (matchTest versionRegex . T.unpack . prettyVer) % (viSourceDL % _Just `summing` viArch % each % each % each)) etool
|
||||||
let allDls = either (const gdlis) (const dlis) etool
|
let gdlis = nubOrd $ gt ^.. each
|
||||||
when (null allDls) $ logError "no tarballs selected by filter" *> (flip runReaderT ref addError)
|
let allDls = either (const gdlis) (const dlis) etool
|
||||||
forM_ allDls (downloadAll ref)
|
when (null allDls) $ $(logError) "no tarballs selected by filter" *> addError
|
||||||
|
forM_ allDls downloadAll
|
||||||
|
|
||||||
-- exit
|
-- exit
|
||||||
e <- liftIO $ readIORef ref
|
e <- liftIO $ readIORef ref
|
||||||
if e > 0
|
if e > 0
|
||||||
then pure $ ExitFailure e
|
then pure $ ExitFailure e
|
||||||
else do
|
else do
|
||||||
logInfo "All good"
|
lift $ $(logInfo) "All good"
|
||||||
pure ExitSuccess
|
pure ExitSuccess
|
||||||
|
|
||||||
where
|
where
|
||||||
downloadAll :: ( MonadUnliftIO m
|
runLogger = myLoggerT LoggerConfig { lcPrintDebug = True
|
||||||
, MonadIO m
|
, colorOutter = B.hPut stderr
|
||||||
, MonadReader env m
|
, rawOutter = \_ -> pure ()
|
||||||
, HasLog env
|
}
|
||||||
, HasDirs env
|
downloadAll dli = do
|
||||||
, HasSettings env
|
dirs <- liftIO getAllDirs
|
||||||
, MonadCatch m
|
|
||||||
, MonadMask m
|
pfreq <- (
|
||||||
, MonadThrow m
|
runLogger . runE @'[NoCompatiblePlatform, NoCompatibleArch, DistroNotFound] . liftE $ platformRequest
|
||||||
)
|
) >>= \case
|
||||||
=> IORef Int
|
VRight r -> pure r
|
||||||
-> DownloadInfo
|
VLeft e -> do
|
||||||
-> m ()
|
lift $ runLogger
|
||||||
downloadAll ref dli = do
|
($(logError) $ T.pack $ prettyShow e)
|
||||||
r <- runResourceT
|
liftIO $ exitWith (ExitFailure 2)
|
||||||
|
|
||||||
|
let appstate = AppState (Settings True False Never Curl True GHCupURL False) dirs defaultKeyBindings (GHCupInfo mempty mempty mempty) pfreq
|
||||||
|
|
||||||
|
r <-
|
||||||
|
runLogger
|
||||||
|
. flip runReaderT appstate
|
||||||
|
. runResourceT
|
||||||
. runE @'[DigestError
|
. runE @'[DigestError
|
||||||
, DownloadFailed
|
, DownloadFailed
|
||||||
, UnknownArchive
|
, UnknownArchive
|
||||||
@@ -253,26 +263,26 @@ validateTarballs (TarballFilter etool versionRegex) dls gt = do
|
|||||||
VRight (Just basePath) -> do
|
VRight (Just basePath) -> do
|
||||||
case _dlSubdir dli of
|
case _dlSubdir dli of
|
||||||
Just (RealDir prel) -> do
|
Just (RealDir prel) -> do
|
||||||
logInfo
|
lift $ $(logInfo)
|
||||||
$ " verifying subdir: " <> T.pack prel
|
$ " verifying subdir: " <> T.pack prel
|
||||||
when (basePath /= prel) $ do
|
when (basePath /= prel) $ do
|
||||||
logError $
|
lift $ $(logError) $
|
||||||
"Subdir doesn't match: expected " <> T.pack prel <> ", got " <> T.pack basePath
|
"Subdir doesn't match: expected " <> T.pack prel <> ", got " <> T.pack basePath
|
||||||
(flip runReaderT ref addError)
|
addError
|
||||||
Just (RegexDir regexString) -> do
|
Just (RegexDir regexString) -> do
|
||||||
logInfo $
|
lift $ $(logInfo) $
|
||||||
"verifying subdir (regex): " <> T.pack regexString
|
"verifying subdir (regex): " <> T.pack regexString
|
||||||
let regex = makeRegexOpts
|
let regex = makeRegexOpts
|
||||||
compIgnoreCase
|
compIgnoreCase
|
||||||
execBlank
|
execBlank
|
||||||
regexString
|
regexString
|
||||||
when (not (match regex basePath)) $ do
|
when (not (match regex basePath)) $ do
|
||||||
logError $
|
lift $ $(logError) $
|
||||||
"Subdir doesn't match: expected regex " <> T.pack regexString <> ", got " <> T.pack basePath
|
"Subdir doesn't match: expected regex " <> T.pack regexString <> ", got " <> T.pack basePath
|
||||||
(flip runReaderT ref addError)
|
addError
|
||||||
Nothing -> pure ()
|
Nothing -> pure ()
|
||||||
VRight Nothing -> pure ()
|
VRight Nothing -> pure ()
|
||||||
VLeft e -> do
|
VLeft e -> do
|
||||||
logError $
|
lift $ $(logError) $
|
||||||
"Could not download (or verify hash) of " <> T.pack (show dli) <> ", Error was: " <> T.pack (prettyShow e)
|
"Could not download (or verify hash) of " <> T.pack (show dli) <> ", Error was: " <> T.pack (prettyShow e)
|
||||||
(flip runReaderT ref addError)
|
addError
|
||||||
|
|||||||
@@ -13,11 +13,11 @@ module BrickMain where
|
|||||||
import GHCup
|
import GHCup
|
||||||
import GHCup.Download
|
import GHCup.Download
|
||||||
import GHCup.Errors
|
import GHCup.Errors
|
||||||
import GHCup.Types.Optics hiding ( getGHCupInfo )
|
|
||||||
import GHCup.Types hiding ( LeanAppState(..) )
|
import GHCup.Types hiding ( LeanAppState(..) )
|
||||||
import GHCup.Utils
|
import GHCup.Utils
|
||||||
import GHCup.Utils.Prelude ( decUTF8Safe )
|
import GHCup.Utils.Prelude ( decUTF8Safe )
|
||||||
import GHCup.Utils.File
|
import GHCup.Utils.File
|
||||||
|
import GHCup.Utils.Logger
|
||||||
|
|
||||||
import Brick
|
import Brick
|
||||||
import Brick.Widgets.Border
|
import Brick.Widgets.Border
|
||||||
@@ -29,6 +29,7 @@ import Brick.Widgets.List ( listSelectedFocusedAttr
|
|||||||
)
|
)
|
||||||
import Codec.Archive
|
import Codec.Archive
|
||||||
import Control.Exception.Safe
|
import Control.Exception.Safe
|
||||||
|
import Control.Monad.Logger
|
||||||
import Control.Monad.Reader
|
import Control.Monad.Reader
|
||||||
import Control.Monad.Trans.Except
|
import Control.Monad.Trans.Except
|
||||||
import Control.Monad.Trans.Resource
|
import Control.Monad.Trans.Resource
|
||||||
@@ -416,8 +417,12 @@ install' :: (MonadReader AppState m, MonadIO m, MonadThrow m, MonadFail m, Monad
|
|||||||
install' _ (_, ListResult {..}) = do
|
install' _ (_, ListResult {..}) = do
|
||||||
AppState { ghcupInfo = GHCupInfo { _ghcupDownloads = dls }} <- ask
|
AppState { ghcupInfo = GHCupInfo { _ghcupDownloads = dls }} <- ask
|
||||||
|
|
||||||
|
l <- liftIO $ readIORef logger'
|
||||||
|
let runLogger = myLoggerT l
|
||||||
|
|
||||||
let run =
|
let run =
|
||||||
runResourceT
|
runLogger
|
||||||
|
. runResourceT
|
||||||
. runE
|
. runE
|
||||||
@'[ AlreadyInstalled
|
@'[ AlreadyInstalled
|
||||||
, ArchiveResult
|
, ArchiveResult
|
||||||
@@ -457,7 +462,7 @@ install' _ (_, ListResult {..}) = do
|
|||||||
>>= \case
|
>>= \case
|
||||||
VRight vi -> do
|
VRight vi -> do
|
||||||
forM_ (_viPostInstall =<< vi) $ \msg ->
|
forM_ (_viPostInstall =<< vi) $ \msg ->
|
||||||
logInfo msg
|
myLoggerT l $ $(logInfo) msg
|
||||||
pure $ Right ()
|
pure $ Right ()
|
||||||
VLeft (V (AlreadyInstalled _ _)) -> pure $ Right ()
|
VLeft (V (AlreadyInstalled _ _)) -> pure $ Right ()
|
||||||
VLeft (V NoUpdate) -> pure $ Right ()
|
VLeft (V NoUpdate) -> pure $ Right ()
|
||||||
@@ -468,9 +473,12 @@ install' _ (_, ListResult {..}) = do
|
|||||||
set' :: BrickState -> (Int, ListResult) -> IO (Either String ())
|
set' :: BrickState -> (Int, ListResult) -> IO (Either String ())
|
||||||
set' _ (_, ListResult {..}) = do
|
set' _ (_, ListResult {..}) = do
|
||||||
settings <- readIORef settings'
|
settings <- readIORef settings'
|
||||||
|
l <- readIORef logger'
|
||||||
|
let runLogger = myLoggerT l
|
||||||
|
|
||||||
let run =
|
let run =
|
||||||
flip runReaderT settings
|
runLogger
|
||||||
|
. flip runReaderT settings
|
||||||
. runE @'[FileDoesNotExistError , NotInstalled , TagNotFound]
|
. runE @'[FileDoesNotExistError , NotInstalled , TagNotFound]
|
||||||
|
|
||||||
run (do
|
run (do
|
||||||
@@ -493,7 +501,9 @@ del' :: (MonadReader AppState m, MonadIO m, MonadFail m, MonadMask m, MonadUnlif
|
|||||||
del' _ (_, ListResult {..}) = do
|
del' _ (_, ListResult {..}) = do
|
||||||
AppState { ghcupInfo = GHCupInfo { _ghcupDownloads = dls }} <- ask
|
AppState { ghcupInfo = GHCupInfo { _ghcupDownloads = dls }} <- ask
|
||||||
|
|
||||||
let run = runE @'[NotInstalled]
|
l <- liftIO $ readIORef logger'
|
||||||
|
let runLogger = myLoggerT l
|
||||||
|
let run = myLoggerT l . runE @'[NotInstalled]
|
||||||
|
|
||||||
run (do
|
run (do
|
||||||
let vi = getVersionInfo lVer lTool dls
|
let vi = getVersionInfo lVer lTool dls
|
||||||
@@ -507,7 +517,7 @@ del' _ (_, ListResult {..}) = do
|
|||||||
>>= \case
|
>>= \case
|
||||||
VRight vi -> do
|
VRight vi -> do
|
||||||
forM_ (join $ fmap _viPostRemove vi) $ \msg ->
|
forM_ (join $ fmap _viPostRemove vi) $ \msg ->
|
||||||
logInfo msg
|
runLogger $ $(logInfo) msg
|
||||||
pure $ Right ()
|
pure $ Right ()
|
||||||
VLeft e -> pure $ Left (prettyShow e)
|
VLeft e -> pure $ Left (prettyShow e)
|
||||||
|
|
||||||
@@ -536,10 +546,6 @@ settings' :: IORef AppState
|
|||||||
{-# NOINLINE settings' #-}
|
{-# NOINLINE settings' #-}
|
||||||
settings' = unsafePerformIO $ do
|
settings' = unsafePerformIO $ do
|
||||||
dirs <- getAllDirs
|
dirs <- getAllDirs
|
||||||
let loggerConfig = LoggerConfig { lcPrintDebug = False
|
|
||||||
, colorOutter = \_ -> pure ()
|
|
||||||
, rawOutter = \_ -> pure ()
|
|
||||||
}
|
|
||||||
newIORef $ AppState (Settings { cache = True
|
newIORef $ AppState (Settings { cache = True
|
||||||
, noVerify = False
|
, noVerify = False
|
||||||
, keepDirs = Never
|
, keepDirs = Never
|
||||||
@@ -553,14 +559,27 @@ settings' = unsafePerformIO $ do
|
|||||||
defaultKeyBindings
|
defaultKeyBindings
|
||||||
(GHCupInfo mempty mempty mempty)
|
(GHCupInfo mempty mempty mempty)
|
||||||
(PlatformRequest A_64 Darwin Nothing)
|
(PlatformRequest A_64 Darwin Nothing)
|
||||||
loggerConfig
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
logger' :: IORef LoggerConfig
|
||||||
|
{-# NOINLINE logger' #-}
|
||||||
|
logger' = unsafePerformIO
|
||||||
|
(newIORef $ LoggerConfig { lcPrintDebug = False
|
||||||
|
, colorOutter = \_ -> pure ()
|
||||||
|
, rawOutter = \_ -> pure ()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
brickMain :: AppState
|
brickMain :: AppState
|
||||||
|
-> LoggerConfig
|
||||||
-> IO ()
|
-> IO ()
|
||||||
brickMain s = do
|
brickMain s l = do
|
||||||
writeIORef settings' s
|
writeIORef settings' s
|
||||||
|
-- logger interpreter
|
||||||
|
writeIORef logger' l
|
||||||
|
let runLogger = myLoggerT l
|
||||||
|
|
||||||
no_color <- isJust <$> lookupEnv "NO_COLOR"
|
no_color <- isJust <$> lookupEnv "NO_COLOR"
|
||||||
|
|
||||||
@@ -577,7 +596,7 @@ brickMain s = do
|
|||||||
)
|
)
|
||||||
$> ()
|
$> ()
|
||||||
Left e -> do
|
Left e -> do
|
||||||
flip runReaderT s $ logError $ "Error building app state: " <> T.pack (show e)
|
runLogger ($(logError) $ "Error building app state: " <> T.pack (show e))
|
||||||
exitWith $ ExitFailure 2
|
exitWith $ ExitFailure 2
|
||||||
|
|
||||||
|
|
||||||
@@ -588,9 +607,12 @@ defaultAppSettings = BrickSettings { showAllVersions = False, showAllTools = Fal
|
|||||||
getGHCupInfo :: IO (Either String GHCupInfo)
|
getGHCupInfo :: IO (Either String GHCupInfo)
|
||||||
getGHCupInfo = do
|
getGHCupInfo = do
|
||||||
settings <- readIORef settings'
|
settings <- readIORef settings'
|
||||||
|
l <- readIORef logger'
|
||||||
|
let runLogger = myLoggerT l
|
||||||
|
|
||||||
r <-
|
r <-
|
||||||
flip runReaderT settings
|
runLogger
|
||||||
|
. flip runReaderT settings
|
||||||
. runE @'[JSONError , DownloadFailed , FileDoesNotExistError]
|
. runE @'[JSONError , DownloadFailed , FileDoesNotExistError]
|
||||||
$ liftE
|
$ liftE
|
||||||
$ getDownloadsF
|
$ getDownloadsF
|
||||||
@@ -603,11 +625,14 @@ getGHCupInfo = do
|
|||||||
getAppData :: Maybe GHCupInfo
|
getAppData :: Maybe GHCupInfo
|
||||||
-> IO (Either String BrickData)
|
-> IO (Either String BrickData)
|
||||||
getAppData mgi = runExceptT $ do
|
getAppData mgi = runExceptT $ do
|
||||||
|
l <- liftIO $ readIORef logger'
|
||||||
|
let runLogger = myLoggerT l
|
||||||
|
|
||||||
r <- ExceptT $ maybe getGHCupInfo (pure . Right) mgi
|
r <- ExceptT $ maybe getGHCupInfo (pure . Right) mgi
|
||||||
liftIO $ modifyIORef settings' (\s -> s { ghcupInfo = r })
|
liftIO $ modifyIORef settings' (\s -> s { ghcupInfo = r })
|
||||||
settings <- liftIO $ readIORef settings'
|
settings <- liftIO $ readIORef settings'
|
||||||
|
|
||||||
flip runReaderT settings $ do
|
runLogger . flip runReaderT settings $ do
|
||||||
lV <- listVersions Nothing Nothing
|
lV <- listVersions Nothing Nothing
|
||||||
pure $ BrickData (reverse lV)
|
pure $ BrickData (reverse lV)
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ import GHCup.Utils.Prelude
|
|||||||
import GHCup.Utils.String.QQ
|
import GHCup.Utils.String.QQ
|
||||||
import GHCup.Version
|
import GHCup.Version
|
||||||
|
|
||||||
import Cabal.Plan ( findPlanJson, SearchPlanJson(..) )
|
|
||||||
import Codec.Archive
|
import Codec.Archive
|
||||||
import Control.Concurrent
|
import Control.Concurrent
|
||||||
import Control.Concurrent.Async
|
import Control.Concurrent.Async
|
||||||
@@ -40,10 +39,9 @@ import Control.Exception.Safe
|
|||||||
#if !MIN_VERSION_base(4,13,0)
|
#if !MIN_VERSION_base(4,13,0)
|
||||||
import Control.Monad.Fail ( MonadFail )
|
import Control.Monad.Fail ( MonadFail )
|
||||||
#endif
|
#endif
|
||||||
|
import Control.Monad.Logger
|
||||||
import Control.Monad.Reader
|
import Control.Monad.Reader
|
||||||
import Control.Monad.Trans.Resource
|
import Control.Monad.Trans.Resource
|
||||||
import Data.Aeson ( decodeStrict', Value )
|
|
||||||
import Data.Aeson.Encode.Pretty ( encodePretty )
|
|
||||||
import Data.Bifunctor
|
import Data.Bifunctor
|
||||||
import Data.Char
|
import Data.Char
|
||||||
import Data.Either
|
import Data.Either
|
||||||
@@ -77,7 +75,8 @@ import qualified Data.Map.Strict as M
|
|||||||
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 qualified Data.Text.Encoding as E
|
import qualified Data.Text.Encoding as E
|
||||||
import qualified Data.YAML.Aeson as Y
|
import qualified Data.Yaml as Y
|
||||||
|
import qualified Data.Yaml.Pretty as YP
|
||||||
import qualified Text.Megaparsec as MP
|
import qualified Text.Megaparsec as MP
|
||||||
import qualified Text.Megaparsec.Char as MPC
|
import qualified Text.Megaparsec.Char as MPC
|
||||||
|
|
||||||
@@ -1097,18 +1096,19 @@ versionArgument criteria tool = argument (eitherReader tVersionEither) (metavar
|
|||||||
tagCompleter :: Tool -> [String] -> Completer
|
tagCompleter :: Tool -> [String] -> Completer
|
||||||
tagCompleter tool add = listIOCompleter $ do
|
tagCompleter tool add = listIOCompleter $ do
|
||||||
dirs' <- liftIO getAllDirs
|
dirs' <- liftIO getAllDirs
|
||||||
|
let appState = LeanAppState
|
||||||
|
(Settings True False Never Curl False GHCupURL True)
|
||||||
|
dirs'
|
||||||
|
defaultKeyBindings
|
||||||
|
|
||||||
let loggerConfig = LoggerConfig
|
let loggerConfig = LoggerConfig
|
||||||
{ lcPrintDebug = False
|
{ lcPrintDebug = False
|
||||||
, colorOutter = mempty
|
, colorOutter = mempty
|
||||||
, rawOutter = mempty
|
, rawOutter = mempty
|
||||||
}
|
}
|
||||||
let appState = LeanAppState
|
let runLogger = myLoggerT loggerConfig
|
||||||
(Settings True False Never Curl False GHCupURL True)
|
|
||||||
dirs'
|
|
||||||
defaultKeyBindings
|
|
||||||
loggerConfig
|
|
||||||
|
|
||||||
mGhcUpInfo <- flip runReaderT appState . runE $ getDownloadsF
|
mGhcUpInfo <- runLogger . flip runReaderT appState . runE $ getDownloadsF
|
||||||
case mGhcUpInfo of
|
case mGhcUpInfo of
|
||||||
VRight ghcupInfo -> do
|
VRight ghcupInfo -> do
|
||||||
let allTags = filter (\t -> t /= Old)
|
let allTags = filter (\t -> t /= Old)
|
||||||
@@ -1128,14 +1128,14 @@ versionCompleter criteria tool = listIOCompleter $ do
|
|||||||
, colorOutter = mempty
|
, colorOutter = mempty
|
||||||
, rawOutter = mempty
|
, rawOutter = mempty
|
||||||
}
|
}
|
||||||
let settings = Settings True False Never Curl False GHCupURL True
|
let runLogger = myLoggerT loggerConfig
|
||||||
|
settings = Settings True False Never Curl False GHCupURL True
|
||||||
let leanAppState = LeanAppState
|
let leanAppState = LeanAppState
|
||||||
settings
|
settings
|
||||||
dirs'
|
dirs'
|
||||||
defaultKeyBindings
|
defaultKeyBindings
|
||||||
loggerConfig
|
mpFreq <- runLogger . flip runReaderT leanAppState . runE $ platformRequest
|
||||||
mpFreq <- flip runReaderT leanAppState . runE $ platformRequest
|
mGhcUpInfo <- runLogger . flip runReaderT leanAppState . runE $ getDownloadsF
|
||||||
mGhcUpInfo <- flip runReaderT leanAppState . runE $ getDownloadsF
|
|
||||||
forFold mpFreq $ \pfreq -> do
|
forFold mpFreq $ \pfreq -> do
|
||||||
forFold mGhcUpInfo $ \ghcupInfo -> do
|
forFold mGhcUpInfo $ \ghcupInfo -> do
|
||||||
let appState = AppState
|
let appState = AppState
|
||||||
@@ -1144,9 +1144,8 @@ versionCompleter criteria tool = listIOCompleter $ do
|
|||||||
defaultKeyBindings
|
defaultKeyBindings
|
||||||
ghcupInfo
|
ghcupInfo
|
||||||
pfreq
|
pfreq
|
||||||
loggerConfig
|
|
||||||
|
|
||||||
runEnv = flip runReaderT appState
|
runEnv = runLogger . flip runReaderT appState
|
||||||
|
|
||||||
installedVersions <- runEnv $ listVersions (Just tool) criteria
|
installedVersions <- runEnv $ listVersions (Just tool) criteria
|
||||||
return $ T.unpack . prettyVer . lVer <$> installedVersions
|
return $ T.unpack . prettyVer . lVer <$> installedVersions
|
||||||
@@ -1317,7 +1316,7 @@ toSettings options = do
|
|||||||
|
|
||||||
updateSettings :: Monad m => UTF8.ByteString -> Settings -> Excepts '[JSONError] m Settings
|
updateSettings :: Monad m => UTF8.ByteString -> Settings -> Excepts '[JSONError] m Settings
|
||||||
updateSettings config settings = do
|
updateSettings config settings = do
|
||||||
settings' <- lE' JSONDecodeError . first snd . Y.decode1Strict $ config
|
settings' <- lE' JSONDecodeError . first show . Y.decodeEither' $ config
|
||||||
pure $ mergeConf settings' settings
|
pure $ mergeConf settings' settings
|
||||||
where
|
where
|
||||||
mergeConf :: UserSettings -> Settings -> Settings
|
mergeConf :: UserSettings -> Settings -> Settings
|
||||||
@@ -1364,19 +1363,11 @@ describe_result = $( LitE . StringL <$>
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
plan_json :: String
|
|
||||||
plan_json = $( LitE . StringL <$>
|
|
||||||
runIO (handleIO (\_ -> pure "") $ do
|
|
||||||
fp <- findPlanJson (ProjectRelativeToDir ".")
|
|
||||||
c <- B.readFile fp
|
|
||||||
(Just res) <- pure $ decodeStrict' @Value c
|
|
||||||
pure $ T.unpack $ decUTF8Safe' $ encodePretty res
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
formatConfig :: UserSettings -> String
|
formatConfig :: UserSettings -> String
|
||||||
formatConfig settings
|
formatConfig settings
|
||||||
= UTF8.toString . Y.encode1Strict $ settings
|
= UTF8.toString . YP.encodePretty yamlConfig $ settings
|
||||||
|
where
|
||||||
|
yamlConfig = YP.setConfCompare compare YP.defConfig
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = do
|
main = do
|
||||||
@@ -1390,9 +1381,6 @@ main = do
|
|||||||
(head . lines $ describe_result)
|
(head . lines $ describe_result)
|
||||||
)
|
)
|
||||||
(long "version" <> help "Show version" <> hidden)
|
(long "version" <> help "Show version" <> hidden)
|
||||||
let planJson = infoOption
|
|
||||||
plan_json
|
|
||||||
(long "plan-json" <> help "Show the build-time configuration" <> internal)
|
|
||||||
let numericVersionHelp = infoOption
|
let numericVersionHelp = infoOption
|
||||||
numericVer
|
numericVer
|
||||||
( long "numeric-version"
|
( long "numeric-version"
|
||||||
@@ -1420,7 +1408,7 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
|
|
||||||
customExecParser
|
customExecParser
|
||||||
(prefs showHelpOnError)
|
(prefs showHelpOnError)
|
||||||
(info (opts <**> helper <**> versionHelp <**> numericVersionHelp <**> planJson <**> listCommands)
|
(info (opts <**> helper <**> versionHelp <**> numericVersionHelp <**> listCommands)
|
||||||
(footerDoc (Just $ text main_footer))
|
(footerDoc (Just $ text main_footer))
|
||||||
)
|
)
|
||||||
>>= \opt@Options {..} -> do
|
>>= \opt@Options {..} -> do
|
||||||
@@ -1431,20 +1419,18 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
|
|
||||||
(settings, keybindings) <- toSettings opt
|
(settings, keybindings) <- toSettings opt
|
||||||
|
|
||||||
|
|
||||||
-- logger interpreter
|
-- logger interpreter
|
||||||
logfile <- flip runReaderT dirs initGHCupFileLogging
|
logfile <- flip runReaderT dirs $ initGHCupFileLogging
|
||||||
let loggerConfig = LoggerConfig
|
let loggerConfig = LoggerConfig
|
||||||
{ lcPrintDebug = verbose settings
|
{ lcPrintDebug = verbose settings
|
||||||
, colorOutter = T.hPutStr stderr
|
, colorOutter = B.hPut stderr
|
||||||
, rawOutter =
|
, rawOutter =
|
||||||
case optCommand of
|
case optCommand of
|
||||||
Nuke -> \_ -> pure ()
|
Nuke -> \_ -> pure ()
|
||||||
_ -> T.appendFile logfile
|
_ -> B.appendFile logfile
|
||||||
}
|
}
|
||||||
let leanAppstate = LeanAppState settings dirs keybindings loggerConfig
|
let runLogger = myLoggerT loggerConfig
|
||||||
let runLogger = flip runReaderT leanAppstate
|
let siletRunLogger = myLoggerT loggerConfig { colorOutter = \_ -> pure () }
|
||||||
let siletRunLogger = flip runReaderT (leanAppstate { loggerConfig = loggerConfig { colorOutter = \_ -> pure () } } :: LeanAppState)
|
|
||||||
|
|
||||||
|
|
||||||
-------------------------
|
-------------------------
|
||||||
@@ -1452,6 +1438,7 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
|
|
||||||
|
let leanAppstate = LeanAppState settings dirs keybindings
|
||||||
appState = do
|
appState = do
|
||||||
pfreq <- (
|
pfreq <- (
|
||||||
runLogger . runE @'[NoCompatiblePlatform, NoCompatibleArch, DistroNotFound] . liftE $ platformRequest
|
runLogger . runE @'[NoCompatiblePlatform, NoCompatibleArch, DistroNotFound] . liftE $ platformRequest
|
||||||
@@ -1459,11 +1446,12 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
VRight r -> pure r
|
VRight r -> pure r
|
||||||
VLeft e -> do
|
VLeft e -> do
|
||||||
runLogger
|
runLogger
|
||||||
(logError $ T.pack $ prettyShow e)
|
($(logError) $ T.pack $ prettyShow e)
|
||||||
exitWith (ExitFailure 2)
|
exitWith (ExitFailure 2)
|
||||||
|
|
||||||
ghcupInfo <-
|
ghcupInfo <-
|
||||||
( flip runReaderT leanAppstate
|
( runLogger
|
||||||
|
. flip runReaderT leanAppstate
|
||||||
. runE @'[JSONError , DownloadFailed, FileDoesNotExistError]
|
. runE @'[JSONError , DownloadFailed, FileDoesNotExistError]
|
||||||
$ liftE
|
$ liftE
|
||||||
$ getDownloadsF
|
$ getDownloadsF
|
||||||
@@ -1472,12 +1460,12 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
VRight r -> pure r
|
VRight r -> pure r
|
||||||
VLeft e -> do
|
VLeft e -> do
|
||||||
runLogger
|
runLogger
|
||||||
(logError $ T.pack $ prettyShow e)
|
($(logError) $ T.pack $ prettyShow e)
|
||||||
exitWith (ExitFailure 2)
|
exitWith (ExitFailure 2)
|
||||||
let s' = AppState settings dirs keybindings ghcupInfo pfreq loggerConfig
|
let s' = AppState settings dirs keybindings ghcupInfo pfreq
|
||||||
|
|
||||||
race_ (liftIO $ flip runReaderT s' cleanupTrash)
|
race_ (liftIO $ runLogger $ flip runReaderT dirs $ cleanupTrash)
|
||||||
(threadDelay 5000000 >> runLogger (logWarn $ "Killing cleanup thread (exceeded 5s timeout)... please remove leftover files in " <> T.pack recycleDir <> " manually"))
|
(threadDelay 5000000 >> runLogger ($(logWarn) $ "Killing cleanup thread (exceeded 5s timeout)... please remove leftover files in " <> T.pack recycleDir <> " manually"))
|
||||||
|
|
||||||
case optCommand of
|
case optCommand of
|
||||||
Nuke -> pure ()
|
Nuke -> pure ()
|
||||||
@@ -1489,7 +1477,7 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
Interactive -> pure ()
|
Interactive -> pure ()
|
||||||
#endif
|
#endif
|
||||||
_ -> lookupEnv "GHCUP_SKIP_UPDATE_CHECK" >>= \case
|
_ -> lookupEnv "GHCUP_SKIP_UPDATE_CHECK" >>= \case
|
||||||
Nothing -> flip runReaderT s' checkForUpdates
|
Nothing -> runLogger $ flip runReaderT s' $ checkForUpdates
|
||||||
Just _ -> pure ()
|
Just _ -> pure ()
|
||||||
|
|
||||||
-- TODO: always run for windows
|
-- TODO: always run for windows
|
||||||
@@ -1497,7 +1485,7 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
VRight _ -> pure ()
|
VRight _ -> pure ()
|
||||||
VLeft e -> do
|
VLeft e -> do
|
||||||
runLogger
|
runLogger
|
||||||
(logError $ T.pack $ prettyShow e)
|
($(logError) $ T.pack $ prettyShow e)
|
||||||
exitWith (ExitFailure 30)
|
exitWith (ExitFailure 30)
|
||||||
pure s'
|
pure s'
|
||||||
|
|
||||||
@@ -1522,7 +1510,8 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
|
|
||||||
|
|
||||||
let runInstTool' appstate' mInstPlatform =
|
let runInstTool' appstate' mInstPlatform =
|
||||||
flip runReaderT (maybe appstate' (\x -> appstate'{ pfreq = x } :: AppState) mInstPlatform)
|
runLogger
|
||||||
|
. flip runReaderT (maybe appstate' (\x -> appstate'{ pfreq = x } :: AppState) mInstPlatform)
|
||||||
. runResourceT
|
. runResourceT
|
||||||
. runE
|
. runE
|
||||||
@'[ AlreadyInstalled
|
@'[ AlreadyInstalled
|
||||||
@@ -1550,7 +1539,8 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
|
|
||||||
let
|
let
|
||||||
runLeanSetGHC =
|
runLeanSetGHC =
|
||||||
runLeanAppState
|
runLogger
|
||||||
|
. runLeanAppState
|
||||||
. runE
|
. runE
|
||||||
@'[ FileDoesNotExistError
|
@'[ FileDoesNotExistError
|
||||||
, NotInstalled
|
, NotInstalled
|
||||||
@@ -1560,7 +1550,8 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
]
|
]
|
||||||
|
|
||||||
runSetGHC =
|
runSetGHC =
|
||||||
runAppState
|
runLogger
|
||||||
|
. runAppState
|
||||||
. runE
|
. runE
|
||||||
@'[ FileDoesNotExistError
|
@'[ FileDoesNotExistError
|
||||||
, NotInstalled
|
, NotInstalled
|
||||||
@@ -1571,7 +1562,8 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
|
|
||||||
let
|
let
|
||||||
runLeanSetCabal =
|
runLeanSetCabal =
|
||||||
runLeanAppState
|
runLogger
|
||||||
|
. runLeanAppState
|
||||||
. runE
|
. runE
|
||||||
@'[ NotInstalled
|
@'[ NotInstalled
|
||||||
, TagNotFound
|
, TagNotFound
|
||||||
@@ -1580,7 +1572,8 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
]
|
]
|
||||||
|
|
||||||
runSetCabal =
|
runSetCabal =
|
||||||
runAppState
|
runLogger
|
||||||
|
. runAppState
|
||||||
. runE
|
. runE
|
||||||
@'[ NotInstalled
|
@'[ NotInstalled
|
||||||
, TagNotFound
|
, TagNotFound
|
||||||
@@ -1590,7 +1583,8 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
|
|
||||||
let
|
let
|
||||||
runSetHLS =
|
runSetHLS =
|
||||||
runAppState
|
runLogger
|
||||||
|
. runAppState
|
||||||
. runE
|
. runE
|
||||||
@'[ NotInstalled
|
@'[ NotInstalled
|
||||||
, TagNotFound
|
, TagNotFound
|
||||||
@@ -1599,7 +1593,8 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
]
|
]
|
||||||
|
|
||||||
runLeanSetHLS =
|
runLeanSetHLS =
|
||||||
runLeanAppState
|
runLogger
|
||||||
|
. runLeanAppState
|
||||||
. runE
|
. runE
|
||||||
@'[ NotInstalled
|
@'[ NotInstalled
|
||||||
, TagNotFound
|
, TagNotFound
|
||||||
@@ -1607,21 +1602,23 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
, NoToolVersionSet
|
, NoToolVersionSet
|
||||||
]
|
]
|
||||||
|
|
||||||
let runListGHC = runAppState
|
let runListGHC = runLogger . runAppState
|
||||||
|
|
||||||
let runRm =
|
let runRm =
|
||||||
runAppState . runE @'[NotInstalled]
|
runLogger . runAppState . runE @'[NotInstalled]
|
||||||
|
|
||||||
let runNuke s' =
|
let runNuke s' =
|
||||||
flip runReaderT s' . runE @'[NotInstalled]
|
runLogger . flip runReaderT s' . runE @'[NotInstalled]
|
||||||
|
|
||||||
let runDebugInfo =
|
let runDebugInfo =
|
||||||
runAppState
|
runLogger
|
||||||
|
. runAppState
|
||||||
. runE
|
. runE
|
||||||
@'[NoCompatiblePlatform , NoCompatibleArch , DistroNotFound]
|
@'[NoCompatiblePlatform , NoCompatibleArch , DistroNotFound]
|
||||||
|
|
||||||
let runCompileGHC =
|
let runCompileGHC =
|
||||||
runAppState
|
runLogger
|
||||||
|
. runAppState
|
||||||
. runResourceT
|
. runResourceT
|
||||||
. runE
|
. runE
|
||||||
@'[ AlreadyInstalled
|
@'[ AlreadyInstalled
|
||||||
@@ -1641,9 +1638,10 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
|
|
||||||
let
|
let
|
||||||
runLeanWhereIs =
|
runLeanWhereIs =
|
||||||
|
runLogger
|
||||||
-- Don't use runLeanAppState here, which is disabled on windows.
|
-- Don't use runLeanAppState here, which is disabled on windows.
|
||||||
-- This is the only command on all platforms that doesn't need full appstate.
|
-- This is the only command on all platforms that doesn't need full appstate.
|
||||||
flip runReaderT leanAppstate
|
. flip runReaderT leanAppstate
|
||||||
. runE
|
. runE
|
||||||
@'[ NotInstalled
|
@'[ NotInstalled
|
||||||
, NoToolVersionSet
|
, NoToolVersionSet
|
||||||
@@ -1652,7 +1650,8 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
]
|
]
|
||||||
|
|
||||||
runWhereIs =
|
runWhereIs =
|
||||||
runAppState
|
runLogger
|
||||||
|
. runAppState
|
||||||
. runE
|
. runE
|
||||||
@'[ NotInstalled
|
@'[ NotInstalled
|
||||||
, NoToolVersionSet
|
, NoToolVersionSet
|
||||||
@@ -1661,7 +1660,8 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
]
|
]
|
||||||
|
|
||||||
let runUpgrade =
|
let runUpgrade =
|
||||||
runAppState
|
runLogger
|
||||||
|
. runAppState
|
||||||
. runResourceT
|
. runResourceT
|
||||||
. runE
|
. runE
|
||||||
@'[ DigestError
|
@'[ DigestError
|
||||||
@@ -1673,7 +1673,8 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
]
|
]
|
||||||
|
|
||||||
let runPrefetch =
|
let runPrefetch =
|
||||||
runAppState
|
runLogger
|
||||||
|
. runAppState
|
||||||
. runResourceT
|
. runResourceT
|
||||||
. runE
|
. runE
|
||||||
@'[ TagNotFound
|
@'[ TagNotFound
|
||||||
@@ -1711,25 +1712,25 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
)
|
)
|
||||||
>>= \case
|
>>= \case
|
||||||
VRight vi -> do
|
VRight vi -> do
|
||||||
runLogger $ logInfo "GHC installation successful"
|
runLogger $ $(logInfo) "GHC installation successful"
|
||||||
forM_ (_viPostInstall =<< vi) $ \msg ->
|
forM_ (_viPostInstall =<< vi) $ \msg ->
|
||||||
runLogger $ logInfo msg
|
runLogger $ $(logInfo) msg
|
||||||
pure ExitSuccess
|
pure ExitSuccess
|
||||||
VLeft (V (AlreadyInstalled _ v)) -> do
|
VLeft (V (AlreadyInstalled _ v)) -> do
|
||||||
runLogger $ logWarn $
|
runLogger $ $(logWarn) $
|
||||||
"GHC ver " <> prettyVer v <> " already installed; if you really want to reinstall it, you may want to run 'ghcup rm ghc " <> prettyVer v <> "' first"
|
"GHC ver " <> prettyVer v <> " already installed; if you really want to reinstall it, you may want to run 'ghcup rm ghc " <> prettyVer v <> "' first"
|
||||||
pure ExitSuccess
|
pure ExitSuccess
|
||||||
VLeft err@(V (BuildFailed tmpdir _)) -> do
|
VLeft err@(V (BuildFailed tmpdir _)) -> do
|
||||||
case keepDirs settings of
|
case keepDirs settings of
|
||||||
Never -> runLogger $ (logError $ T.pack $ prettyShow err)
|
Never -> myLoggerT loggerConfig $ ($(logError) $ T.pack $ prettyShow err)
|
||||||
_ -> runLogger $ (logError $ T.pack (prettyShow err) <> "\n" <>
|
_ -> myLoggerT loggerConfig $ ($(logError) $ T.pack (prettyShow err) <> "\n" <>
|
||||||
"Check the logs at " <> T.pack logsDir <> " and the build directory " <> T.pack tmpdir <> " for more clues." <> "\n" <>
|
"Check the logs at " <> T.pack logsDir <> " and the build directory " <> T.pack tmpdir <> " for more clues." <> "\n" <>
|
||||||
"Make sure to clean up " <> T.pack tmpdir <> " afterwards.")
|
"Make sure to clean up " <> T.pack tmpdir <> " afterwards.")
|
||||||
pure $ ExitFailure 3
|
pure $ ExitFailure 3
|
||||||
VLeft e -> do
|
VLeft e -> do
|
||||||
runLogger $ do
|
runLogger $ do
|
||||||
logError $ T.pack $ prettyShow e
|
$(logError) $ T.pack $ prettyShow e
|
||||||
logError $ "Also check the logs in " <> T.pack logsDir
|
$(logError) $ "Also check the logs in " <> T.pack logsDir
|
||||||
pure $ ExitFailure 3
|
pure $ ExitFailure 3
|
||||||
|
|
||||||
|
|
||||||
@@ -1751,18 +1752,18 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
)
|
)
|
||||||
>>= \case
|
>>= \case
|
||||||
VRight vi -> do
|
VRight vi -> do
|
||||||
runLogger $ logInfo "Cabal installation successful"
|
runLogger $ $(logInfo) "Cabal installation successful"
|
||||||
forM_ (_viPostInstall =<< vi) $ \msg ->
|
forM_ (_viPostInstall =<< vi) $ \msg ->
|
||||||
runLogger $ logInfo msg
|
runLogger $ $(logInfo) msg
|
||||||
pure ExitSuccess
|
pure ExitSuccess
|
||||||
VLeft (V (AlreadyInstalled _ v)) -> do
|
VLeft (V (AlreadyInstalled _ v)) -> do
|
||||||
runLogger $ logWarn $
|
runLogger $ $(logWarn) $
|
||||||
"Cabal ver " <> prettyVer v <> " already installed; if you really want to reinstall it, you may want to run 'ghcup rm cabal " <> prettyVer v <> "' first"
|
"Cabal ver " <> prettyVer v <> " already installed; if you really want to reinstall it, you may want to run 'ghcup rm cabal " <> prettyVer v <> "' first"
|
||||||
pure ExitSuccess
|
pure ExitSuccess
|
||||||
VLeft e -> do
|
VLeft e -> do
|
||||||
runLogger $ do
|
runLogger $ do
|
||||||
logError $ T.pack $ prettyShow e
|
$(logError) $ T.pack $ prettyShow e
|
||||||
logError $ "Also check the logs in " <> T.pack logsDir
|
$(logError) $ "Also check the logs in " <> T.pack logsDir
|
||||||
pure $ ExitFailure 4
|
pure $ ExitFailure 4
|
||||||
|
|
||||||
let installHLS InstallOptions{..} =
|
let installHLS InstallOptions{..} =
|
||||||
@@ -1783,12 +1784,12 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
)
|
)
|
||||||
>>= \case
|
>>= \case
|
||||||
VRight vi -> do
|
VRight vi -> do
|
||||||
runLogger $ logInfo "HLS installation successful"
|
runLogger $ $(logInfo) "HLS installation successful"
|
||||||
forM_ (_viPostInstall =<< vi) $ \msg ->
|
forM_ (_viPostInstall =<< vi) $ \msg ->
|
||||||
runLogger $ logInfo msg
|
runLogger $ $(logInfo) msg
|
||||||
pure ExitSuccess
|
pure ExitSuccess
|
||||||
VLeft (V (AlreadyInstalled _ v)) -> do
|
VLeft (V (AlreadyInstalled _ v)) -> do
|
||||||
runLogger $ logWarn $
|
runLogger $ $(logWarn) $
|
||||||
"HLS ver "
|
"HLS ver "
|
||||||
<> prettyVer v
|
<> prettyVer v
|
||||||
<> " already installed; if you really want to reinstall it, you may want to run 'ghcup rm hls "
|
<> " already installed; if you really want to reinstall it, you may want to run 'ghcup rm hls "
|
||||||
@@ -1797,8 +1798,8 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
pure ExitSuccess
|
pure ExitSuccess
|
||||||
VLeft e -> do
|
VLeft e -> do
|
||||||
runLogger $ do
|
runLogger $ do
|
||||||
logError $ T.pack $ prettyShow e
|
$(logError) $ T.pack $ prettyShow e
|
||||||
logError $ "Also check the logs in " <> T.pack logsDir
|
$(logError) $ "Also check the logs in " <> T.pack logsDir
|
||||||
pure $ ExitFailure 4
|
pure $ ExitFailure 4
|
||||||
|
|
||||||
let installStack InstallOptions{..} =
|
let installStack InstallOptions{..} =
|
||||||
@@ -1819,18 +1820,18 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
)
|
)
|
||||||
>>= \case
|
>>= \case
|
||||||
VRight vi -> do
|
VRight vi -> do
|
||||||
runLogger $ logInfo "Stack installation successful"
|
runLogger $ $(logInfo) "Stack installation successful"
|
||||||
forM_ (_viPostInstall =<< vi) $ \msg ->
|
forM_ (_viPostInstall =<< vi) $ \msg ->
|
||||||
runLogger $ logInfo msg
|
runLogger $ $(logInfo) msg
|
||||||
pure ExitSuccess
|
pure ExitSuccess
|
||||||
VLeft (V (AlreadyInstalled _ v)) -> do
|
VLeft (V (AlreadyInstalled _ v)) -> do
|
||||||
runLogger $ logWarn $
|
runLogger $ $(logWarn) $
|
||||||
"Stack ver " <> prettyVer v <> " already installed; if you really want to reinstall it, you may want to run 'ghcup rm stack " <> prettyVer v <> "' first"
|
"Stack ver " <> prettyVer v <> " already installed; if you really want to reinstall it, you may want to run 'ghcup rm stack " <> prettyVer v <> "' first"
|
||||||
pure ExitSuccess
|
pure ExitSuccess
|
||||||
VLeft e -> do
|
VLeft e -> do
|
||||||
runLogger $ do
|
runLogger $ do
|
||||||
logError $ T.pack $ prettyShow e
|
$(logError) $ T.pack $ prettyShow e
|
||||||
logError $ "Also check the logs in " <> T.pack logsDir
|
$(logError) $ "Also check the logs in " <> T.pack logsDir
|
||||||
pure $ ExitFailure 4
|
pure $ ExitFailure 4
|
||||||
|
|
||||||
|
|
||||||
@@ -1844,11 +1845,11 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
>>= \case
|
>>= \case
|
||||||
VRight GHCTargetVersion{..} -> do
|
VRight GHCTargetVersion{..} -> do
|
||||||
runLogger
|
runLogger
|
||||||
$ logInfo $
|
$ $(logInfo) $
|
||||||
"GHC " <> prettyVer _tvVersion <> " successfully set as default version" <> maybe "" (" for cross target " <>) _tvTarget
|
"GHC " <> prettyVer _tvVersion <> " successfully set as default version" <> maybe "" (" for cross target " <>) _tvTarget
|
||||||
pure ExitSuccess
|
pure ExitSuccess
|
||||||
VLeft e -> do
|
VLeft e -> do
|
||||||
runLogger $ logError $ T.pack $ prettyShow e
|
runLogger $ $(logError) $ T.pack $ prettyShow e
|
||||||
pure $ ExitFailure 5
|
pure $ ExitFailure 5
|
||||||
|
|
||||||
let setCabal' SetOptions{ sToolVer } =
|
let setCabal' SetOptions{ sToolVer } =
|
||||||
@@ -1862,11 +1863,11 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
>>= \case
|
>>= \case
|
||||||
VRight GHCTargetVersion{..} -> do
|
VRight GHCTargetVersion{..} -> do
|
||||||
runLogger
|
runLogger
|
||||||
$ logInfo $
|
$ $(logInfo) $
|
||||||
"Cabal " <> prettyVer _tvVersion <> " successfully set as default version"
|
"Cabal " <> prettyVer _tvVersion <> " successfully set as default version"
|
||||||
pure ExitSuccess
|
pure ExitSuccess
|
||||||
VLeft e -> do
|
VLeft e -> do
|
||||||
runLogger $ logError $ T.pack $ prettyShow e
|
runLogger $ $(logError) $ T.pack $ prettyShow e
|
||||||
pure $ ExitFailure 14
|
pure $ ExitFailure 14
|
||||||
|
|
||||||
let setHLS' SetOptions{ sToolVer } =
|
let setHLS' SetOptions{ sToolVer } =
|
||||||
@@ -1880,11 +1881,11 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
>>= \case
|
>>= \case
|
||||||
VRight GHCTargetVersion{..} -> do
|
VRight GHCTargetVersion{..} -> do
|
||||||
runLogger
|
runLogger
|
||||||
$ logInfo $
|
$ $(logInfo) $
|
||||||
"HLS " <> prettyVer _tvVersion <> " successfully set as default version"
|
"HLS " <> prettyVer _tvVersion <> " successfully set as default version"
|
||||||
pure ExitSuccess
|
pure ExitSuccess
|
||||||
VLeft e -> do
|
VLeft e -> do
|
||||||
runLogger $ logError $ T.pack $ prettyShow e
|
runLogger $ $(logError) $ T.pack $ prettyShow e
|
||||||
pure $ ExitFailure 14
|
pure $ ExitFailure 14
|
||||||
|
|
||||||
let setStack' SetOptions{ sToolVer } =
|
let setStack' SetOptions{ sToolVer } =
|
||||||
@@ -1898,11 +1899,11 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
>>= \case
|
>>= \case
|
||||||
VRight GHCTargetVersion{..} -> do
|
VRight GHCTargetVersion{..} -> do
|
||||||
runLogger
|
runLogger
|
||||||
$ logInfo $
|
$ $(logInfo) $
|
||||||
"Stack " <> prettyVer _tvVersion <> " successfully set as default version"
|
"Stack " <> prettyVer _tvVersion <> " successfully set as default version"
|
||||||
pure ExitSuccess
|
pure ExitSuccess
|
||||||
VLeft e -> do
|
VLeft e -> do
|
||||||
runLogger $ logError $ T.pack $ prettyShow e
|
runLogger $ $(logError) $ T.pack $ prettyShow e
|
||||||
pure $ ExitFailure 14
|
pure $ ExitFailure 14
|
||||||
|
|
||||||
let rmGHC' RmOptions{..} =
|
let rmGHC' RmOptions{..} =
|
||||||
@@ -1915,10 +1916,10 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
>>= \case
|
>>= \case
|
||||||
VRight vi -> do
|
VRight vi -> do
|
||||||
forM_ (_viPostRemove =<< vi) $ \msg ->
|
forM_ (_viPostRemove =<< vi) $ \msg ->
|
||||||
runLogger $ logInfo msg
|
runLogger $ $(logInfo) msg
|
||||||
pure ExitSuccess
|
pure ExitSuccess
|
||||||
VLeft e -> do
|
VLeft e -> do
|
||||||
runLogger $ logError $ T.pack $ prettyShow e
|
runLogger $ $(logError) $ T.pack $ prettyShow e
|
||||||
pure $ ExitFailure 7
|
pure $ ExitFailure 7
|
||||||
|
|
||||||
let rmCabal' tv =
|
let rmCabal' tv =
|
||||||
@@ -1931,10 +1932,10 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
>>= \case
|
>>= \case
|
||||||
VRight vi -> do
|
VRight vi -> do
|
||||||
forM_ (_viPostRemove =<< vi) $ \msg ->
|
forM_ (_viPostRemove =<< vi) $ \msg ->
|
||||||
runLogger $ logInfo msg
|
runLogger $ $(logInfo) msg
|
||||||
pure ExitSuccess
|
pure ExitSuccess
|
||||||
VLeft e -> do
|
VLeft e -> do
|
||||||
runLogger $ logError $ T.pack $ prettyShow e
|
runLogger $ $(logError) $ T.pack $ prettyShow e
|
||||||
pure $ ExitFailure 15
|
pure $ ExitFailure 15
|
||||||
|
|
||||||
let rmHLS' tv =
|
let rmHLS' tv =
|
||||||
@@ -1947,10 +1948,10 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
>>= \case
|
>>= \case
|
||||||
VRight vi -> do
|
VRight vi -> do
|
||||||
forM_ (_viPostRemove =<< vi) $ \msg ->
|
forM_ (_viPostRemove =<< vi) $ \msg ->
|
||||||
runLogger $ logInfo msg
|
runLogger $ $(logInfo) msg
|
||||||
pure ExitSuccess
|
pure ExitSuccess
|
||||||
VLeft e -> do
|
VLeft e -> do
|
||||||
runLogger $ logError $ T.pack $ prettyShow e
|
runLogger $ $(logError) $ T.pack $ prettyShow e
|
||||||
pure $ ExitFailure 15
|
pure $ ExitFailure 15
|
||||||
|
|
||||||
let rmStack' tv =
|
let rmStack' tv =
|
||||||
@@ -1963,31 +1964,31 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
>>= \case
|
>>= \case
|
||||||
VRight vi -> do
|
VRight vi -> do
|
||||||
forM_ (_viPostRemove =<< vi) $ \msg ->
|
forM_ (_viPostRemove =<< vi) $ \msg ->
|
||||||
runLogger $ logInfo msg
|
runLogger $ $(logInfo) msg
|
||||||
pure ExitSuccess
|
pure ExitSuccess
|
||||||
VLeft e -> do
|
VLeft e -> do
|
||||||
runLogger $ logError $ T.pack $ prettyShow e
|
runLogger $ $(logError) $ T.pack $ prettyShow e
|
||||||
pure $ ExitFailure 15
|
pure $ ExitFailure 15
|
||||||
|
|
||||||
res <- case optCommand of
|
res <- case optCommand of
|
||||||
#if defined(BRICK)
|
#if defined(BRICK)
|
||||||
Interactive -> do
|
Interactive -> do
|
||||||
s' <- appState
|
s' <- appState
|
||||||
liftIO $ brickMain s' >> pure ExitSuccess
|
liftIO $ brickMain s' loggerConfig >> pure ExitSuccess
|
||||||
#endif
|
#endif
|
||||||
Install (Right iopts) -> do
|
Install (Right iopts) -> do
|
||||||
runLogger (logWarn "This is an old-style command for installing GHC. Use 'ghcup install ghc' instead.")
|
runLogger ($(logWarn) "This is an old-style command for installing GHC. Use 'ghcup install ghc' instead.")
|
||||||
installGHC iopts
|
installGHC iopts
|
||||||
Install (Left (InstallGHC iopts)) -> installGHC iopts
|
Install (Left (InstallGHC iopts)) -> installGHC iopts
|
||||||
Install (Left (InstallCabal iopts)) -> installCabal iopts
|
Install (Left (InstallCabal iopts)) -> installCabal iopts
|
||||||
Install (Left (InstallHLS iopts)) -> installHLS iopts
|
Install (Left (InstallHLS iopts)) -> installHLS iopts
|
||||||
Install (Left (InstallStack iopts)) -> installStack iopts
|
Install (Left (InstallStack iopts)) -> installStack iopts
|
||||||
InstallCabalLegacy iopts -> do
|
InstallCabalLegacy iopts -> do
|
||||||
runLogger (logWarn "This is an old-style command for installing cabal. Use 'ghcup install cabal' instead.")
|
runLogger ($(logWarn) "This is an old-style command for installing cabal. Use 'ghcup install cabal' instead.")
|
||||||
installCabal iopts
|
installCabal iopts
|
||||||
|
|
||||||
Set (Right sopts) -> do
|
Set (Right sopts) -> do
|
||||||
runLogger (logWarn "This is an old-style command for setting GHC. Use 'ghcup set ghc' instead.")
|
runLogger ($(logWarn) "This is an old-style command for setting GHC. Use 'ghcup set ghc' instead.")
|
||||||
setGHC' sopts
|
setGHC' sopts
|
||||||
Set (Left (SetGHC sopts)) -> setGHC' sopts
|
Set (Left (SetGHC sopts)) -> setGHC' sopts
|
||||||
Set (Left (SetCabal sopts)) -> setCabal' sopts
|
Set (Left (SetCabal sopts)) -> setCabal' sopts
|
||||||
@@ -2002,7 +2003,7 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
)
|
)
|
||||||
|
|
||||||
Rm (Right rmopts) -> do
|
Rm (Right rmopts) -> do
|
||||||
runLogger (logWarn "This is an old-style command for removing GHC. Use 'ghcup rm ghc' instead.")
|
runLogger ($(logWarn) "This is an old-style command for removing GHC. Use 'ghcup rm ghc' instead.")
|
||||||
rmGHC' rmopts
|
rmGHC' rmopts
|
||||||
Rm (Left (RmGHC rmopts)) -> rmGHC' rmopts
|
Rm (Left (RmGHC rmopts)) -> rmGHC' rmopts
|
||||||
Rm (Left (RmCabal rmopts)) -> rmCabal' rmopts
|
Rm (Left (RmCabal rmopts)) -> rmCabal' rmopts
|
||||||
@@ -2016,11 +2017,11 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
putStrLn $ prettyDebugInfo dinfo
|
putStrLn $ prettyDebugInfo dinfo
|
||||||
pure ExitSuccess
|
pure ExitSuccess
|
||||||
VLeft e -> do
|
VLeft e -> do
|
||||||
runLogger $ logError $ T.pack $ prettyShow e
|
runLogger $ $(logError) $ T.pack $ prettyShow e
|
||||||
pure $ ExitFailure 8
|
pure $ ExitFailure 8
|
||||||
|
|
||||||
Compile (CompileGHC GHCCompileOptions { hadrian = True, crossTarget = Just _ }) -> do
|
Compile (CompileGHC GHCCompileOptions { hadrian = True, crossTarget = Just _ }) -> do
|
||||||
runLogger $ logError "Hadrian cross compile support is not yet implemented!"
|
runLogger $ $(logError) "Hadrian cross compile support is not yet implemented!"
|
||||||
pure $ ExitFailure 9
|
pure $ ExitFailure 9
|
||||||
Compile (CompileGHC GHCCompileOptions {..}) ->
|
Compile (CompileGHC GHCCompileOptions {..}) ->
|
||||||
runCompileGHC (do
|
runCompileGHC (do
|
||||||
@@ -2029,8 +2030,8 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
GHCupInfo { _ghcupDownloads = dls } <- lift getGHCupInfo
|
GHCupInfo { _ghcupDownloads = dls } <- lift getGHCupInfo
|
||||||
let vi = getVersionInfo targetVer GHC dls
|
let vi = getVersionInfo targetVer GHC dls
|
||||||
forM_ (_viPreCompile =<< vi) $ \msg -> do
|
forM_ (_viPreCompile =<< vi) $ \msg -> do
|
||||||
lift $ logInfo msg
|
lift $ $(logInfo) msg
|
||||||
lift $ logInfo
|
lift $ $(logInfo)
|
||||||
"...waiting for 5 seconds, you can still abort..."
|
"...waiting for 5 seconds, you can still abort..."
|
||||||
liftIO $ threadDelay 5000000 -- for compilation, give the user a sec to intervene
|
liftIO $ threadDelay 5000000 -- for compilation, give the user a sec to intervene
|
||||||
Right _ -> pure ()
|
Right _ -> pure ()
|
||||||
@@ -2053,32 +2054,32 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
)
|
)
|
||||||
>>= \case
|
>>= \case
|
||||||
VRight (vi, tv) -> do
|
VRight (vi, tv) -> do
|
||||||
runLogger $ logInfo
|
runLogger $ $(logInfo)
|
||||||
"GHC successfully compiled and installed"
|
"GHC successfully compiled and installed"
|
||||||
forM_ (_viPostInstall =<< vi) $ \msg ->
|
forM_ (_viPostInstall =<< vi) $ \msg ->
|
||||||
runLogger $ logInfo msg
|
runLogger $ $(logInfo) msg
|
||||||
putStr (T.unpack $ tVerToText tv)
|
putStr (T.unpack $ tVerToText tv)
|
||||||
pure ExitSuccess
|
pure ExitSuccess
|
||||||
VLeft (V (AlreadyInstalled _ v)) -> do
|
VLeft (V (AlreadyInstalled _ v)) -> do
|
||||||
runLogger $ logWarn $
|
runLogger $ $(logWarn) $
|
||||||
"GHC ver " <> prettyVer v <> " already installed; if you really want to reinstall it, you may want to run 'ghcup rm ghc " <> prettyVer v <> "' first"
|
"GHC ver " <> prettyVer v <> " already installed; if you really want to reinstall it, you may want to run 'ghcup rm ghc " <> prettyVer v <> "' first"
|
||||||
pure ExitSuccess
|
pure ExitSuccess
|
||||||
VLeft err@(V (BuildFailed tmpdir _)) -> do
|
VLeft err@(V (BuildFailed tmpdir _)) -> do
|
||||||
case keepDirs settings of
|
case keepDirs settings of
|
||||||
Never -> runLogger $ logError $ T.pack $ prettyShow err
|
Never -> myLoggerT loggerConfig $ $(logError) $ T.pack $ prettyShow err
|
||||||
_ -> runLogger $ (logError $ T.pack (prettyShow err) <> "\n" <>
|
_ -> myLoggerT loggerConfig $ ($(logError) $ T.pack (prettyShow err) <> "\n" <>
|
||||||
"Check the logs at " <> T.pack logsDir <> " and the build directory "
|
"Check the logs at " <> T.pack logsDir <> " and the build directory "
|
||||||
<> T.pack tmpdir <> " for more clues." <> "\n" <>
|
<> T.pack tmpdir <> " for more clues." <> "\n" <>
|
||||||
"Make sure to clean up " <> T.pack tmpdir <> " afterwards.")
|
"Make sure to clean up " <> T.pack tmpdir <> " afterwards.")
|
||||||
pure $ ExitFailure 9
|
pure $ ExitFailure 9
|
||||||
VLeft e -> do
|
VLeft e -> do
|
||||||
runLogger $ logError $ T.pack $ prettyShow e
|
runLogger $ $(logError) $ T.pack $ prettyShow e
|
||||||
pure $ ExitFailure 9
|
pure $ ExitFailure 9
|
||||||
|
|
||||||
Config InitConfig -> do
|
Config InitConfig -> do
|
||||||
path <- getConfigFilePath
|
path <- getConfigFilePath
|
||||||
writeFile path $ formatConfig $ fromSettings settings (Just keybindings)
|
writeFile path $ formatConfig $ fromSettings settings (Just keybindings)
|
||||||
runLogger $ logDebug $ "config.yaml initialized at " <> T.pack path
|
runLogger $ $(logDebug) $ "config.yaml initialized at " <> T.pack path
|
||||||
pure ExitSuccess
|
pure ExitSuccess
|
||||||
|
|
||||||
Config ShowConfig -> do
|
Config ShowConfig -> do
|
||||||
@@ -2088,20 +2089,20 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
Config (SetConfig k v) -> do
|
Config (SetConfig k v) -> do
|
||||||
case v of
|
case v of
|
||||||
"" -> do
|
"" -> do
|
||||||
runLogger $ logError "Empty values are not allowed"
|
runLogger $ $(logError) "Empty values are not allowed"
|
||||||
pure $ ExitFailure 55
|
pure $ ExitFailure 55
|
||||||
_ -> do
|
_ -> do
|
||||||
r <- runE @'[JSONError] $ do
|
r <- runE @'[JSONError] $ do
|
||||||
settings' <- updateSettings (UTF8.fromString (k <> ": " <> v <> "\n")) settings
|
settings' <- updateSettings (UTF8.fromString (k <> ": " <> v <> "\n")) settings
|
||||||
path <- liftIO getConfigFilePath
|
path <- liftIO getConfigFilePath
|
||||||
liftIO $ writeFile path $ formatConfig $ fromSettings settings' (Just keybindings)
|
liftIO $ writeFile path $ formatConfig $ fromSettings settings' (Just keybindings)
|
||||||
runLogger $ logDebug $ T.pack $ show settings'
|
runLogger $ $(logDebug) $ T.pack $ show settings'
|
||||||
pure ()
|
pure ()
|
||||||
|
|
||||||
case r of
|
case r of
|
||||||
VRight _ -> pure ExitSuccess
|
VRight _ -> pure ExitSuccess
|
||||||
VLeft (V (JSONDecodeError e)) -> do
|
VLeft (V (JSONDecodeError e)) -> do
|
||||||
runLogger $ logError $ "Error decoding config: " <> T.pack e
|
runLogger $ $(logError) $ "Error decoding config: " <> T.pack e
|
||||||
pure $ ExitFailure 65
|
pure $ ExitFailure 65
|
||||||
VLeft _ -> pure $ ExitFailure 65
|
VLeft _ -> pure $ ExitFailure 65
|
||||||
|
|
||||||
@@ -2117,7 +2118,7 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
putStr r
|
putStr r
|
||||||
pure ExitSuccess
|
pure ExitSuccess
|
||||||
VLeft e -> do
|
VLeft e -> do
|
||||||
runLogger $ logError $ T.pack $ prettyShow e
|
runLogger $ $(logError) $ T.pack $ prettyShow e
|
||||||
pure $ ExitFailure 30
|
pure $ ExitFailure 30
|
||||||
|
|
||||||
Whereis WhereisOptions{..} (WhereisTool tool whereVer) ->
|
Whereis WhereisOptions{..} (WhereisTool tool whereVer) ->
|
||||||
@@ -2133,7 +2134,7 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
putStr r
|
putStr r
|
||||||
pure ExitSuccess
|
pure ExitSuccess
|
||||||
VLeft e -> do
|
VLeft e -> do
|
||||||
runLogger $ logError $ T.pack $ prettyShow e
|
runLogger $ $(logError) $ T.pack $ prettyShow e
|
||||||
pure $ ExitFailure 30
|
pure $ ExitFailure 30
|
||||||
|
|
||||||
Upgrade uOpts force' -> do
|
Upgrade uOpts force' -> do
|
||||||
@@ -2150,22 +2151,23 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
VRight (v', dls) -> do
|
VRight (v', dls) -> do
|
||||||
let pretty_v = prettyVer v'
|
let pretty_v = prettyVer v'
|
||||||
let vi = fromJust $ snd <$> getLatest dls GHCup
|
let vi = fromJust $ snd <$> getLatest dls GHCup
|
||||||
runLogger $ logInfo $
|
runLogger $ $(logInfo) $
|
||||||
"Successfully upgraded GHCup to version " <> pretty_v
|
"Successfully upgraded GHCup to version " <> pretty_v
|
||||||
forM_ (_viPostInstall vi) $ \msg ->
|
forM_ (_viPostInstall vi) $ \msg ->
|
||||||
runLogger $ logInfo msg
|
runLogger $ $(logInfo) msg
|
||||||
pure ExitSuccess
|
pure ExitSuccess
|
||||||
VLeft (V NoUpdate) -> do
|
VLeft (V NoUpdate) -> do
|
||||||
runLogger $ logWarn "No GHCup update available"
|
runLogger $ $(logWarn) "No GHCup update available"
|
||||||
pure ExitSuccess
|
pure ExitSuccess
|
||||||
VLeft e -> do
|
VLeft e -> do
|
||||||
runLogger $ logError $ T.pack $ prettyShow e
|
runLogger $ $(logError) $ T.pack $ prettyShow e
|
||||||
pure $ ExitFailure 11
|
pure $ ExitFailure 11
|
||||||
|
|
||||||
ToolRequirements -> do
|
ToolRequirements -> do
|
||||||
s' <- appState
|
s' <- appState
|
||||||
flip runReaderT s'
|
flip runReaderT s'
|
||||||
$ (runE
|
$ runLogger
|
||||||
|
(runE
|
||||||
@'[NoCompatiblePlatform , DistroNotFound , NoToolRequirements]
|
@'[NoCompatiblePlatform , DistroNotFound , NoToolRequirements]
|
||||||
$ do
|
$ do
|
||||||
GHCupInfo { .. } <- lift getGHCupInfo
|
GHCupInfo { .. } <- lift getGHCupInfo
|
||||||
@@ -2176,7 +2178,7 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
>>= \case
|
>>= \case
|
||||||
VRight _ -> pure ExitSuccess
|
VRight _ -> pure ExitSuccess
|
||||||
VLeft e -> do
|
VLeft e -> do
|
||||||
runLogger $ logError $ T.pack $ prettyShow e
|
runLogger $ $(logError) $ T.pack $ prettyShow e
|
||||||
pure $ ExitFailure 12
|
pure $ ExitFailure 12
|
||||||
|
|
||||||
ChangeLog ChangeLogOptions{..} -> do
|
ChangeLog ChangeLogOptions{..} -> do
|
||||||
@@ -2193,7 +2195,7 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
case muri of
|
case muri of
|
||||||
Nothing -> do
|
Nothing -> do
|
||||||
runLogger
|
runLogger
|
||||||
(logWarn $
|
($(logWarn) $
|
||||||
"Could not find ChangeLog for " <> T.pack (prettyShow tool) <> ", version " <> either prettyVer (T.pack . show) ver'
|
"Could not find ChangeLog for " <> T.pack (prettyShow tool) <> ", version " <> either prettyVer (T.pack . show) ver'
|
||||||
)
|
)
|
||||||
pure ExitSuccess
|
pure ExitSuccess
|
||||||
@@ -2216,7 +2218,7 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
Nothing
|
Nothing
|
||||||
>>= \case
|
>>= \case
|
||||||
Right _ -> pure ExitSuccess
|
Right _ -> pure ExitSuccess
|
||||||
Left e -> logError (T.pack $ prettyShow e)
|
Left e -> runLogger ($(logError) (T.pack $ prettyShow e))
|
||||||
>> pure (ExitFailure 13)
|
>> pure (ExitFailure 13)
|
||||||
else putStrLn uri' >> pure ExitSuccess
|
else putStrLn uri' >> pure ExitSuccess
|
||||||
|
|
||||||
@@ -2224,12 +2226,12 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
s' <- liftIO appState
|
s' <- liftIO appState
|
||||||
void $ liftIO $ evaluate $ force s'
|
void $ liftIO $ evaluate $ force s'
|
||||||
runNuke s' (do
|
runNuke s' (do
|
||||||
lift $ logWarn "WARNING: This will remove GHCup and all installed components from your system."
|
lift $ $logWarn "WARNING: This will remove GHCup and all installed components from your system."
|
||||||
lift $ logWarn "Waiting 10 seconds before commencing, if you want to cancel it, now would be the time."
|
lift $ $logWarn "Waiting 10 seconds before commencing, if you want to cancel it, now would be the time."
|
||||||
liftIO $ threadDelay 10000000 -- wait 10s
|
liftIO $ threadDelay 10000000 -- wait 10s
|
||||||
|
|
||||||
lift $ logInfo "Initiating Nuclear Sequence 🚀🚀🚀"
|
lift $ $logInfo "Initiating Nuclear Sequence 🚀🚀🚀"
|
||||||
lift $ logInfo "Nuking in 3...2...1"
|
lift $ $logInfo "Nuking in 3...2...1"
|
||||||
|
|
||||||
lInstalled <- lift $ listVersions Nothing (Just ListInstalled)
|
lInstalled <- lift $ listVersions Nothing (Just ListInstalled)
|
||||||
|
|
||||||
@@ -2240,15 +2242,15 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
) >>= \case
|
) >>= \case
|
||||||
VRight leftOverFiles
|
VRight leftOverFiles
|
||||||
| null leftOverFiles -> do
|
| null leftOverFiles -> do
|
||||||
runLogger $ logInfo "Nuclear Annihilation complete!"
|
runLogger $ $logInfo "Nuclear Annihilation complete!"
|
||||||
pure ExitSuccess
|
pure ExitSuccess
|
||||||
| otherwise -> do
|
| otherwise -> do
|
||||||
runLogger $ logError "These Files have survived Nuclear Annihilation, you may remove them manually."
|
runLogger $ $logError "These Files have survived Nuclear Annihilation, you may remove them manually."
|
||||||
forM_ leftOverFiles putStrLn
|
forM_ leftOverFiles putStrLn
|
||||||
pure ExitSuccess
|
pure ExitSuccess
|
||||||
|
|
||||||
VLeft e -> do
|
VLeft e -> do
|
||||||
runLogger $ logError $ T.pack $ prettyShow e
|
runLogger $ $(logError) $ T.pack $ prettyShow e
|
||||||
pure $ ExitFailure 15
|
pure $ ExitFailure 15
|
||||||
Prefetch pfCom ->
|
Prefetch pfCom ->
|
||||||
runPrefetch (do
|
runPrefetch (do
|
||||||
@@ -2279,7 +2281,7 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
VRight _ -> do
|
VRight _ -> do
|
||||||
pure ExitSuccess
|
pure ExitSuccess
|
||||||
VLeft e -> do
|
VLeft e -> do
|
||||||
runLogger $ logError $ T.pack $ prettyShow e
|
runLogger $ $(logError) $ T.pack $ prettyShow e
|
||||||
pure $ ExitFailure 15
|
pure $ ExitFailure 15
|
||||||
|
|
||||||
|
|
||||||
@@ -2290,7 +2292,7 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
|
|
||||||
pure ()
|
pure ()
|
||||||
|
|
||||||
fromVersion :: ( HasLog env
|
fromVersion :: ( MonadLogger m
|
||||||
, MonadFail m
|
, MonadFail m
|
||||||
, MonadReader env m
|
, MonadReader env m
|
||||||
, HasGHCupInfo env
|
, HasGHCupInfo env
|
||||||
@@ -2308,7 +2310,7 @@ fromVersion :: ( HasLog env
|
|||||||
] m (GHCTargetVersion, Maybe VersionInfo)
|
] m (GHCTargetVersion, Maybe VersionInfo)
|
||||||
fromVersion tv = fromVersion' (toSetToolVer tv)
|
fromVersion tv = fromVersion' (toSetToolVer tv)
|
||||||
|
|
||||||
fromVersion' :: ( HasLog env
|
fromVersion' :: ( MonadLogger m
|
||||||
, MonadFail m
|
, MonadFail m
|
||||||
, MonadReader env m
|
, MonadReader env m
|
||||||
, HasGHCupInfo env
|
, HasGHCupInfo env
|
||||||
@@ -2554,10 +2556,11 @@ checkForUpdates :: ( MonadReader env m
|
|||||||
, HasDirs env
|
, HasDirs env
|
||||||
, HasPlatformReq env
|
, HasPlatformReq env
|
||||||
, MonadCatch m
|
, MonadCatch m
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, MonadFail m
|
, MonadFail m
|
||||||
|
, MonadLogger m
|
||||||
)
|
)
|
||||||
=> m ()
|
=> m ()
|
||||||
checkForUpdates = do
|
checkForUpdates = do
|
||||||
@@ -2568,35 +2571,35 @@ checkForUpdates = do
|
|||||||
forM_ (getLatest dls GHCup) $ \(l, _) -> do
|
forM_ (getLatest dls GHCup) $ \(l, _) -> do
|
||||||
(Right ghc_ver) <- pure $ version $ prettyPVP ghcUpVer
|
(Right ghc_ver) <- pure $ version $ prettyPVP ghcUpVer
|
||||||
when (l > ghc_ver)
|
when (l > ghc_ver)
|
||||||
$ logWarn $
|
$ $(logWarn) $
|
||||||
"New GHCup version available: " <> prettyVer l <> ". To upgrade, run 'ghcup upgrade'"
|
"New GHCup version available: " <> prettyVer l <> ". To upgrade, run 'ghcup upgrade'"
|
||||||
|
|
||||||
forM_ (getLatest dls GHC) $ \(l, _) -> do
|
forM_ (getLatest dls GHC) $ \(l, _) -> do
|
||||||
let mghc_ver = latestInstalled GHC
|
let mghc_ver = latestInstalled GHC
|
||||||
forM mghc_ver $ \ghc_ver ->
|
forM mghc_ver $ \ghc_ver ->
|
||||||
when (l > ghc_ver)
|
when (l > ghc_ver)
|
||||||
$ logWarn $
|
$ $(logWarn) $
|
||||||
"New GHC version available: " <> prettyVer l <> ". To upgrade, run 'ghcup install ghc " <> prettyVer l <> "'"
|
"New GHC version available: " <> prettyVer l <> ". To upgrade, run 'ghcup install ghc " <> prettyVer l <> "'"
|
||||||
|
|
||||||
forM_ (getLatest dls Cabal) $ \(l, _) -> do
|
forM_ (getLatest dls Cabal) $ \(l, _) -> do
|
||||||
let mcabal_ver = latestInstalled Cabal
|
let mcabal_ver = latestInstalled Cabal
|
||||||
forM mcabal_ver $ \cabal_ver ->
|
forM mcabal_ver $ \cabal_ver ->
|
||||||
when (l > cabal_ver)
|
when (l > cabal_ver)
|
||||||
$ logWarn $
|
$ $(logWarn) $
|
||||||
"New Cabal version available: " <> prettyVer l <> ". To upgrade, run 'ghcup install cabal " <> prettyVer l <> "'"
|
"New Cabal version available: " <> prettyVer l <> ". To upgrade, run 'ghcup install cabal " <> prettyVer l <> "'"
|
||||||
|
|
||||||
forM_ (getLatest dls HLS) $ \(l, _) -> do
|
forM_ (getLatest dls HLS) $ \(l, _) -> do
|
||||||
let mhls_ver = latestInstalled HLS
|
let mhls_ver = latestInstalled HLS
|
||||||
forM mhls_ver $ \hls_ver ->
|
forM mhls_ver $ \hls_ver ->
|
||||||
when (l > hls_ver)
|
when (l > hls_ver)
|
||||||
$ logWarn $
|
$ $(logWarn) $
|
||||||
"New HLS version available: " <> prettyVer l <> ". To upgrade, run 'ghcup install hls " <> prettyVer l <> "'"
|
"New HLS version available: " <> prettyVer l <> ". To upgrade, run 'ghcup install hls " <> prettyVer l <> "'"
|
||||||
|
|
||||||
forM_ (getLatest dls Stack) $ \(l, _) -> do
|
forM_ (getLatest dls Stack) $ \(l, _) -> do
|
||||||
let mstack_ver = latestInstalled Stack
|
let mstack_ver = latestInstalled Stack
|
||||||
forM mstack_ver $ \stack_ver ->
|
forM mstack_ver $ \stack_ver ->
|
||||||
when (l > stack_ver)
|
when (l > stack_ver)
|
||||||
$ logWarn $
|
$ $(logWarn) $
|
||||||
"New Stack version available: " <> prettyVer l <> ". To upgrade, run 'ghcup install stack " <> prettyVer l <> "'"
|
"New Stack version available: " <> prettyVer l <> ". To upgrade, run 'ghcup install stack " <> prettyVer l <> "'"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
# Main settings:
|
# Main settings:
|
||||||
# * BOOTSTRAP_HASKELL_NONINTERACTIVE - any nonzero value for noninteractive installation
|
# * BOOTSTRAP_HASKELL_NONINTERACTIVE - any nonzero value for noninteractive installation
|
||||||
# * BOOTSTRAP_HASKELL_NO_UPGRADE - any nonzero value to not trigger the upgrade
|
# * BOOTSTRAP_HASKELL_NO_UPGRADE - any nonzero value to not trigger the upgrade
|
||||||
# * BOOTSTRAP_HASKELL_MINIMAL - any nonzero value to only install ghcup
|
|
||||||
# * GHCUP_USE_XDG_DIRS - any nonzero value to respect The XDG Base Directory Specification
|
# * GHCUP_USE_XDG_DIRS - any nonzero value to respect The XDG Base Directory Specification
|
||||||
# * BOOTSTRAP_HASKELL_VERBOSE - any nonzero value for more verbose installation
|
# * BOOTSTRAP_HASKELL_VERBOSE - any nonzero value for more verbose installation
|
||||||
# * BOOTSTRAP_HASKELL_GHC_VERSION - the ghc version to install
|
# * BOOTSTRAP_HASKELL_GHC_VERSION - the ghc version to install
|
||||||
@@ -592,12 +591,10 @@ ask_bashrc
|
|||||||
ask_bashrc_answer=$?
|
ask_bashrc_answer=$?
|
||||||
ask_cabal_config_init
|
ask_cabal_config_init
|
||||||
ask_cabal_config_init_answer=$?
|
ask_cabal_config_init_answer=$?
|
||||||
if [ -z "${BOOTSTRAP_HASKELL_MINIMAL}" ] ; then
|
ask_hls
|
||||||
ask_hls
|
ask_hls_answer=$?
|
||||||
ask_hls_answer=$?
|
ask_stack
|
||||||
ask_stack
|
ask_stack_answer=$?
|
||||||
ask_stack_answer=$?
|
|
||||||
fi
|
|
||||||
|
|
||||||
edo mkdir -p "${GHCUP_BIN}"
|
edo mkdir -p "${GHCUP_BIN}"
|
||||||
|
|
||||||
@@ -623,30 +620,14 @@ if [ -z "${BOOTSTRAP_HASKELL_NONINTERACTIVE}" ] ; then
|
|||||||
read -r answer </dev/tty
|
read -r answer </dev/tty
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${BOOTSTRAP_HASKELL_MINIMAL}" ] ; then
|
eghcup --cache install ghc "${BOOTSTRAP_HASKELL_GHC_VERSION}"
|
||||||
eghcup --cache install ghc "${BOOTSTRAP_HASKELL_GHC_VERSION}"
|
|
||||||
|
|
||||||
eghcup set ghc "${BOOTSTRAP_HASKELL_GHC_VERSION}"
|
eghcup set ghc "${BOOTSTRAP_HASKELL_GHC_VERSION}"
|
||||||
eghcup --cache install cabal "${BOOTSTRAP_HASKELL_CABAL_VERSION}"
|
eghcup --cache install cabal "${BOOTSTRAP_HASKELL_CABAL_VERSION}"
|
||||||
|
|
||||||
do_cabal_config_init $ask_cabal_config_init_answer
|
do_cabal_config_init $ask_cabal_config_init_answer
|
||||||
|
|
||||||
edo cabal new-update
|
edo cabal new-update
|
||||||
else # don't install ghc and cabal
|
|
||||||
case "${plat}" in
|
|
||||||
MSYS*|MINGW*)
|
|
||||||
# need to bootstrap cabal to initialize config on windows
|
|
||||||
# we'll remove it afterwards
|
|
||||||
tmp_dir="$(mktemp -d)"
|
|
||||||
eghcup --cache install cabal -i "${tmp_dir}" "${BOOTSTRAP_HASKELL_CABAL_VERSION}"
|
|
||||||
PATH="${tmp_dir}:$PATH" do_cabal_config_init $ask_cabal_config_init_answer
|
|
||||||
rm "${tmp_dir}/cabal"
|
|
||||||
unset tmp_dir
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
case $ask_hls_answer in
|
case $ask_hls_answer in
|
||||||
1)
|
1)
|
||||||
|
|||||||
@@ -15,26 +15,24 @@
|
|||||||
param (
|
param (
|
||||||
# Run an interactive installation
|
# Run an interactive installation
|
||||||
[switch]$Interactive,
|
[switch]$Interactive,
|
||||||
# Do minimal installation of ghcup and msys2 only
|
# Specify the install root (default: 'C:\')
|
||||||
[switch]$Minimal,
|
[string]$InstallDir,
|
||||||
# Run the final bootstrap script via 'bash' instead of a full newly spawned msys2 shell
|
# Instead of installing a new MSys2, use an existing installation
|
||||||
[switch]$InBash,
|
[string]$ExistingMsys2Dir,
|
||||||
|
# Specify the cabal root directory (default: '$InstallDir\cabal')
|
||||||
|
[string]$CabalDir,
|
||||||
# Overwrite (or rather backup) a previous install
|
# Overwrite (or rather backup) a previous install
|
||||||
[switch]$Overwrite,
|
[switch]$Overwrite,
|
||||||
# Skip adjusting cabal.config with mingw paths
|
# Specify the bootstrap url (default: 'https://www.haskell.org/ghcup/sh/bootstrap-haskell')
|
||||||
[switch]$NoAdjustCabalConfig,
|
[string]$BootstrapUrl,
|
||||||
|
# Run the final bootstrap script via 'bash' instead of a full newly spawned msys2 shell
|
||||||
|
[switch]$InBash,
|
||||||
# Whether to install stack as well
|
# Whether to install stack as well
|
||||||
[switch]$InstallStack,
|
[switch]$InstallStack,
|
||||||
# Whether to install hls as well
|
# Whether to install hls as well
|
||||||
[switch]$InstallHLS,
|
[switch]$InstallHLS,
|
||||||
# Specify the bootstrap url (default: 'https://www.haskell.org/ghcup/sh/bootstrap-haskell')
|
# Skip adjusting cabal.config with mingw paths
|
||||||
[string]$InstallDir,
|
[switch]$NoAdjustCabalConfig
|
||||||
# Instead of installing a new MSys2, use an existing installation
|
|
||||||
[string]$BootstrapUrl,
|
|
||||||
# Specify the install root (default: 'C:\')
|
|
||||||
[string]$ExistingMsys2Dir,
|
|
||||||
# Specify the cabal root directory (default: '$InstallDir\cabal')
|
|
||||||
[string]$CabalDir
|
|
||||||
)
|
)
|
||||||
|
|
||||||
$Silent = !$Interactive
|
$Silent = !$Interactive
|
||||||
@@ -182,7 +180,7 @@ elevated command prompt:
|
|||||||
|
|
||||||
if ($GhcupBasePrefixEnv) {
|
if ($GhcupBasePrefixEnv) {
|
||||||
$defaultGhcupBasePrefix = $GhcupBasePrefixEnv
|
$defaultGhcupBasePrefix = $GhcupBasePrefixEnv
|
||||||
} elseif (!($InstallDir)) {
|
} else {
|
||||||
$partitions = Get-CimInstance win32_logicaldisk
|
$partitions = Get-CimInstance win32_logicaldisk
|
||||||
$defaultGhcupBasePrefix = $null
|
$defaultGhcupBasePrefix = $null
|
||||||
foreach ($p in $partitions){
|
foreach ($p in $partitions){
|
||||||
@@ -211,10 +209,10 @@ if ($Silent -and !($InstallDir)) {
|
|||||||
$GhcupBasePrefix = $defaultGhcupBasePrefix
|
$GhcupBasePrefix = $defaultGhcupBasePrefix
|
||||||
} elseif ($InstallDir) {
|
} elseif ($InstallDir) {
|
||||||
if (!(Test-Path -LiteralPath ('{0}' -f $InstallDir) -IsValid)) {
|
if (!(Test-Path -LiteralPath ('{0}' -f $InstallDir) -IsValid)) {
|
||||||
Print-Msg -color Red -msg "Not a valid directory! (InstallDir)"
|
Print-Msg -color Red -msg "Not a valid directory!"
|
||||||
Exit 1
|
Exit 1
|
||||||
} elseif (!(Split-Path -IsAbsolute -Path "$InstallDir")) {
|
} elseif (!(Split-Path -IsAbsolute -Path "$InstallDir")) {
|
||||||
Print-Msg -color Red -msg "Non-absolute Path specified! (InstallDir)"
|
Print-Msg -color Red -msg "Non-absolute Path specified!"
|
||||||
Exit 1
|
Exit 1
|
||||||
} else {
|
} else {
|
||||||
$GhcupBasePrefix = $InstallDir
|
$GhcupBasePrefix = $InstallDir
|
||||||
@@ -245,20 +243,7 @@ $null = [Environment]::SetEnvironmentVariable("GHCUP_INSTALL_BASE_PREFIX", $Ghcu
|
|||||||
|
|
||||||
|
|
||||||
$GhcupDir = ('{0}\ghcup' -f $GhcupBasePrefix)
|
$GhcupDir = ('{0}\ghcup' -f $GhcupBasePrefix)
|
||||||
if ($ExistingMsys2Dir) {
|
$MsysDir = ('{0}\msys64' -f $GhcupDir)
|
||||||
if (!(Test-Path -LiteralPath ('{0}' -f $ExistingMsys2Dir) -IsValid)) {
|
|
||||||
Print-Msg -color Red -msg "Not a valid directory! (ExistingMsys2Dir)"
|
|
||||||
Exit 1
|
|
||||||
} elseif (!(Split-Path -IsAbsolute -Path "$ExistingMsys2Dir")) {
|
|
||||||
Print-Msg -color Red -msg "Non-absolute Path specified! (ExistingMsys2Dir)"
|
|
||||||
Exit 1
|
|
||||||
} else {
|
|
||||||
$MsysDir = $ExistingMsys2Dir
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$MsysDir = ('{0}\msys64' -f $GhcupDir)
|
|
||||||
}
|
|
||||||
|
|
||||||
$Bash = ('{0}\usr\bin\bash' -f $MsysDir)
|
$Bash = ('{0}\usr\bin\bash' -f $MsysDir)
|
||||||
if (!($BootstrapUrl)) {
|
if (!($BootstrapUrl)) {
|
||||||
$BootstrapUrl = 'https://www.haskell.org/ghcup/sh/bootstrap-haskell'
|
$BootstrapUrl = 'https://www.haskell.org/ghcup/sh/bootstrap-haskell'
|
||||||
@@ -544,14 +529,10 @@ if (!($NoAdjustCabalConfig)) {
|
|||||||
$AdjustCabalConfigExport = 'export BOOTSTRAP_HASKELL_ADJUST_CABAL_CONFIG=1 ;'
|
$AdjustCabalConfigExport = 'export BOOTSTRAP_HASKELL_ADJUST_CABAL_CONFIG=1 ;'
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($Minimal) {
|
|
||||||
$MinimalExport = 'export BOOTSTRAP_HASKELL_MINIMAL=1 ;'
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((Get-Process -ID $PID).ProcessName.StartsWith("bootstrap-haskell") -Or $InBash) {
|
if ((Get-Process -ID $PID).ProcessName.StartsWith("bootstrap-haskell") -Or $InBash) {
|
||||||
Exec "$Bash" '-lc' ('{4} {6} {7} {8} {9} [ -n ''{1}'' ] && export GHCUP_MSYS2=$(cygpath -m ''{1}'') ; [ -n ''{2}'' ] && export GHCUP_INSTALL_BASE_PREFIX=$(cygpath -m ''{2}/'') ; export PATH=$(cygpath -u ''{3}/bin''):$PATH ; export CABAL_DIR=''{5}'' ; [[ ''{0}'' = https* ]] && curl --proto ''=https'' --tlsv1.2 -sSf {0} | bash || cat $(cygpath -m ''{0}'') | bash' -f $BootstrapUrl, $MsysDir, $GhcupBasePrefix, $GhcupDir, $SilentExport, $CabalDirFull, $StackInstallExport, $HLSInstallExport, $AdjustCabalConfigExport, $MinimalExport)
|
Exec "$Bash" '-lc' ('{4} {6} {7} {8} [ -n ''{1}'' ] && export GHCUP_MSYS2=$(cygpath -m ''{1}'') ; [ -n ''{2}'' ] && export GHCUP_INSTALL_BASE_PREFIX=$(cygpath -m ''{2}/'') ; export PATH=$(cygpath -u ''{3}/bin''):$PATH ; export CABAL_DIR=''{5}'' ; [[ ''{0}'' = https* ]] && curl --proto ''=https'' --tlsv1.2 -sSf {0} | bash || cat $(cygpath -m ''{0}'') | bash' -f $BootstrapUrl, $MsysDir, $GhcupBasePrefix, $GhcupDir, $SilentExport, $CabalDirFull, $StackInstallExport, $HLSInstallExport, $AdjustCabalConfigExport)
|
||||||
} else {
|
} else {
|
||||||
Exec "$Msys2Shell" '-mingw64' '-mintty' '-c' ('{4} {6} {7} {8} {9} [ -n ''{1}'' ] && export GHCUP_MSYS2=$(cygpath -m ''{1}'') ; [ -n ''{2}'' ] && export GHCUP_INSTALL_BASE_PREFIX=$(cygpath -m ''{2}/'') ; export PATH=$(cygpath -u ''{3}/bin''):$PATH ; export CABAL_DIR=''{5}'' ; trap ''echo Press any key to exit && read -n 1 && exit'' 2 ; [[ ''{0}'' = https* ]] && curl --proto ''=https'' --tlsv1.2 -sSf {0} | bash || cat $(cygpath -m ''{0}'') | bash ; echo ''Press any key to exit'' && read -n 1' -f $BootstrapUrl, $MsysDir, $GhcupBasePrefix, $GhcupDir, $SilentExport, $CabalDirFull, $StackInstallExport, $HLSInstallExport, $AdjustCabalConfigExport, $MinimalExport)
|
Exec "$Msys2Shell" '-mingw64' '-mintty' '-c' ('{4} {6} {7} {8} [ -n ''{1}'' ] && export GHCUP_MSYS2=$(cygpath -m ''{1}'') ; [ -n ''{2}'' ] && export GHCUP_INSTALL_BASE_PREFIX=$(cygpath -m ''{2}/'') ; export PATH=$(cygpath -u ''{3}/bin''):$PATH ; export CABAL_DIR=''{5}'' ; trap ''echo Press any key to exit && read -n 1 && exit'' 2 ; [[ ''{0}'' = https* ]] && curl --proto ''=https'' --tlsv1.2 -sSf {0} | bash || cat $(cygpath -m ''{0}'') | bash ; echo ''Press any key to exit'' && read -n 1' -f $BootstrapUrl, $MsysDir, $GhcupBasePrefix, $GhcupDir, $SilentExport, $CabalDirFull, $StackInstallExport, $HLSInstallExport, $AdjustCabalConfigExport)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,25 +10,24 @@ package ghcup
|
|||||||
|
|
||||||
source-repository-package
|
source-repository-package
|
||||||
type: git
|
type: git
|
||||||
location: https://github.com/bgamari/terminal-size
|
location: https://github.com/jtdaugherty/brick.git
|
||||||
tag: 34ea816bd63f75f800eedac12c6908c6f3736036
|
tag: b3b96cfe66dfd398d338e3feb2b6855e66a35190
|
||||||
|
|
||||||
source-repository-package
|
source-repository-package
|
||||||
type: git
|
type: git
|
||||||
location: https://github.com/hasufell/libarchive
|
location: https://github.com/Bodigrim/tar
|
||||||
tag: 8587aab78dd515928024ecd82c8f215e06db85cd
|
tag: ac197ec7ea4838dc2b4e22b9b888b080cedf29cf
|
||||||
|
|
||||||
|
source-repository-package
|
||||||
|
type: git
|
||||||
|
location: https://github.com/bgamari/terminal-size
|
||||||
|
tag: 34ea816bd63f75f800eedac12c6908c6f3736036
|
||||||
|
|
||||||
constraints: http-io-streams -brotli
|
constraints: http-io-streams -brotli
|
||||||
|
|
||||||
package libarchive
|
package libarchive
|
||||||
flags: -system-libarchive
|
flags: -system-libarchive
|
||||||
|
|
||||||
package aeson-pretty
|
|
||||||
flags: +lib-only
|
|
||||||
|
|
||||||
package cabal-plan
|
|
||||||
flags: -exe
|
|
||||||
|
|
||||||
allow-newer: base, ghc-prim, template-haskell, language-c
|
allow-newer: base, ghc-prim, template-haskell, language-c
|
||||||
|
|
||||||
with-compiler: ghc-8.10.7
|
with-compiler: ghc-8.10.5
|
||||||
@@ -1,18 +1,15 @@
|
|||||||
active-repositories: hackage.haskell.org:merge
|
active-repositories: hackage.haskell.org:merge
|
||||||
constraints: any.Cabal ==3.2.1.0,
|
constraints: any.Cabal ==3.2.1.0,
|
||||||
any.HUnit ==1.6.2.0,
|
any.HUnit ==1.6.2.0,
|
||||||
any.HsOpenSSL ==0.11.7.1,
|
any.HsOpenSSL ==0.11.7,
|
||||||
HsOpenSSL -fast-bignum -homebrew-openssl -macports-openssl -use-pkg-config,
|
HsOpenSSL -fast-bignum -homebrew-openssl -macports-openssl -use-pkg-config,
|
||||||
any.HsYAML ==0.2.1.0,
|
|
||||||
HsYAML -exe,
|
|
||||||
any.HsYAML-aeson ==0.2.0.0,
|
|
||||||
any.QuickCheck ==2.14.2,
|
any.QuickCheck ==2.14.2,
|
||||||
QuickCheck -old-random +templatehaskell,
|
QuickCheck -old-random +templatehaskell,
|
||||||
any.StateVar ==1.2.2,
|
any.StateVar ==1.2.2,
|
||||||
any.aeson ==1.5.6.0,
|
any.aeson ==1.5.6.0,
|
||||||
aeson -bytestring-builder -cffi -developer -fast,
|
aeson -bytestring-builder -cffi -developer -fast,
|
||||||
any.aeson-pretty ==0.8.8,
|
any.aeson-pretty ==0.8.8,
|
||||||
aeson-pretty +lib-only,
|
aeson-pretty -lib-only,
|
||||||
any.alex ==3.2.6,
|
any.alex ==3.2.6,
|
||||||
alex +small_base,
|
alex +small_base,
|
||||||
any.ansi-terminal ==0.11,
|
any.ansi-terminal ==0.11,
|
||||||
@@ -25,7 +22,8 @@ constraints: any.Cabal ==3.2.1.0,
|
|||||||
async -bench,
|
async -bench,
|
||||||
any.attoparsec ==0.13.2.5,
|
any.attoparsec ==0.13.2.5,
|
||||||
attoparsec -developer,
|
attoparsec -developer,
|
||||||
any.base ==4.14.3.0,
|
any.auto-update ==0.1.6,
|
||||||
|
any.base ==4.14.2.0,
|
||||||
any.base-compat ==0.11.2,
|
any.base-compat ==0.11.2,
|
||||||
any.base-compat-batteries ==0.11.2,
|
any.base-compat-batteries ==0.11.2,
|
||||||
any.base-orphans ==0.8.4,
|
any.base-orphans ==0.8.4,
|
||||||
@@ -34,34 +32,41 @@ constraints: any.Cabal ==3.2.1.0,
|
|||||||
any.bifunctors ==5.5.11,
|
any.bifunctors ==5.5.11,
|
||||||
bifunctors +semigroups +tagged,
|
bifunctors +semigroups +tagged,
|
||||||
any.binary ==0.8.8.0,
|
any.binary ==0.8.8.0,
|
||||||
|
any.bindings-DSL ==1.0.25,
|
||||||
any.blaze-builder ==0.4.2.1,
|
any.blaze-builder ==0.4.2.1,
|
||||||
any.brick ==0.64,
|
any.brick ==0.63,
|
||||||
brick -demos,
|
brick -demos,
|
||||||
any.bytestring ==0.10.12.0,
|
any.bytestring ==0.10.12.0,
|
||||||
any.bz2 ==1.0.1.0,
|
any.bz2 ==1.0.1.0,
|
||||||
bz2 -cross +with-bzlib,
|
bz2 -cross +with-bzlib,
|
||||||
|
any.bzlib-conduit ==0.3.0.2,
|
||||||
any.c2hs ==0.28.8,
|
any.c2hs ==0.28.8,
|
||||||
c2hs +base3 -regression,
|
c2hs +base3 -regression,
|
||||||
any.cabal-plan ==0.7.2.0,
|
|
||||||
cabal-plan -_ -exe -license-report,
|
|
||||||
any.call-stack ==0.4.0,
|
any.call-stack ==0.4.0,
|
||||||
any.case-insensitive ==1.2.1.0,
|
any.case-insensitive ==1.2.1.0,
|
||||||
any.casing ==0.1.4.1,
|
any.casing ==0.1.4.1,
|
||||||
|
any.cereal ==0.5.8.1,
|
||||||
|
cereal -bytestring-builder,
|
||||||
any.chs-cabal ==0.1.1.0,
|
any.chs-cabal ==0.1.1.0,
|
||||||
any.chs-deps ==0.1.0.0,
|
any.chs-deps ==0.1.0.0,
|
||||||
chs-deps -cross,
|
chs-deps -cross,
|
||||||
any.clock ==0.8.2,
|
any.clock ==0.8.2,
|
||||||
clock -llvm,
|
clock -llvm,
|
||||||
|
any.cmdargs ==0.10.21,
|
||||||
|
cmdargs +quotation -testprog,
|
||||||
any.colour ==2.3.6,
|
any.colour ==2.3.6,
|
||||||
any.comonad ==5.0.8,
|
any.comonad ==5.0.8,
|
||||||
comonad +containers +distributive +indexed-traversable,
|
comonad +containers +distributive +indexed-traversable,
|
||||||
any.composition-prelude ==3.0.0.2,
|
any.composition-prelude ==3.0.0.2,
|
||||||
composition-prelude -development,
|
composition-prelude -development,
|
||||||
any.concurrent-output ==1.10.12,
|
any.concurrent-output ==1.10.12,
|
||||||
|
any.conduit ==1.3.4.1,
|
||||||
|
any.conduit-extra ==1.3.5,
|
||||||
|
any.conduit-zstd ==0.0.2.0,
|
||||||
any.config-ini ==0.2.4.0,
|
any.config-ini ==0.2.4.0,
|
||||||
config-ini -enable-doctests,
|
config-ini -enable-doctests,
|
||||||
any.containers ==0.6.5.1,
|
any.containers ==0.6.4.1,
|
||||||
any.contravariant ==1.5.5,
|
any.contravariant ==1.5.4,
|
||||||
contravariant +semigroups +statevar +tagged,
|
contravariant +semigroups +statevar +tagged,
|
||||||
any.cpphs ==1.20.9.1,
|
any.cpphs ==1.20.9.1,
|
||||||
cpphs -old-locale,
|
cpphs -old-locale,
|
||||||
@@ -69,32 +74,44 @@ constraints: any.Cabal ==3.2.1.0,
|
|||||||
any.cryptohash-sha256 ==0.11.102.0,
|
any.cryptohash-sha256 ==0.11.102.0,
|
||||||
cryptohash-sha256 -exe +use-cbits,
|
cryptohash-sha256 -exe +use-cbits,
|
||||||
any.data-clist ==0.1.2.3,
|
any.data-clist ==0.1.2.3,
|
||||||
any.data-fix ==0.3.2,
|
any.data-default-class ==0.1.2.0,
|
||||||
|
any.data-fix ==0.3.1,
|
||||||
any.deepseq ==1.4.4.0,
|
any.deepseq ==1.4.4.0,
|
||||||
|
any.digest ==0.0.1.3,
|
||||||
|
digest -bytestring-in-base,
|
||||||
any.directory ==1.3.6.0,
|
any.directory ==1.3.6.0,
|
||||||
any.disk-free-space ==0.1.0.1,
|
any.disk-free-space ==0.1.0.1,
|
||||||
any.distributive ==0.6.2.1,
|
any.distributive ==0.6.2.1,
|
||||||
distributive +semigroups +tagged,
|
distributive +semigroups +tagged,
|
||||||
any.dlist ==1.0,
|
any.dlist ==1.0,
|
||||||
dlist -werror,
|
dlist -werror,
|
||||||
|
any.easy-file ==0.2.2,
|
||||||
|
any.errors ==2.3.0,
|
||||||
any.exceptions ==0.10.4,
|
any.exceptions ==0.10.4,
|
||||||
|
any.extra ==1.7.9,
|
||||||
|
any.fast-logger ==3.0.5,
|
||||||
any.filepath ==1.4.2.1,
|
any.filepath ==1.4.2.1,
|
||||||
any.free ==5.1.7,
|
any.free ==5.1.7,
|
||||||
any.generic-arbitrary ==0.1.0,
|
any.generic-arbitrary ==0.1.0,
|
||||||
any.ghc-boot-th ==8.10.7,
|
any.generics-sop ==0.5.1.1,
|
||||||
|
any.ghc-boot-th ==8.10.5,
|
||||||
any.ghc-byteorder ==4.11.0.0.10,
|
any.ghc-byteorder ==4.11.0.0.10,
|
||||||
any.ghc-prim ==0.6.1,
|
any.ghc-prim ==0.6.1,
|
||||||
any.happy ==1.20.0,
|
any.happy ==1.20.0,
|
||||||
any.hashable ==1.3.3.0,
|
any.hashable ==1.3.2.0,
|
||||||
hashable +integer-gmp -random-initial-seed,
|
hashable +integer-gmp -random-initial-seed,
|
||||||
|
any.haskell-src-exts ==1.23.1,
|
||||||
|
any.haskell-src-meta ==0.8.7,
|
||||||
any.haskus-utils-data ==1.4,
|
any.haskus-utils-data ==1.4,
|
||||||
any.haskus-utils-types ==1.5.1,
|
any.haskus-utils-types ==1.5.1,
|
||||||
any.haskus-utils-variant ==3.1,
|
any.haskus-utils-variant ==3.1,
|
||||||
|
any.hpath-filepath ==0.10.4,
|
||||||
|
any.hpath-posix ==0.13.3,
|
||||||
any.hsc2hs ==0.68.7,
|
any.hsc2hs ==0.68.7,
|
||||||
hsc2hs -in-ghc-tree,
|
hsc2hs -in-ghc-tree,
|
||||||
any.hspec ==2.7.10,
|
any.hspec ==2.7.10,
|
||||||
any.hspec-core ==2.7.10,
|
any.hspec-core ==2.7.10,
|
||||||
any.hspec-discover ==2.7.10 || ==2.8.3,
|
any.hspec-discover ==2.7.10 || ==2.8.2,
|
||||||
any.hspec-expectations ==0.8.2,
|
any.hspec-expectations ==0.8.2,
|
||||||
any.hspec-golden-aeson ==0.9.0.0,
|
any.hspec-golden-aeson ==0.9.0.0,
|
||||||
any.http-io-streams ==0.1.6.0,
|
any.http-io-streams ==0.1.6.0,
|
||||||
@@ -111,22 +128,34 @@ constraints: any.Cabal ==3.2.1.0,
|
|||||||
language-c -allwarnings +iecfpextension +usebytestrings,
|
language-c -allwarnings +iecfpextension +usebytestrings,
|
||||||
any.libarchive ==3.0.2.2,
|
any.libarchive ==3.0.2.2,
|
||||||
libarchive -cross -low-memory -system-libarchive,
|
libarchive -cross -low-memory -system-libarchive,
|
||||||
|
any.libyaml ==0.1.2,
|
||||||
|
libyaml -no-unicode -system-libyaml,
|
||||||
|
any.lifted-base ==0.2.3.12,
|
||||||
any.lzma-static ==5.2.5.4,
|
any.lzma-static ==5.2.5.4,
|
||||||
any.megaparsec ==9.0.1,
|
any.megaparsec ==9.0.1,
|
||||||
megaparsec -dev,
|
megaparsec -dev,
|
||||||
any.microlens ==0.4.12.0,
|
any.microlens ==0.4.12.0,
|
||||||
any.microlens-mtl ==0.2.0.1,
|
any.microlens-mtl ==0.2.0.1,
|
||||||
any.microlens-th ==0.4.3.10,
|
any.microlens-th ==0.4.3.10,
|
||||||
|
any.monad-control ==1.0.3,
|
||||||
|
any.monad-logger ==0.3.36,
|
||||||
|
monad-logger +template_haskell,
|
||||||
|
any.monad-loops ==0.4.3,
|
||||||
|
monad-loops +base4,
|
||||||
|
any.mono-traversable ==1.0.15.1,
|
||||||
any.mtl ==2.2.2,
|
any.mtl ==2.2.2,
|
||||||
any.network ==3.1.2.2,
|
any.network ==3.1.2.2,
|
||||||
network -devel,
|
network -devel,
|
||||||
any.network-uri ==2.6.4.1,
|
any.network-uri ==2.6.4.1,
|
||||||
|
any.old-locale ==1.0.0.7,
|
||||||
|
any.old-time ==1.1.0.3,
|
||||||
any.openssl-streams ==1.2.3.0,
|
any.openssl-streams ==1.2.3.0,
|
||||||
any.optics ==0.4,
|
any.optics ==0.4,
|
||||||
any.optics-core ==0.4,
|
any.optics-core ==0.4,
|
||||||
optics-core -explicit-generic-labels,
|
optics-core -explicit-generic-labels,
|
||||||
any.optics-extra ==0.4,
|
any.optics-extra ==0.4,
|
||||||
any.optics-th ==0.4,
|
any.optics-th ==0.4,
|
||||||
|
any.optics-vl ==0.2.1,
|
||||||
any.optparse-applicative ==0.16.1.0,
|
any.optparse-applicative ==0.16.1.0,
|
||||||
optparse-applicative +process,
|
optparse-applicative +process,
|
||||||
any.os-release ==1.0.2,
|
any.os-release ==1.0.2,
|
||||||
@@ -138,8 +167,8 @@ constraints: any.Cabal ==3.2.1.0,
|
|||||||
any.polyparse ==1.13,
|
any.polyparse ==1.13,
|
||||||
any.pretty ==1.1.3.6,
|
any.pretty ==1.1.3.6,
|
||||||
any.pretty-terminal ==0.1.0.0,
|
any.pretty-terminal ==0.1.0.0,
|
||||||
any.primitive ==0.7.2.0,
|
any.primitive ==0.7.1.0,
|
||||||
any.process ==1.6.13.2,
|
any.process ==1.6.9.0,
|
||||||
any.profunctors ==5.6.2,
|
any.profunctors ==5.6.2,
|
||||||
any.quickcheck-arbitrary-adt ==0.3.1.0,
|
any.quickcheck-arbitrary-adt ==0.3.1.0,
|
||||||
any.quickcheck-io ==0.2.0,
|
any.quickcheck-io ==0.2.0,
|
||||||
@@ -149,7 +178,7 @@ constraints: any.Cabal ==3.2.1.0,
|
|||||||
any.regex-base ==0.94.0.1,
|
any.regex-base ==0.94.0.1,
|
||||||
any.regex-posix ==0.96.0.1,
|
any.regex-posix ==0.96.0.1,
|
||||||
regex-posix -_regex-posix-clib,
|
regex-posix -_regex-posix-clib,
|
||||||
any.resourcet ==1.2.4.3,
|
any.resourcet ==1.2.4.2,
|
||||||
any.rts ==1.0.1,
|
any.rts ==1.0.1,
|
||||||
any.safe ==0.3.19,
|
any.safe ==0.3.19,
|
||||||
any.safe-exceptions ==0.1.7.2,
|
any.safe-exceptions ==0.1.7.2,
|
||||||
@@ -158,41 +187,55 @@ constraints: any.Cabal ==3.2.1.0,
|
|||||||
any.semigroupoids ==5.3.5,
|
any.semigroupoids ==5.3.5,
|
||||||
semigroupoids +comonad +containers +contravariant +distributive +tagged +unordered-containers,
|
semigroupoids +comonad +containers +contravariant +distributive +tagged +unordered-containers,
|
||||||
any.setenv ==0.1.1.3,
|
any.setenv ==0.1.1.3,
|
||||||
|
any.sop-core ==0.5.0.1,
|
||||||
any.split ==0.2.3.4,
|
any.split ==0.2.3.4,
|
||||||
any.splitmix ==0.1.0.3,
|
any.splitmix ==0.1.0.3,
|
||||||
splitmix -optimised-mixer,
|
splitmix -optimised-mixer,
|
||||||
any.stm ==2.5.0.1,
|
any.stm ==2.5.0.1,
|
||||||
|
any.stm-chans ==3.0.0.4,
|
||||||
|
any.streaming-commons ==0.2.2.1,
|
||||||
|
streaming-commons -use-bytestring-builder,
|
||||||
any.strict ==0.4.0.1,
|
any.strict ==0.4.0.1,
|
||||||
strict +assoc,
|
strict +assoc,
|
||||||
any.strict-base ==0.4.0.0,
|
any.strict-base ==0.4.0.0,
|
||||||
|
any.string-interpolate ==0.3.1.1,
|
||||||
|
string-interpolate -bytestring-builder -extended-benchmarks -text-builder,
|
||||||
|
any.syb ==0.7.2.1,
|
||||||
any.tagged ==0.8.6.1,
|
any.tagged ==0.8.6.1,
|
||||||
tagged +deepseq +transformers,
|
tagged +deepseq +transformers,
|
||||||
|
any.tar ==0.6.0.0,
|
||||||
any.template-haskell ==2.16.0.0,
|
any.template-haskell ==2.16.0.0,
|
||||||
any.temporary ==1.3,
|
any.temporary ==1.3,
|
||||||
any.terminal-progress-bar ==0.4.1,
|
any.terminal-progress-bar ==0.4.1,
|
||||||
any.terminal-size ==0.3.2.1,
|
any.terminal-size ==0.3.2.1,
|
||||||
any.terminfo ==0.4.1.4,
|
any.terminfo ==0.4.1.4,
|
||||||
any.text ==1.2.4.1,
|
any.text ==1.2.4.1,
|
||||||
|
any.text-conversions ==0.3.1,
|
||||||
any.text-zipper ==0.11,
|
any.text-zipper ==0.11,
|
||||||
any.tf-random ==0.5,
|
any.tf-random ==0.5,
|
||||||
any.th-abstraction ==0.4.2.0,
|
any.th-abstraction ==0.4.2.0,
|
||||||
any.th-compat ==0.1.2,
|
any.th-compat ==0.1.2,
|
||||||
|
any.th-expand-syns ==0.4.8.0,
|
||||||
any.th-lift ==0.8.2,
|
any.th-lift ==0.8.2,
|
||||||
any.th-lift-instances ==0.1.18,
|
any.th-lift-instances ==0.1.18,
|
||||||
|
any.th-orphans ==0.13.11,
|
||||||
|
any.th-reify-many ==0.1.9,
|
||||||
any.these ==1.1.1.1,
|
any.these ==1.1.1.1,
|
||||||
these +assoc,
|
these +assoc,
|
||||||
any.time ==1.9.3,
|
any.time ==1.9.3,
|
||||||
any.time-compat ==1.9.6,
|
any.time-compat ==1.9.6,
|
||||||
time-compat -old-locale,
|
time-compat -old-locale,
|
||||||
any.transformers ==0.5.6.2,
|
any.transformers ==0.5.6.2,
|
||||||
any.transformers-base ==0.4.6,
|
any.transformers-base ==0.4.5.2,
|
||||||
transformers-base +orphaninstances,
|
transformers-base +orphaninstances,
|
||||||
any.transformers-compat ==0.7,
|
any.transformers-compat ==0.7,
|
||||||
transformers-compat -five +five-three -four +generic-deriving +mtl -three -two,
|
transformers-compat -five +five-three -four +generic-deriving +mtl -three -two,
|
||||||
|
any.typed-process ==0.2.6.0,
|
||||||
any.unix ==2.7.2.2,
|
any.unix ==2.7.2.2,
|
||||||
any.unix-bytestring ==0.3.7.3,
|
any.unix-bytestring ==0.3.7.3,
|
||||||
any.unix-compat ==0.5.3,
|
any.unix-compat ==0.5.3,
|
||||||
unix-compat -old-time,
|
unix-compat -old-time,
|
||||||
|
any.unix-time ==0.4.7,
|
||||||
any.unliftio-core ==0.2.0.1,
|
any.unliftio-core ==0.2.0.1,
|
||||||
any.unordered-containers ==0.2.14.0,
|
any.unordered-containers ==0.2.14.0,
|
||||||
unordered-containers -debug,
|
unordered-containers -debug,
|
||||||
@@ -202,12 +245,20 @@ constraints: any.Cabal ==3.2.1.0,
|
|||||||
any.uuid-types ==1.0.5,
|
any.uuid-types ==1.0.5,
|
||||||
any.vector ==0.12.3.0,
|
any.vector ==0.12.3.0,
|
||||||
vector +boundschecks -internalchecks -unsafechecks -wall,
|
vector +boundschecks -internalchecks -unsafechecks -wall,
|
||||||
|
any.vector-algorithms ==0.8.0.4,
|
||||||
|
vector-algorithms +bench +boundschecks -internalchecks -llvm +properties -unsafechecks,
|
||||||
any.versions ==5.0.0,
|
any.versions ==5.0.0,
|
||||||
any.vty ==5.33,
|
any.vty ==5.33,
|
||||||
any.word-wrap ==0.4.1,
|
any.word-wrap ==0.4.1,
|
||||||
any.word8 ==0.1.3,
|
any.word8 ==0.1.3,
|
||||||
any.xor ==0.0.1.0,
|
any.xor ==0.0.1.0,
|
||||||
|
any.yaml ==0.11.5.0,
|
||||||
|
yaml +no-examples +no-exe,
|
||||||
|
any.zip ==1.7.1,
|
||||||
|
zip -dev -disable-bzip2 -disable-zstd,
|
||||||
any.zlib ==0.6.2.3,
|
any.zlib ==0.6.2.3,
|
||||||
zlib -bundled-c-zlib -non-blocking-ffi -pkg-config,
|
zlib -bundled-c-zlib -non-blocking-ffi -pkg-config,
|
||||||
any.zlib-bindings ==0.1.1.5
|
any.zlib-bindings ==0.1.1.5,
|
||||||
index-state: hackage.haskell.org 2021-08-29T16:24:29Z
|
any.zstd ==0.1.2.0,
|
||||||
|
zstd +standalone
|
||||||
|
index-state: hackage.haskell.org 2021-07-27T07:59:57Z
|
||||||
@@ -10,25 +10,24 @@ package ghcup
|
|||||||
|
|
||||||
source-repository-package
|
source-repository-package
|
||||||
type: git
|
type: git
|
||||||
location: https://github.com/bgamari/terminal-size
|
location: https://github.com/jtdaugherty/brick.git
|
||||||
tag: 34ea816bd63f75f800eedac12c6908c6f3736036
|
tag: b3b96cfe66dfd398d338e3feb2b6855e66a35190
|
||||||
|
|
||||||
source-repository-package
|
source-repository-package
|
||||||
type: git
|
type: git
|
||||||
location: https://github.com/hasufell/libarchive
|
location: https://github.com/Bodigrim/tar
|
||||||
tag: 8587aab78dd515928024ecd82c8f215e06db85cd
|
tag: ac197ec7ea4838dc2b4e22b9b888b080cedf29cf
|
||||||
|
|
||||||
|
source-repository-package
|
||||||
|
type: git
|
||||||
|
location: https://github.com/bgamari/terminal-size
|
||||||
|
tag: 34ea816bd63f75f800eedac12c6908c6f3736036
|
||||||
|
|
||||||
constraints: http-io-streams -brotli
|
constraints: http-io-streams -brotli
|
||||||
|
|
||||||
package libarchive
|
package libarchive
|
||||||
flags: -system-libarchive
|
flags: -system-libarchive
|
||||||
|
|
||||||
package aeson-pretty
|
|
||||||
flags: +lib-only
|
|
||||||
|
|
||||||
package cabal-plan
|
|
||||||
flags: -exe
|
|
||||||
|
|
||||||
allow-newer: base, ghc-prim, template-haskell, language-c
|
allow-newer: base, ghc-prim, template-haskell, language-c
|
||||||
|
|
||||||
with-compiler: ghc-9.0.1
|
with-compiler: ghc-9.0.1
|
||||||
|
|||||||
@@ -1,18 +1,15 @@
|
|||||||
active-repositories: hackage.haskell.org:merge
|
active-repositories: hackage.haskell.org:merge
|
||||||
constraints: any.Cabal ==3.4.0.0,
|
constraints: any.Cabal ==3.4.0.0,
|
||||||
any.HUnit ==1.6.2.0,
|
any.HUnit ==1.6.2.0,
|
||||||
any.HsOpenSSL ==0.11.7.1,
|
any.HsOpenSSL ==0.11.7,
|
||||||
HsOpenSSL -fast-bignum -homebrew-openssl -macports-openssl -use-pkg-config,
|
HsOpenSSL -fast-bignum -homebrew-openssl -macports-openssl -use-pkg-config,
|
||||||
any.HsYAML ==0.2.1.0,
|
|
||||||
HsYAML -exe,
|
|
||||||
any.HsYAML-aeson ==0.2.0.0,
|
|
||||||
any.QuickCheck ==2.14.2,
|
any.QuickCheck ==2.14.2,
|
||||||
QuickCheck -old-random +templatehaskell,
|
QuickCheck -old-random +templatehaskell,
|
||||||
any.StateVar ==1.2.2,
|
any.StateVar ==1.2.2,
|
||||||
any.aeson ==1.5.6.0,
|
any.aeson ==1.5.6.0,
|
||||||
aeson -bytestring-builder -cffi -developer -fast,
|
aeson -bytestring-builder -cffi -developer -fast,
|
||||||
any.aeson-pretty ==0.8.8,
|
any.aeson-pretty ==0.8.8,
|
||||||
aeson-pretty +lib-only,
|
aeson-pretty -lib-only,
|
||||||
any.alex ==3.2.6,
|
any.alex ==3.2.6,
|
||||||
alex +small_base,
|
alex +small_base,
|
||||||
any.ansi-terminal ==0.11,
|
any.ansi-terminal ==0.11,
|
||||||
@@ -25,6 +22,7 @@ constraints: any.Cabal ==3.4.0.0,
|
|||||||
async -bench,
|
async -bench,
|
||||||
any.attoparsec ==0.13.2.5,
|
any.attoparsec ==0.13.2.5,
|
||||||
attoparsec -developer,
|
attoparsec -developer,
|
||||||
|
any.auto-update ==0.1.6,
|
||||||
any.base ==4.15.0.0,
|
any.base ==4.15.0.0,
|
||||||
any.base-compat ==0.11.2,
|
any.base-compat ==0.11.2,
|
||||||
any.base-compat-batteries ==0.11.2,
|
any.base-compat-batteries ==0.11.2,
|
||||||
@@ -34,34 +32,41 @@ constraints: any.Cabal ==3.4.0.0,
|
|||||||
any.bifunctors ==5.5.11,
|
any.bifunctors ==5.5.11,
|
||||||
bifunctors +semigroups +tagged,
|
bifunctors +semigroups +tagged,
|
||||||
any.binary ==0.8.8.0,
|
any.binary ==0.8.8.0,
|
||||||
|
any.bindings-DSL ==1.0.25,
|
||||||
any.blaze-builder ==0.4.2.1,
|
any.blaze-builder ==0.4.2.1,
|
||||||
any.brick ==0.64,
|
any.brick ==0.63,
|
||||||
brick -demos,
|
brick -demos,
|
||||||
any.bytestring ==0.10.12.1,
|
any.bytestring ==0.10.12.1,
|
||||||
any.bz2 ==1.0.1.0,
|
any.bz2 ==1.0.1.0,
|
||||||
bz2 -cross +with-bzlib,
|
bz2 -cross +with-bzlib,
|
||||||
|
any.bzlib-conduit ==0.3.0.2,
|
||||||
any.c2hs ==0.28.8,
|
any.c2hs ==0.28.8,
|
||||||
c2hs +base3 -regression,
|
c2hs +base3 -regression,
|
||||||
any.cabal-plan ==0.7.2.0,
|
|
||||||
cabal-plan -_ -exe -license-report,
|
|
||||||
any.call-stack ==0.4.0,
|
any.call-stack ==0.4.0,
|
||||||
any.case-insensitive ==1.2.1.0,
|
any.case-insensitive ==1.2.1.0,
|
||||||
any.casing ==0.1.4.1,
|
any.casing ==0.1.4.1,
|
||||||
|
any.cereal ==0.5.8.1,
|
||||||
|
cereal -bytestring-builder,
|
||||||
any.chs-cabal ==0.1.1.0,
|
any.chs-cabal ==0.1.1.0,
|
||||||
any.chs-deps ==0.1.0.0,
|
any.chs-deps ==0.1.0.0,
|
||||||
chs-deps -cross,
|
chs-deps -cross,
|
||||||
any.clock ==0.8.2,
|
any.clock ==0.8.2,
|
||||||
clock -llvm,
|
clock -llvm,
|
||||||
|
any.cmdargs ==0.10.21,
|
||||||
|
cmdargs +quotation -testprog,
|
||||||
any.colour ==2.3.6,
|
any.colour ==2.3.6,
|
||||||
any.comonad ==5.0.8,
|
any.comonad ==5.0.8,
|
||||||
comonad +containers +distributive +indexed-traversable,
|
comonad +containers +distributive +indexed-traversable,
|
||||||
any.composition-prelude ==3.0.0.2,
|
any.composition-prelude ==3.0.0.2,
|
||||||
composition-prelude -development,
|
composition-prelude -development,
|
||||||
any.concurrent-output ==1.10.12,
|
any.concurrent-output ==1.10.12,
|
||||||
|
any.conduit ==1.3.4.1,
|
||||||
|
any.conduit-extra ==1.3.5,
|
||||||
|
any.conduit-zstd ==0.0.2.0,
|
||||||
any.config-ini ==0.2.4.0,
|
any.config-ini ==0.2.4.0,
|
||||||
config-ini -enable-doctests,
|
config-ini -enable-doctests,
|
||||||
any.containers ==0.6.4.1,
|
any.containers ==0.6.4.1,
|
||||||
any.contravariant ==1.5.5,
|
any.contravariant ==1.5.4,
|
||||||
contravariant +semigroups +statevar +tagged,
|
contravariant +semigroups +statevar +tagged,
|
||||||
any.cpphs ==1.20.9.1,
|
any.cpphs ==1.20.9.1,
|
||||||
cpphs -old-locale,
|
cpphs -old-locale,
|
||||||
@@ -69,33 +74,45 @@ constraints: any.Cabal ==3.4.0.0,
|
|||||||
any.cryptohash-sha256 ==0.11.102.0,
|
any.cryptohash-sha256 ==0.11.102.0,
|
||||||
cryptohash-sha256 -exe +use-cbits,
|
cryptohash-sha256 -exe +use-cbits,
|
||||||
any.data-clist ==0.1.2.3,
|
any.data-clist ==0.1.2.3,
|
||||||
any.data-fix ==0.3.2,
|
any.data-default-class ==0.1.2.0,
|
||||||
|
any.data-fix ==0.3.1,
|
||||||
any.deepseq ==1.4.5.0,
|
any.deepseq ==1.4.5.0,
|
||||||
|
any.digest ==0.0.1.3,
|
||||||
|
digest -bytestring-in-base,
|
||||||
any.directory ==1.3.6.1,
|
any.directory ==1.3.6.1,
|
||||||
any.disk-free-space ==0.1.0.1,
|
any.disk-free-space ==0.1.0.1,
|
||||||
any.distributive ==0.6.2.1,
|
any.distributive ==0.6.2.1,
|
||||||
distributive +semigroups +tagged,
|
distributive +semigroups +tagged,
|
||||||
any.dlist ==1.0,
|
any.dlist ==1.0,
|
||||||
dlist -werror,
|
dlist -werror,
|
||||||
|
any.easy-file ==0.2.2,
|
||||||
|
any.errors ==2.3.0,
|
||||||
any.exceptions ==0.10.4,
|
any.exceptions ==0.10.4,
|
||||||
|
any.extra ==1.7.9,
|
||||||
|
any.fast-logger ==3.0.5,
|
||||||
any.filepath ==1.4.2.1,
|
any.filepath ==1.4.2.1,
|
||||||
any.free ==5.1.7,
|
any.free ==5.1.7,
|
||||||
any.generic-arbitrary ==0.1.0,
|
any.generic-arbitrary ==0.1.0,
|
||||||
|
any.generics-sop ==0.5.1.1,
|
||||||
any.ghc-bignum ==1.0,
|
any.ghc-bignum ==1.0,
|
||||||
any.ghc-boot-th ==9.0.1,
|
any.ghc-boot-th ==9.0.1,
|
||||||
any.ghc-byteorder ==4.11.0.0.10,
|
any.ghc-byteorder ==4.11.0.0.10,
|
||||||
any.ghc-prim ==0.7.0,
|
any.ghc-prim ==0.7.0,
|
||||||
any.happy ==1.20.0,
|
any.happy ==1.20.0,
|
||||||
any.hashable ==1.3.3.0,
|
any.hashable ==1.3.2.0,
|
||||||
hashable +integer-gmp -random-initial-seed,
|
hashable +integer-gmp -random-initial-seed,
|
||||||
|
any.haskell-src-exts ==1.23.1,
|
||||||
|
any.haskell-src-meta ==0.8.7,
|
||||||
any.haskus-utils-data ==1.4,
|
any.haskus-utils-data ==1.4,
|
||||||
any.haskus-utils-types ==1.5.1,
|
any.haskus-utils-types ==1.5.1,
|
||||||
any.haskus-utils-variant ==3.1,
|
any.haskus-utils-variant ==3.1,
|
||||||
|
any.hpath-filepath ==0.10.4,
|
||||||
|
any.hpath-posix ==0.13.3,
|
||||||
any.hsc2hs ==0.68.7,
|
any.hsc2hs ==0.68.7,
|
||||||
hsc2hs -in-ghc-tree,
|
hsc2hs -in-ghc-tree,
|
||||||
any.hspec ==2.7.10,
|
any.hspec ==2.7.10,
|
||||||
any.hspec-core ==2.7.10,
|
any.hspec-core ==2.7.10,
|
||||||
any.hspec-discover ==2.7.10 || ==2.8.3,
|
any.hspec-discover ==2.7.10 || ==2.8.2,
|
||||||
any.hspec-expectations ==0.8.2,
|
any.hspec-expectations ==0.8.2,
|
||||||
any.hspec-golden-aeson ==0.9.0.0,
|
any.hspec-golden-aeson ==0.9.0.0,
|
||||||
any.http-io-streams ==0.1.6.0,
|
any.http-io-streams ==0.1.6.0,
|
||||||
@@ -111,22 +128,34 @@ constraints: any.Cabal ==3.4.0.0,
|
|||||||
language-c -allwarnings +iecfpextension +usebytestrings,
|
language-c -allwarnings +iecfpextension +usebytestrings,
|
||||||
any.libarchive ==3.0.2.2,
|
any.libarchive ==3.0.2.2,
|
||||||
libarchive -cross -low-memory -system-libarchive,
|
libarchive -cross -low-memory -system-libarchive,
|
||||||
|
any.libyaml ==0.1.2,
|
||||||
|
libyaml -no-unicode -system-libyaml,
|
||||||
|
any.lifted-base ==0.2.3.12,
|
||||||
any.lzma-static ==5.2.5.4,
|
any.lzma-static ==5.2.5.4,
|
||||||
any.megaparsec ==9.0.1,
|
any.megaparsec ==9.0.1,
|
||||||
megaparsec -dev,
|
megaparsec -dev,
|
||||||
any.microlens ==0.4.12.0,
|
any.microlens ==0.4.12.0,
|
||||||
any.microlens-mtl ==0.2.0.1,
|
any.microlens-mtl ==0.2.0.1,
|
||||||
any.microlens-th ==0.4.3.10,
|
any.microlens-th ==0.4.3.10,
|
||||||
|
any.monad-control ==1.0.3,
|
||||||
|
any.monad-logger ==0.3.36,
|
||||||
|
monad-logger +template_haskell,
|
||||||
|
any.monad-loops ==0.4.3,
|
||||||
|
monad-loops +base4,
|
||||||
|
any.mono-traversable ==1.0.15.1,
|
||||||
any.mtl ==2.2.2,
|
any.mtl ==2.2.2,
|
||||||
any.network ==3.1.2.2,
|
any.network ==3.1.2.2,
|
||||||
network -devel,
|
network -devel,
|
||||||
any.network-uri ==2.6.4.1,
|
any.network-uri ==2.6.4.1,
|
||||||
|
any.old-locale ==1.0.0.7,
|
||||||
|
any.old-time ==1.1.0.3,
|
||||||
any.openssl-streams ==1.2.3.0,
|
any.openssl-streams ==1.2.3.0,
|
||||||
any.optics ==0.4,
|
any.optics ==0.4,
|
||||||
any.optics-core ==0.4,
|
any.optics-core ==0.4,
|
||||||
optics-core -explicit-generic-labels,
|
optics-core -explicit-generic-labels,
|
||||||
any.optics-extra ==0.4,
|
any.optics-extra ==0.4,
|
||||||
any.optics-th ==0.4,
|
any.optics-th ==0.4,
|
||||||
|
any.optics-vl ==0.2.1,
|
||||||
any.optparse-applicative ==0.16.1.0,
|
any.optparse-applicative ==0.16.1.0,
|
||||||
optparse-applicative +process,
|
optparse-applicative +process,
|
||||||
any.os-release ==1.0.2,
|
any.os-release ==1.0.2,
|
||||||
@@ -138,7 +167,7 @@ constraints: any.Cabal ==3.4.0.0,
|
|||||||
any.polyparse ==1.13,
|
any.polyparse ==1.13,
|
||||||
any.pretty ==1.1.3.6,
|
any.pretty ==1.1.3.6,
|
||||||
any.pretty-terminal ==0.1.0.0,
|
any.pretty-terminal ==0.1.0.0,
|
||||||
any.primitive ==0.7.2.0,
|
any.primitive ==0.7.1.0,
|
||||||
any.process ==1.6.11.0,
|
any.process ==1.6.11.0,
|
||||||
any.profunctors ==5.6.2,
|
any.profunctors ==5.6.2,
|
||||||
any.quickcheck-arbitrary-adt ==0.3.1.0,
|
any.quickcheck-arbitrary-adt ==0.3.1.0,
|
||||||
@@ -149,7 +178,7 @@ constraints: any.Cabal ==3.4.0.0,
|
|||||||
any.regex-base ==0.94.0.1,
|
any.regex-base ==0.94.0.1,
|
||||||
any.regex-posix ==0.96.0.1,
|
any.regex-posix ==0.96.0.1,
|
||||||
regex-posix -_regex-posix-clib,
|
regex-posix -_regex-posix-clib,
|
||||||
any.resourcet ==1.2.4.3,
|
any.resourcet ==1.2.4.2,
|
||||||
any.rts ==1.0,
|
any.rts ==1.0,
|
||||||
any.safe ==0.3.19,
|
any.safe ==0.3.19,
|
||||||
any.safe-exceptions ==0.1.7.2,
|
any.safe-exceptions ==0.1.7.2,
|
||||||
@@ -158,41 +187,55 @@ constraints: any.Cabal ==3.4.0.0,
|
|||||||
any.semigroupoids ==5.3.5,
|
any.semigroupoids ==5.3.5,
|
||||||
semigroupoids +comonad +containers +contravariant +distributive +tagged +unordered-containers,
|
semigroupoids +comonad +containers +contravariant +distributive +tagged +unordered-containers,
|
||||||
any.setenv ==0.1.1.3,
|
any.setenv ==0.1.1.3,
|
||||||
|
any.sop-core ==0.5.0.1,
|
||||||
any.split ==0.2.3.4,
|
any.split ==0.2.3.4,
|
||||||
any.splitmix ==0.1.0.3,
|
any.splitmix ==0.1.0.3,
|
||||||
splitmix -optimised-mixer,
|
splitmix -optimised-mixer,
|
||||||
any.stm ==2.5.0.0,
|
any.stm ==2.5.0.0,
|
||||||
|
any.stm-chans ==3.0.0.4,
|
||||||
|
any.streaming-commons ==0.2.2.1,
|
||||||
|
streaming-commons -use-bytestring-builder,
|
||||||
any.strict ==0.4.0.1,
|
any.strict ==0.4.0.1,
|
||||||
strict +assoc,
|
strict +assoc,
|
||||||
any.strict-base ==0.4.0.0,
|
any.strict-base ==0.4.0.0,
|
||||||
|
any.string-interpolate ==0.3.1.1,
|
||||||
|
string-interpolate -bytestring-builder -extended-benchmarks -text-builder,
|
||||||
|
any.syb ==0.7.2.1,
|
||||||
any.tagged ==0.8.6.1,
|
any.tagged ==0.8.6.1,
|
||||||
tagged +deepseq +transformers,
|
tagged +deepseq +transformers,
|
||||||
|
any.tar ==0.6.0.0,
|
||||||
any.template-haskell ==2.17.0.0,
|
any.template-haskell ==2.17.0.0,
|
||||||
any.temporary ==1.3,
|
any.temporary ==1.3,
|
||||||
any.terminal-progress-bar ==0.4.1,
|
any.terminal-progress-bar ==0.4.1,
|
||||||
any.terminal-size ==0.3.2.1,
|
any.terminal-size ==0.3.2.1,
|
||||||
any.terminfo ==0.4.1.4,
|
any.terminfo ==0.4.1.4,
|
||||||
any.text ==1.2.4.1,
|
any.text ==1.2.4.1,
|
||||||
|
any.text-conversions ==0.3.1,
|
||||||
any.text-zipper ==0.11,
|
any.text-zipper ==0.11,
|
||||||
any.tf-random ==0.5,
|
any.tf-random ==0.5,
|
||||||
any.th-abstraction ==0.4.2.0,
|
any.th-abstraction ==0.4.2.0,
|
||||||
any.th-compat ==0.1.2,
|
any.th-compat ==0.1.2,
|
||||||
|
any.th-expand-syns ==0.4.8.0,
|
||||||
any.th-lift ==0.8.2,
|
any.th-lift ==0.8.2,
|
||||||
any.th-lift-instances ==0.1.18,
|
any.th-lift-instances ==0.1.18,
|
||||||
|
any.th-orphans ==0.13.11,
|
||||||
|
any.th-reify-many ==0.1.9,
|
||||||
any.these ==1.1.1.1,
|
any.these ==1.1.1.1,
|
||||||
these +assoc,
|
these +assoc,
|
||||||
any.time ==1.9.3,
|
any.time ==1.9.3,
|
||||||
any.time-compat ==1.9.6,
|
any.time-compat ==1.9.6,
|
||||||
time-compat -old-locale,
|
time-compat -old-locale,
|
||||||
any.transformers ==0.5.6.2,
|
any.transformers ==0.5.6.2,
|
||||||
any.transformers-base ==0.4.6,
|
any.transformers-base ==0.4.5.2,
|
||||||
transformers-base +orphaninstances,
|
transformers-base +orphaninstances,
|
||||||
any.transformers-compat ==0.7,
|
any.transformers-compat ==0.7,
|
||||||
transformers-compat -five +five-three -four +generic-deriving +mtl -three -two,
|
transformers-compat -five +five-three -four +generic-deriving +mtl -three -two,
|
||||||
|
any.typed-process ==0.2.6.0,
|
||||||
any.unix ==2.7.2.2,
|
any.unix ==2.7.2.2,
|
||||||
any.unix-bytestring ==0.3.7.3,
|
any.unix-bytestring ==0.3.7.3,
|
||||||
any.unix-compat ==0.5.3,
|
any.unix-compat ==0.5.3,
|
||||||
unix-compat -old-time,
|
unix-compat -old-time,
|
||||||
|
any.unix-time ==0.4.7,
|
||||||
any.unliftio-core ==0.2.0.1,
|
any.unliftio-core ==0.2.0.1,
|
||||||
any.unordered-containers ==0.2.14.0,
|
any.unordered-containers ==0.2.14.0,
|
||||||
unordered-containers -debug,
|
unordered-containers -debug,
|
||||||
@@ -202,12 +245,20 @@ constraints: any.Cabal ==3.4.0.0,
|
|||||||
any.uuid-types ==1.0.5,
|
any.uuid-types ==1.0.5,
|
||||||
any.vector ==0.12.3.0,
|
any.vector ==0.12.3.0,
|
||||||
vector +boundschecks -internalchecks -unsafechecks -wall,
|
vector +boundschecks -internalchecks -unsafechecks -wall,
|
||||||
|
any.vector-algorithms ==0.8.0.4,
|
||||||
|
vector-algorithms +bench +boundschecks -internalchecks -llvm +properties -unsafechecks,
|
||||||
any.versions ==5.0.0,
|
any.versions ==5.0.0,
|
||||||
any.vty ==5.33,
|
any.vty ==5.33,
|
||||||
any.word-wrap ==0.4.1,
|
any.word-wrap ==0.4.1,
|
||||||
any.word8 ==0.1.3,
|
any.word8 ==0.1.3,
|
||||||
any.xor ==0.0.1.0,
|
any.xor ==0.0.1.0,
|
||||||
|
any.yaml ==0.11.5.0,
|
||||||
|
yaml +no-examples +no-exe,
|
||||||
|
any.zip ==1.7.1,
|
||||||
|
zip -dev -disable-bzip2 -disable-zstd,
|
||||||
any.zlib ==0.6.2.3,
|
any.zlib ==0.6.2.3,
|
||||||
zlib -bundled-c-zlib -non-blocking-ffi -pkg-config,
|
zlib -bundled-c-zlib -non-blocking-ffi -pkg-config,
|
||||||
any.zlib-bindings ==0.1.1.5
|
any.zlib-bindings ==0.1.1.5,
|
||||||
index-state: hackage.haskell.org 2021-08-29T16:24:29Z
|
any.zstd ==0.1.2.0,
|
||||||
|
zstd +standalone
|
||||||
|
index-state: hackage.haskell.org 2021-07-27T07:59:57Z
|
||||||
|
|||||||
@@ -16,17 +16,11 @@ source-repository-package
|
|||||||
source-repository-package
|
source-repository-package
|
||||||
type: git
|
type: git
|
||||||
location: https://github.com/hasufell/libarchive
|
location: https://github.com/hasufell/libarchive
|
||||||
tag: 8587aab78dd515928024ecd82c8f215e06db85cd
|
tag: 024a7e8ab7b4d3848dc64dca1e70a04831eedc99
|
||||||
|
|
||||||
constraints: http-io-streams -brotli
|
constraints: http-io-streams -brotli
|
||||||
|
|
||||||
package libarchive
|
package libarchive
|
||||||
flags: -system-libarchive
|
flags: -system-libarchive
|
||||||
|
|
||||||
package aeson-pretty
|
|
||||||
flags: +lib-only
|
|
||||||
|
|
||||||
package cabal-plan
|
|
||||||
flags: -exe
|
|
||||||
|
|
||||||
allow-newer: base, ghc-prim, template-haskell, language-c
|
allow-newer: base, ghc-prim, template-haskell, language-c
|
||||||
|
|||||||
102
ghcup-0.0.6.yaml
102
ghcup-0.0.6.yaml
@@ -1690,6 +1690,7 @@ ghcupDownloads:
|
|||||||
dlHash: 56170d1a8450e18b7eb9c23c94723da352815b27ec250bb23742a62f16dcab6c
|
dlHash: 56170d1a8450e18b7eb9c23c94723da352815b27ec250bb23742a62f16dcab6c
|
||||||
8.10.6:
|
8.10.6:
|
||||||
viTags:
|
viTags:
|
||||||
|
- Recommended
|
||||||
- base-4.14.3.0
|
- base-4.14.3.0
|
||||||
viChangeLog: https://downloads.haskell.org/~ghc/8.10.6/docs/html/users_guide/8.10.6-notes.html
|
viChangeLog: https://downloads.haskell.org/~ghc/8.10.6/docs/html/users_guide/8.10.6-notes.html
|
||||||
viSourceDL:
|
viSourceDL:
|
||||||
@@ -1788,107 +1789,6 @@ ghcupDownloads:
|
|||||||
dlUri: https://downloads.haskell.org/~ghc/8.10.6/ghc-8.10.6-armv7-deb10-linux.tar.xz
|
dlUri: https://downloads.haskell.org/~ghc/8.10.6/ghc-8.10.6-armv7-deb10-linux.tar.xz
|
||||||
dlSubdir: ghc-8.10.6
|
dlSubdir: ghc-8.10.6
|
||||||
dlHash: d54de8306aa8b33afabf2ac94408e1f82c8e982a2a3346168c071b92bdb464c0
|
dlHash: d54de8306aa8b33afabf2ac94408e1f82c8e982a2a3346168c071b92bdb464c0
|
||||||
8.10.7:
|
|
||||||
viTags:
|
|
||||||
- Recommended
|
|
||||||
- base-4.14.3.0
|
|
||||||
viChangeLog: https://downloads.haskell.org/~ghc/8.10.7/docs/html/users_guide/8.10.7-notes.html
|
|
||||||
viSourceDL:
|
|
||||||
dlUri: https://downloads.haskell.org/~ghc/8.10.7/ghc-8.10.7-src.tar.xz
|
|
||||||
dlSubdir: ghc-8.10.7
|
|
||||||
dlHash: e3eef6229ce9908dfe1ea41436befb0455fefb1932559e860ad4c606b0d03c9d
|
|
||||||
viPostRemove: *ghc-post-remove
|
|
||||||
viPreCompile: *ghc-pre-compile
|
|
||||||
viArch:
|
|
||||||
A_64:
|
|
||||||
Linux_Debian:
|
|
||||||
'( >= 9 && < 10 )': &ghc-8107-64-deb9
|
|
||||||
dlUri: https://downloads.haskell.org/~ghc/8.10.7/ghc-8.10.7-x86_64-deb9-linux.tar.xz
|
|
||||||
dlSubdir: ghc-8.10.7
|
|
||||||
dlHash: ced9870ea351af64fb48274b81a664cdb6a9266775f1598a79cbb6fdd5770a23
|
|
||||||
'( >= 10 && < 11 )': &ghc-8107-64-deb10
|
|
||||||
dlUri: https://downloads.haskell.org/~ghc/8.10.7/ghc-8.10.7-x86_64-deb10-linux.tar.xz
|
|
||||||
dlSubdir: ghc-8.10.7
|
|
||||||
dlHash: a13719bca87a0d3ac0c7d4157a4e60887009a7f1a8dbe95c4759ec413e086d30
|
|
||||||
unknown_versioning: *ghc-8107-64-deb9
|
|
||||||
Linux_Ubuntu:
|
|
||||||
unknown_versioning: &ghc-8107-64-fedora
|
|
||||||
dlUri: https://downloads.haskell.org/~ghc/8.10.7/ghc-8.10.7-x86_64-fedora27-linux.tar.xz
|
|
||||||
dlSubdir: ghc-8.10.7
|
|
||||||
dlHash: b6ed67049a23054a8042e65c9976d5e196e5ee4e83b29b2ee35c8a22ab1e5b73
|
|
||||||
'( >= 16 && < 19 )': *ghc-8107-64-deb9
|
|
||||||
Linux_Mint:
|
|
||||||
unknown_versioning: *ghc-8107-64-deb10
|
|
||||||
Linux_Fedora:
|
|
||||||
'( >= 27 && < 28 )': *ghc-8107-64-fedora
|
|
||||||
unknown_versioning: *ghc-8107-64-fedora
|
|
||||||
Linux_CentOS:
|
|
||||||
'( >= 7 && < 8 )': &ghc-8107-64-centos
|
|
||||||
dlUri: https://downloads.haskell.org/~ghc/8.10.7/ghc-8.10.7-x86_64-centos7-linux.tar.xz
|
|
||||||
dlSubdir: ghc-8.10.7
|
|
||||||
dlHash: 262a50bfb5b7c8770e0d99f54d42e5876968da7bf93e2e4d6cfe397891a36d05
|
|
||||||
unknown_versioning: *ghc-8107-64-centos
|
|
||||||
Linux_RedHat:
|
|
||||||
unknown_versioning: *ghc-8107-64-centos
|
|
||||||
Linux_Alpine:
|
|
||||||
unknown_versioning:
|
|
||||||
dlUri: https://downloads.haskell.org/~ghc/8.10.7/ghc-8.10.7-x86_64-alpine3.10-linux-integer-simple.tar.xz
|
|
||||||
dlSubdir: ghc-8.10.7-x86_64-unknown-linux
|
|
||||||
dlHash: 16903df850ef73d5246f2ff169cbf57ecab76c2ac5acfa9928934282cfad575c
|
|
||||||
Linux_AmazonLinux:
|
|
||||||
unknown_versioning: *ghc-8107-64-centos
|
|
||||||
Linux_UnknownLinux:
|
|
||||||
unknown_versioning: *ghc-8107-64-fedora
|
|
||||||
Darwin:
|
|
||||||
unknown_versioning:
|
|
||||||
dlUri: https://downloads.haskell.org/~ghc/8.10.7/ghc-8.10.7-x86_64-apple-darwin.tar.xz
|
|
||||||
dlSubdir: ghc-8.10.7
|
|
||||||
dlHash: 287db0f9c338c9f53123bfa8731b0996803ee50f6ee847fe388092e5e5132047
|
|
||||||
FreeBSD:
|
|
||||||
unknown_versioning:
|
|
||||||
dlUri: https://downloads.haskell.org/~ghc/8.10.7/ghc-8.10.7-x86_64-unknown-freebsd.tar.xz
|
|
||||||
dlSubdir: ghc-8.10.7
|
|
||||||
dlHash: 45e35d24bc700e1093efa39189e9fa01498069881aed2fa8779c011941a80da1
|
|
||||||
Windows:
|
|
||||||
unknown_versioning:
|
|
||||||
dlUri: https://downloads.haskell.org/~ghc/8.10.7/ghc-8.10.7-x86_64-unknown-mingw32.tar.xz
|
|
||||||
dlSubdir: ghc-8.10.7
|
|
||||||
dlHash: b6515b0ea3f7a6e34d92e7fcd0c1fef50d6030fe8f46883000185289a4b8ea9a
|
|
||||||
A_32:
|
|
||||||
Linux_Debian:
|
|
||||||
'( >= 9 && < 10 )': &ghc-8107-32-deb9
|
|
||||||
dlUri: https://downloads.haskell.org/~ghc/8.10.7/ghc-8.10.7-i386-deb9-linux.tar.xz
|
|
||||||
dlSubdir: ghc-8.10.7
|
|
||||||
dlHash: fbfc1ef194f4e7a4c0da8c11cc69b17458a4b928b609b3622c97acc4acd5c5ab
|
|
||||||
unknown_versioning: *ghc-8107-32-deb9
|
|
||||||
Linux_Ubuntu:
|
|
||||||
unknown_versioning: *ghc-8107-32-deb9
|
|
||||||
Linux_Mint:
|
|
||||||
unknown_versioning: *ghc-8107-32-deb9
|
|
||||||
Linux_UnknownLinux:
|
|
||||||
unknown_versioning: *ghc-8107-32-deb9
|
|
||||||
Linux_Alpine:
|
|
||||||
unknown_versioning:
|
|
||||||
dlUri: https://downloads.haskell.org/~ghcup/unofficial-bindists/ghc/8.10.7/ghc-8.10.7-i386-alpine-linux.tar.xz
|
|
||||||
dlSubdir: ghc-8.10.7
|
|
||||||
dlHash: 3110e6ee029d9d8062158b54b06f71a21b0fac87bf0e085f9be5bbcf73f99e6d
|
|
||||||
A_ARM64:
|
|
||||||
Linux_UnknownLinux:
|
|
||||||
unknown_versioning:
|
|
||||||
dlUri: https://downloads.haskell.org/~ghc/8.10.7/ghc-8.10.7-aarch64-deb10-linux.tar.xz
|
|
||||||
dlSubdir: ghc-8.10.7
|
|
||||||
dlHash: fad2417f9b295233bf8ade79c0e6140896359e87be46cb61cd1d35863d9d0e55
|
|
||||||
Darwin:
|
|
||||||
unknown_versioning:
|
|
||||||
dlUri: https://downloads.haskell.org/~ghc/8.10.7/ghc-8.10.7-aarch64-apple-darwin.tar.xz
|
|
||||||
dlSubdir: ghc-8.10.7
|
|
||||||
dlHash: dc469fc3c35fd2a33a5a575ffce87f13de7b98c2d349a41002e200a56d9bba1c
|
|
||||||
A_ARM:
|
|
||||||
Linux_UnknownLinux:
|
|
||||||
unknown_versioning:
|
|
||||||
dlUri: https://downloads.haskell.org/~ghc/8.10.7/ghc-8.10.7-armv7-deb10-linux.tar.xz
|
|
||||||
dlSubdir: ghc-8.10.7
|
|
||||||
dlHash: 3949c31bdf7d3b4afb765ea8246bca4ca9707c5d988d9961a244f0da100956a2
|
|
||||||
9.0.1:
|
9.0.1:
|
||||||
viTags:
|
viTags:
|
||||||
- Latest
|
- Latest
|
||||||
|
|||||||
102
ghcup-0.0.7.yaml
102
ghcup-0.0.7.yaml
@@ -1746,6 +1746,7 @@ ghcupDownloads:
|
|||||||
dlHash: 56170d1a8450e18b7eb9c23c94723da352815b27ec250bb23742a62f16dcab6c
|
dlHash: 56170d1a8450e18b7eb9c23c94723da352815b27ec250bb23742a62f16dcab6c
|
||||||
8.10.6:
|
8.10.6:
|
||||||
viTags:
|
viTags:
|
||||||
|
- Recommended
|
||||||
- base-4.14.3.0
|
- base-4.14.3.0
|
||||||
viChangeLog: https://downloads.haskell.org/~ghc/8.10.6/docs/html/users_guide/8.10.6-notes.html
|
viChangeLog: https://downloads.haskell.org/~ghc/8.10.6/docs/html/users_guide/8.10.6-notes.html
|
||||||
viSourceDL:
|
viSourceDL:
|
||||||
@@ -1846,107 +1847,6 @@ ghcupDownloads:
|
|||||||
dlUri: https://downloads.haskell.org/~ghc/8.10.6/ghc-8.10.6-armv7-deb10-linux.tar.xz
|
dlUri: https://downloads.haskell.org/~ghc/8.10.6/ghc-8.10.6-armv7-deb10-linux.tar.xz
|
||||||
dlSubdir: ghc-8.10.6
|
dlSubdir: ghc-8.10.6
|
||||||
dlHash: d54de8306aa8b33afabf2ac94408e1f82c8e982a2a3346168c071b92bdb464c0
|
dlHash: d54de8306aa8b33afabf2ac94408e1f82c8e982a2a3346168c071b92bdb464c0
|
||||||
8.10.7:
|
|
||||||
viTags:
|
|
||||||
- Recommended
|
|
||||||
- base-4.14.3.0
|
|
||||||
viChangeLog: https://downloads.haskell.org/~ghc/8.10.7/docs/html/users_guide/8.10.7-notes.html
|
|
||||||
viSourceDL:
|
|
||||||
dlUri: https://downloads.haskell.org/~ghc/8.10.7/ghc-8.10.7-src.tar.xz
|
|
||||||
dlSubdir: ghc-8.10.7
|
|
||||||
dlHash: e3eef6229ce9908dfe1ea41436befb0455fefb1932559e860ad4c606b0d03c9d
|
|
||||||
viPostRemove: *ghc-post-remove
|
|
||||||
viPreCompile: *ghc-pre-compile
|
|
||||||
viArch:
|
|
||||||
A_64:
|
|
||||||
Linux_Debian:
|
|
||||||
'( >= 9 && < 10 )': &ghc-8107-64-deb9
|
|
||||||
dlUri: https://downloads.haskell.org/~ghc/8.10.7/ghc-8.10.7-x86_64-deb9-linux.tar.xz
|
|
||||||
dlSubdir: ghc-8.10.7
|
|
||||||
dlHash: ced9870ea351af64fb48274b81a664cdb6a9266775f1598a79cbb6fdd5770a23
|
|
||||||
'( >= 10 && < 11 )': &ghc-8107-64-deb10
|
|
||||||
dlUri: https://downloads.haskell.org/~ghc/8.10.7/ghc-8.10.7-x86_64-deb10-linux.tar.xz
|
|
||||||
dlSubdir: ghc-8.10.7
|
|
||||||
dlHash: a13719bca87a0d3ac0c7d4157a4e60887009a7f1a8dbe95c4759ec413e086d30
|
|
||||||
unknown_versioning: *ghc-8107-64-deb9
|
|
||||||
Linux_Ubuntu:
|
|
||||||
unknown_versioning: &ghc-8107-64-fedora
|
|
||||||
dlUri: https://downloads.haskell.org/~ghc/8.10.7/ghc-8.10.7-x86_64-fedora27-linux.tar.xz
|
|
||||||
dlSubdir: ghc-8.10.7
|
|
||||||
dlHash: b6ed67049a23054a8042e65c9976d5e196e5ee4e83b29b2ee35c8a22ab1e5b73
|
|
||||||
'( >= 16 && < 19 )': *ghc-8107-64-deb9
|
|
||||||
Linux_Mint:
|
|
||||||
unknown_versioning: *ghc-8107-64-deb10
|
|
||||||
Linux_Fedora:
|
|
||||||
'( >= 27 && < 28 )': *ghc-8107-64-fedora
|
|
||||||
unknown_versioning: *ghc-8107-64-fedora
|
|
||||||
Linux_CentOS:
|
|
||||||
'( >= 7 && < 8 )': &ghc-8107-64-centos
|
|
||||||
dlUri: https://downloads.haskell.org/~ghc/8.10.7/ghc-8.10.7-x86_64-centos7-linux.tar.xz
|
|
||||||
dlSubdir: ghc-8.10.7
|
|
||||||
dlHash: 262a50bfb5b7c8770e0d99f54d42e5876968da7bf93e2e4d6cfe397891a36d05
|
|
||||||
unknown_versioning: *ghc-8107-64-centos
|
|
||||||
Linux_RedHat:
|
|
||||||
unknown_versioning: *ghc-8107-64-centos
|
|
||||||
Linux_Alpine:
|
|
||||||
unknown_versioning:
|
|
||||||
dlUri: https://downloads.haskell.org/~ghc/8.10.7/ghc-8.10.7-x86_64-alpine3.10-linux-integer-simple.tar.xz
|
|
||||||
dlSubdir: ghc-8.10.7-x86_64-unknown-linux
|
|
||||||
dlHash: 16903df850ef73d5246f2ff169cbf57ecab76c2ac5acfa9928934282cfad575c
|
|
||||||
Linux_AmazonLinux:
|
|
||||||
unknown_versioning: *ghc-8107-64-centos
|
|
||||||
Linux_UnknownLinux:
|
|
||||||
unknown_versioning: *ghc-8107-64-fedora
|
|
||||||
Darwin:
|
|
||||||
unknown_versioning:
|
|
||||||
dlUri: https://downloads.haskell.org/~ghc/8.10.7/ghc-8.10.7-x86_64-apple-darwin.tar.xz
|
|
||||||
dlSubdir: ghc-8.10.7
|
|
||||||
dlHash: 287db0f9c338c9f53123bfa8731b0996803ee50f6ee847fe388092e5e5132047
|
|
||||||
FreeBSD:
|
|
||||||
unknown_versioning:
|
|
||||||
dlUri: https://downloads.haskell.org/~ghc/8.10.7/ghc-8.10.7-x86_64-unknown-freebsd.tar.xz
|
|
||||||
dlSubdir: ghc-8.10.7
|
|
||||||
dlHash: 45e35d24bc700e1093efa39189e9fa01498069881aed2fa8779c011941a80da1
|
|
||||||
Windows:
|
|
||||||
unknown_versioning:
|
|
||||||
dlUri: https://downloads.haskell.org/~ghc/8.10.7/ghc-8.10.7-x86_64-unknown-mingw32.tar.xz
|
|
||||||
dlSubdir: ghc-8.10.7
|
|
||||||
dlHash: b6515b0ea3f7a6e34d92e7fcd0c1fef50d6030fe8f46883000185289a4b8ea9a
|
|
||||||
A_32:
|
|
||||||
Linux_Debian:
|
|
||||||
'( >= 9 && < 10 )': &ghc-8107-32-deb9
|
|
||||||
dlUri: https://downloads.haskell.org/~ghc/8.10.7/ghc-8.10.7-i386-deb9-linux.tar.xz
|
|
||||||
dlSubdir: ghc-8.10.7
|
|
||||||
dlHash: fbfc1ef194f4e7a4c0da8c11cc69b17458a4b928b609b3622c97acc4acd5c5ab
|
|
||||||
unknown_versioning: *ghc-8107-32-deb9
|
|
||||||
Linux_Ubuntu:
|
|
||||||
unknown_versioning: *ghc-8107-32-deb9
|
|
||||||
Linux_Mint:
|
|
||||||
unknown_versioning: *ghc-8107-32-deb9
|
|
||||||
Linux_UnknownLinux:
|
|
||||||
unknown_versioning: *ghc-8107-32-deb9
|
|
||||||
Linux_Alpine:
|
|
||||||
unknown_versioning:
|
|
||||||
dlUri: https://downloads.haskell.org/~ghcup/unofficial-bindists/ghc/8.10.7/ghc-8.10.7-i386-alpine-linux.tar.xz
|
|
||||||
dlSubdir: ghc-8.10.7
|
|
||||||
dlHash: 3110e6ee029d9d8062158b54b06f71a21b0fac87bf0e085f9be5bbcf73f99e6d
|
|
||||||
A_ARM64:
|
|
||||||
Linux_UnknownLinux:
|
|
||||||
unknown_versioning:
|
|
||||||
dlUri: https://downloads.haskell.org/~ghc/8.10.7/ghc-8.10.7-aarch64-deb10-linux.tar.xz
|
|
||||||
dlSubdir: ghc-8.10.7
|
|
||||||
dlHash: fad2417f9b295233bf8ade79c0e6140896359e87be46cb61cd1d35863d9d0e55
|
|
||||||
Darwin:
|
|
||||||
unknown_versioning:
|
|
||||||
dlUri: https://downloads.haskell.org/~ghc/8.10.7/ghc-8.10.7-aarch64-apple-darwin.tar.xz
|
|
||||||
dlSubdir: ghc-8.10.7
|
|
||||||
dlHash: dc469fc3c35fd2a33a5a575ffce87f13de7b98c2d349a41002e200a56d9bba1c
|
|
||||||
A_ARM:
|
|
||||||
Linux_UnknownLinux:
|
|
||||||
unknown_versioning:
|
|
||||||
dlUri: https://downloads.haskell.org/~ghc/8.10.7/ghc-8.10.7-armv7-deb10-linux.tar.xz
|
|
||||||
dlSubdir: ghc-8.10.7
|
|
||||||
dlHash: 3949c31bdf7d3b4afb765ea8246bca4ca9707c5d988d9961a244f0da100956a2
|
|
||||||
9.0.1:
|
9.0.1:
|
||||||
viTags:
|
viTags:
|
||||||
- Latest
|
- Latest
|
||||||
|
|||||||
13
ghcup.cabal
13
ghcup.cabal
@@ -104,12 +104,14 @@ library
|
|||||||
, deepseq ^>=1.4.4.0
|
, deepseq ^>=1.4.4.0
|
||||||
, directory ^>=1.3.6.0
|
, directory ^>=1.3.6.0
|
||||||
, disk-free-space ^>=0.1.0.1
|
, disk-free-space ^>=0.1.0.1
|
||||||
|
, extra ^>=1.7.9
|
||||||
, filepath ^>=1.4.2.1
|
, filepath ^>=1.4.2.1
|
||||||
, haskus-utils-types ^>=1.5
|
, haskus-utils-types ^>=1.5
|
||||||
, haskus-utils-variant >=3.0 && <3.2
|
, haskus-utils-variant >=3.0 && <3.2
|
||||||
, libarchive ^>=3.0.0.0
|
, libarchive ^>=3.0.0.0
|
||||||
, lzma-static ^>=5.2.5.3
|
, lzma-static ^>=5.2.5.3
|
||||||
, megaparsec >=8.0.0 && <9.1
|
, megaparsec >=8.0.0 && <9.1
|
||||||
|
, monad-logger ^>=0.3.31
|
||||||
, mtl ^>=2.2
|
, mtl ^>=2.2
|
||||||
, optics ^>=0.4
|
, optics ^>=0.4
|
||||||
, os-release ^>=1.0.0
|
, os-release ^>=1.0.0
|
||||||
@@ -132,7 +134,7 @@ library
|
|||||||
, vector ^>=0.12
|
, vector ^>=0.12
|
||||||
, versions >=4.0.1 && <5.1
|
, versions >=4.0.1 && <5.1
|
||||||
, word8 ^>=0.1.3
|
, word8 ^>=0.1.3
|
||||||
, HsYAML-aeson ^>=0.2.0.0
|
, yaml ^>=0.11.4.0
|
||||||
, zlib ^>=0.6.2.2
|
, zlib ^>=0.6.2.2
|
||||||
|
|
||||||
if (flag(internal-downloader) && !os(windows))
|
if (flag(internal-downloader) && !os(windows))
|
||||||
@@ -183,12 +185,9 @@ executable ghcup
|
|||||||
-fwarn-incomplete-record-updates -threaded
|
-fwarn-incomplete-record-updates -threaded
|
||||||
|
|
||||||
build-depends:
|
build-depends:
|
||||||
, aeson >=1.4 && <1.6
|
|
||||||
, aeson-pretty ^>=0.8.8
|
|
||||||
, async ^>=2.2.3
|
, async ^>=2.2.3
|
||||||
, base >=4.13 && <5
|
, base >=4.13 && <5
|
||||||
, bytestring ^>=0.10
|
, bytestring ^>=0.10
|
||||||
, cabal-plan ^>=0.7.2
|
|
||||||
, containers ^>=0.6
|
, containers ^>=0.6
|
||||||
, deepseq ^>=1.4
|
, deepseq ^>=1.4
|
||||||
, filepath ^>=1.4.2.1
|
, filepath ^>=1.4.2.1
|
||||||
@@ -196,6 +195,7 @@ executable ghcup
|
|||||||
, haskus-utils-variant >=3.0 && <3.2
|
, haskus-utils-variant >=3.0 && <3.2
|
||||||
, libarchive ^>=3.0.0.0
|
, libarchive ^>=3.0.0.0
|
||||||
, megaparsec >=8.0.0 && <9.1
|
, megaparsec >=8.0.0 && <9.1
|
||||||
|
, monad-logger ^>=0.3.31
|
||||||
, mtl ^>=2.2
|
, mtl ^>=2.2
|
||||||
, optparse-applicative >=0.15.1.0 && <0.17
|
, optparse-applicative >=0.15.1.0 && <0.17
|
||||||
, pretty ^>=1.1.3.1
|
, pretty ^>=1.1.3.1
|
||||||
@@ -208,7 +208,7 @@ executable ghcup
|
|||||||
, uri-bytestring ^>=0.3.2.2
|
, uri-bytestring ^>=0.3.2.2
|
||||||
, utf8-string ^>=1.0
|
, utf8-string ^>=1.0
|
||||||
, versions >=4.0.1 && <5.1
|
, versions >=4.0.1 && <5.1
|
||||||
, HsYAML-aeson ^>=0.2.0.0
|
, yaml ^>=0.11.4.0
|
||||||
|
|
||||||
if flag(internal-downloader)
|
if flag(internal-downloader)
|
||||||
cpp-options: -DINTERNAL_DOWNLOADER
|
cpp-options: -DINTERNAL_DOWNLOADER
|
||||||
@@ -257,6 +257,7 @@ executable ghcup-gen
|
|||||||
, ghcup
|
, ghcup
|
||||||
, haskus-utils-variant >=3.0 && <3.2
|
, haskus-utils-variant >=3.0 && <3.2
|
||||||
, libarchive ^>=3.0.0.0
|
, libarchive ^>=3.0.0.0
|
||||||
|
, monad-logger ^>=0.3.31
|
||||||
, mtl ^>=2.2
|
, mtl ^>=2.2
|
||||||
, optics ^>=0.4
|
, optics ^>=0.4
|
||||||
, optparse-applicative >=0.15.1.0 && <0.17
|
, optparse-applicative >=0.15.1.0 && <0.17
|
||||||
@@ -268,7 +269,7 @@ executable ghcup-gen
|
|||||||
, text ^>=1.2.4.0
|
, text ^>=1.2.4.0
|
||||||
, transformers ^>=0.5
|
, transformers ^>=0.5
|
||||||
, versions >=4.0.1 && <5.1
|
, versions >=4.0.1 && <5.1
|
||||||
, HsYAML-aeson ^>=0.2.0.0
|
, yaml ^>=0.11.4.0
|
||||||
|
|
||||||
test-suite ghcup-test
|
test-suite ghcup-test
|
||||||
type: exitcode-stdio-1.0
|
type: exitcode-stdio-1.0
|
||||||
|
|||||||
261
lib/GHCup.hs
261
lib/GHCup.hs
@@ -48,6 +48,7 @@ import Control.Monad
|
|||||||
#if !MIN_VERSION_base(4,13,0)
|
#if !MIN_VERSION_base(4,13,0)
|
||||||
import Control.Monad.Fail ( MonadFail )
|
import Control.Monad.Fail ( MonadFail )
|
||||||
#endif
|
#endif
|
||||||
|
import Control.Monad.Logger
|
||||||
import Control.Monad.Reader
|
import Control.Monad.Reader
|
||||||
import Control.Monad.Trans.Resource
|
import Control.Monad.Trans.Resource
|
||||||
hiding ( throwM )
|
hiding ( throwM )
|
||||||
@@ -57,6 +58,7 @@ import Control.Monad.IO.Unlift ( MonadUnliftIO( withRunInIO ) )
|
|||||||
import Data.ByteString ( ByteString )
|
import Data.ByteString ( ByteString )
|
||||||
import Data.Either
|
import Data.Either
|
||||||
import Data.List
|
import Data.List
|
||||||
|
import Data.List.Extra
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import Data.String ( fromString )
|
import Data.String ( fromString )
|
||||||
import Data.Text ( Text )
|
import Data.Text ( Text )
|
||||||
@@ -110,7 +112,7 @@ fetchToolBindist :: ( MonadFail m
|
|||||||
, HasSettings env
|
, HasSettings env
|
||||||
, HasPlatformReq env
|
, HasPlatformReq env
|
||||||
, HasGHCupInfo env
|
, HasGHCupInfo env
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadResource m
|
, MonadResource m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, MonadUnliftIO m
|
, MonadUnliftIO m
|
||||||
@@ -138,7 +140,7 @@ fetchGHCSrc :: ( MonadFail m
|
|||||||
, HasSettings env
|
, HasSettings env
|
||||||
, HasPlatformReq env
|
, HasPlatformReq env
|
||||||
, HasGHCupInfo env
|
, HasGHCupInfo env
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadResource m
|
, MonadResource m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, MonadUnliftIO m
|
, MonadUnliftIO m
|
||||||
@@ -175,7 +177,7 @@ installGHCBindist :: ( MonadFail m
|
|||||||
, HasDirs env
|
, HasDirs env
|
||||||
, HasSettings env
|
, HasSettings env
|
||||||
, HasPlatformReq env
|
, HasPlatformReq env
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadResource m
|
, MonadResource m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, MonadUnliftIO m
|
, MonadUnliftIO m
|
||||||
@@ -200,7 +202,7 @@ installGHCBindist :: ( MonadFail m
|
|||||||
installGHCBindist dlinfo ver isoFilepath = do
|
installGHCBindist dlinfo ver isoFilepath = do
|
||||||
let tver = mkTVer ver
|
let tver = mkTVer ver
|
||||||
|
|
||||||
lift $ logDebug $ "Requested to install GHC with " <> prettyVer ver
|
lift $ $(logDebug) $ "Requested to install GHC with " <> prettyVer ver
|
||||||
|
|
||||||
case isoFilepath of
|
case isoFilepath of
|
||||||
-- we only care for already installed errors in regular (non-isolated) installs
|
-- we only care for already installed errors in regular (non-isolated) installs
|
||||||
@@ -217,7 +219,7 @@ installGHCBindist dlinfo ver isoFilepath = do
|
|||||||
|
|
||||||
case isoFilepath of
|
case isoFilepath of
|
||||||
Just isoDir -> do -- isolated install
|
Just isoDir -> do -- isolated install
|
||||||
lift $ logInfo $ "isolated installing GHC to " <> T.pack isoDir
|
lift $ $(logInfo) $ "isolated installing GHC to " <> T.pack isoDir
|
||||||
liftE $ installPackedGHC dl (view dlSubdir dlinfo) isoDir ver
|
liftE $ installPackedGHC dl (view dlSubdir dlinfo) isoDir ver
|
||||||
Nothing -> do -- regular install
|
Nothing -> do -- regular install
|
||||||
liftE $ installPackedGHC dl (view dlSubdir dlinfo) ghcdir ver
|
liftE $ installPackedGHC dl (view dlSubdir dlinfo) ghcdir ver
|
||||||
@@ -231,9 +233,9 @@ installGHCBindist dlinfo ver isoFilepath = do
|
|||||||
case catMaybes r of
|
case catMaybes r of
|
||||||
[] -> pure ()
|
[] -> pure ()
|
||||||
_ -> do
|
_ -> do
|
||||||
lift $ logWarn $ "CC/LD environment variable is set. This will change the compiler/linker"
|
lift $ $(logWarn) "CC/LD environment variable is set. This will change the compiler/linker"
|
||||||
<> "\n" <> "GHC uses internally and can cause defunct GHC in some cases (e.g. in Anaconda"
|
lift $ $(logWarn) "GHC uses internally and can cause defunct GHC in some cases (e.g. in Anaconda"
|
||||||
<> "\n" <> "environments). If you encounter problems, unset CC and LD and reinstall."
|
lift $ $(logWarn) "environments). If you encounter problems, unset CC and LD and reinstall."
|
||||||
|
|
||||||
|
|
||||||
-- | Install a packed GHC distribution. This only deals with unpacking and the GHC
|
-- | Install a packed GHC distribution. This only deals with unpacking and the GHC
|
||||||
@@ -245,7 +247,7 @@ installPackedGHC :: ( MonadMask m
|
|||||||
, HasPlatformReq env
|
, HasPlatformReq env
|
||||||
, HasSettings env
|
, HasSettings env
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, MonadUnliftIO m
|
, MonadUnliftIO m
|
||||||
)
|
)
|
||||||
@@ -303,7 +305,7 @@ installUnpackedGHC :: ( MonadReader env m
|
|||||||
, HasDirs env
|
, HasDirs env
|
||||||
, HasSettings env
|
, HasSettings env
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, MonadUnliftIO m
|
, MonadUnliftIO m
|
||||||
, MonadMask m
|
, MonadMask m
|
||||||
@@ -314,7 +316,7 @@ installUnpackedGHC :: ( MonadReader env m
|
|||||||
-> Excepts '[ProcessError] m ()
|
-> Excepts '[ProcessError] m ()
|
||||||
installUnpackedGHC path inst ver = do
|
installUnpackedGHC path inst ver = do
|
||||||
#if defined(IS_WINDOWS)
|
#if defined(IS_WINDOWS)
|
||||||
lift $ logInfo "Installing GHC (this may take a while)"
|
lift $ $(logInfo) "Installing GHC (this may take a while)"
|
||||||
-- Windows bindists are relocatable and don't need
|
-- Windows bindists are relocatable and don't need
|
||||||
-- to run configure.
|
-- to run configure.
|
||||||
-- We also must make sure to preserve mtime to not confuse ghc-pkg.
|
-- We also must make sure to preserve mtime to not confuse ghc-pkg.
|
||||||
@@ -331,7 +333,7 @@ installUnpackedGHC path inst ver = do
|
|||||||
| otherwise
|
| otherwise
|
||||||
= []
|
= []
|
||||||
|
|
||||||
lift $ logInfo "Installing GHC (this may take a while)"
|
lift $ $(logInfo) "Installing GHC (this may take a while)"
|
||||||
lEM $ execLogged "sh"
|
lEM $ execLogged "sh"
|
||||||
("./configure" : ("--prefix=" <> inst)
|
("./configure" : ("--prefix=" <> inst)
|
||||||
: alpineArgs
|
: alpineArgs
|
||||||
@@ -357,7 +359,7 @@ installGHCBin :: ( MonadFail m
|
|||||||
, HasGHCupInfo env
|
, HasGHCupInfo env
|
||||||
, HasDirs env
|
, HasDirs env
|
||||||
, HasSettings env
|
, HasSettings env
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadResource m
|
, MonadResource m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, MonadUnliftIO m
|
, MonadUnliftIO m
|
||||||
@@ -391,7 +393,7 @@ installCabalBindist :: ( MonadMask m
|
|||||||
, HasPlatformReq env
|
, HasPlatformReq env
|
||||||
, HasDirs env
|
, HasDirs env
|
||||||
, HasSettings env
|
, HasSettings env
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadResource m
|
, MonadResource m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, MonadUnliftIO m
|
, MonadUnliftIO m
|
||||||
@@ -415,7 +417,7 @@ installCabalBindist :: ( MonadMask m
|
|||||||
m
|
m
|
||||||
()
|
()
|
||||||
installCabalBindist dlinfo ver isoFilepath = do
|
installCabalBindist dlinfo ver isoFilepath = do
|
||||||
lift $ logDebug $ "Requested to install cabal version " <> prettyVer ver
|
lift $ $(logDebug) $ "Requested to install cabal version " <> prettyVer ver
|
||||||
|
|
||||||
PlatformRequest {..} <- lift getPlatformReq
|
PlatformRequest {..} <- lift getPlatformReq
|
||||||
Dirs {..} <- lift getDirs
|
Dirs {..} <- lift getDirs
|
||||||
@@ -446,7 +448,7 @@ installCabalBindist dlinfo ver isoFilepath = do
|
|||||||
|
|
||||||
case isoFilepath of
|
case isoFilepath of
|
||||||
Just isoDir -> do -- isolated install
|
Just isoDir -> do -- isolated install
|
||||||
lift $ logInfo $ "isolated installing Cabal to " <> T.pack isoDir
|
lift $ $(logInfo) $ "isolated installing Cabal to " <> T.pack isoDir
|
||||||
liftE $ installCabalUnpacked workdir isoDir Nothing
|
liftE $ installCabalUnpacked workdir isoDir Nothing
|
||||||
|
|
||||||
Nothing -> do -- regular install
|
Nothing -> do -- regular install
|
||||||
@@ -458,22 +460,19 @@ installCabalBindist dlinfo ver isoFilepath = do
|
|||||||
when (maybe True (ver >=) lInstCabal) $ liftE $ setCabal ver
|
when (maybe True (ver >=) lInstCabal) $ liftE $ setCabal ver
|
||||||
|
|
||||||
-- | Install an unpacked cabal distribution.
|
-- | Install an unpacked cabal distribution.
|
||||||
installCabalUnpacked :: (MonadReader env m, HasLog env, MonadCatch m, MonadIO m)
|
installCabalUnpacked :: (MonadLogger m, MonadCatch m, MonadIO m)
|
||||||
=> FilePath -- ^ Path to the unpacked cabal bindist (where the executable resides)
|
=> FilePath -- ^ Path to the unpacked cabal bindist (where the executable resides)
|
||||||
-> FilePath -- ^ Path to install to
|
-> FilePath -- ^ Path to install to
|
||||||
-> Maybe Version -- ^ Nothing for isolated install
|
-> Maybe Version -- ^ Nothing for isolated install
|
||||||
-> Excepts '[CopyError, FileAlreadyExistsError] m ()
|
-> Excepts '[CopyError, FileAlreadyExistsError] m ()
|
||||||
installCabalUnpacked path inst mver' = do
|
installCabalUnpacked path inst mver' = do
|
||||||
lift $ logInfo "Installing cabal"
|
lift $ $(logInfo) "Installing cabal"
|
||||||
let cabalFile = "cabal"
|
let cabalFile = "cabal"
|
||||||
liftIO $ createDirRecursive' inst
|
liftIO $ createDirRecursive' inst
|
||||||
let destFileName = cabalFile
|
let destFileName = cabalFile
|
||||||
<> maybe "" (("-" <>) . T.unpack . prettyVer) mver'
|
<> maybe "" (("-" <>) . T.unpack . prettyVer) mver'
|
||||||
<> exeExt
|
<> exeExt
|
||||||
let destPath = inst </> destFileName
|
let destPath = inst </> destFileName
|
||||||
|
|
||||||
liftE $ throwIfFileAlreadyExists destPath
|
|
||||||
|
|
||||||
handleIO (throwE . CopyError . show) $ liftIO $ copyFile
|
handleIO (throwE . CopyError . show) $ liftIO $ copyFile
|
||||||
(path </> cabalFile <> exeExt)
|
(path </> cabalFile <> exeExt)
|
||||||
destPath
|
destPath
|
||||||
@@ -489,7 +488,7 @@ installCabalBin :: ( MonadMask m
|
|||||||
, HasGHCupInfo env
|
, HasGHCupInfo env
|
||||||
, HasDirs env
|
, HasDirs env
|
||||||
, HasSettings env
|
, HasSettings env
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadResource m
|
, MonadResource m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, MonadUnliftIO m
|
, MonadUnliftIO m
|
||||||
@@ -524,7 +523,7 @@ installHLSBindist :: ( MonadMask m
|
|||||||
, HasPlatformReq env
|
, HasPlatformReq env
|
||||||
, HasDirs env
|
, HasDirs env
|
||||||
, HasSettings env
|
, HasSettings env
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadResource m
|
, MonadResource m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, MonadUnliftIO m
|
, MonadUnliftIO m
|
||||||
@@ -543,12 +542,11 @@ installHLSBindist :: ( MonadMask m
|
|||||||
, UnknownArchive
|
, UnknownArchive
|
||||||
, TarDirDoesNotExist
|
, TarDirDoesNotExist
|
||||||
, ArchiveResult
|
, ArchiveResult
|
||||||
, FileAlreadyExistsError
|
|
||||||
]
|
]
|
||||||
m
|
m
|
||||||
()
|
()
|
||||||
installHLSBindist dlinfo ver isoFilepath = do
|
installHLSBindist dlinfo ver isoFilepath = do
|
||||||
lift $ logDebug $ "Requested to install hls version " <> prettyVer ver
|
lift $ $(logDebug) $ "Requested to install hls version " <> prettyVer ver
|
||||||
|
|
||||||
PlatformRequest {..} <- lift getPlatformReq
|
PlatformRequest {..} <- lift getPlatformReq
|
||||||
Dirs {..} <- lift getDirs
|
Dirs {..} <- lift getDirs
|
||||||
@@ -574,7 +572,7 @@ installHLSBindist dlinfo ver isoFilepath = do
|
|||||||
|
|
||||||
case isoFilepath of
|
case isoFilepath of
|
||||||
Just isoDir -> do
|
Just isoDir -> do
|
||||||
lift $ logInfo $ "isolated installing HLS to " <> T.pack isoDir
|
lift $ $(logInfo) $ "isolated installing HLS to " <> T.pack isoDir
|
||||||
liftE $ installHLSUnpacked workdir isoDir Nothing
|
liftE $ installHLSUnpacked workdir isoDir Nothing
|
||||||
|
|
||||||
Nothing -> do
|
Nothing -> do
|
||||||
@@ -587,13 +585,13 @@ installHLSBindist dlinfo ver isoFilepath = do
|
|||||||
|
|
||||||
|
|
||||||
-- | Install an unpacked hls distribution.
|
-- | Install an unpacked hls distribution.
|
||||||
installHLSUnpacked :: (MonadReader env m, MonadFail m, HasLog env, MonadCatch m, MonadIO m)
|
installHLSUnpacked :: (MonadFail m, MonadLogger m, MonadCatch m, MonadIO m)
|
||||||
=> FilePath -- ^ Path to the unpacked hls bindist (where the executable resides)
|
=> FilePath -- ^ Path to the unpacked hls bindist (where the executable resides)
|
||||||
-> FilePath -- ^ Path to install to
|
-> FilePath -- ^ Path to install to
|
||||||
-> Maybe Version -- ^ Nothing for isolated install
|
-> Maybe Version -- ^ Nothing for isolated install
|
||||||
-> Excepts '[CopyError, FileAlreadyExistsError] m ()
|
-> Excepts '[CopyError] m ()
|
||||||
installHLSUnpacked path inst mver' = do
|
installHLSUnpacked path inst mver' = do
|
||||||
lift $ logInfo "Installing HLS"
|
lift $ $(logInfo) "Installing HLS"
|
||||||
liftIO $ createDirRecursive' inst
|
liftIO $ createDirRecursive' inst
|
||||||
|
|
||||||
-- install haskell-language-server-<ghcver>
|
-- install haskell-language-server-<ghcver>
|
||||||
@@ -607,32 +605,20 @@ installHLSUnpacked path inst mver' = do
|
|||||||
let toF = dropSuffix exeExt f
|
let toF = dropSuffix exeExt f
|
||||||
<> maybe "" (("~" <>) . T.unpack . prettyVer) mver'
|
<> maybe "" (("~" <>) . T.unpack . prettyVer) mver'
|
||||||
<> exeExt
|
<> exeExt
|
||||||
|
|
||||||
let srcPath = path </> f
|
|
||||||
let destPath = inst </> toF
|
|
||||||
|
|
||||||
liftE $ throwIfFileAlreadyExists destPath
|
|
||||||
|
|
||||||
handleIO (throwE . CopyError . show) $ liftIO $ copyFile
|
handleIO (throwE . CopyError . show) $ liftIO $ copyFile
|
||||||
srcPath
|
(path </> f)
|
||||||
destPath
|
(inst </> toF)
|
||||||
lift $ chmod_755 destPath
|
lift $ chmod_755 (inst </> toF)
|
||||||
|
|
||||||
-- install haskell-language-server-wrapper
|
-- install haskell-language-server-wrapper
|
||||||
let wrapper = "haskell-language-server-wrapper"
|
let wrapper = "haskell-language-server-wrapper"
|
||||||
toF = wrapper
|
toF = wrapper
|
||||||
<> maybe "" (("-" <>) . T.unpack . prettyVer) mver'
|
<> maybe "" (("-" <>) . T.unpack . prettyVer) mver'
|
||||||
<> exeExt
|
<> exeExt
|
||||||
srcWrapperPath = path </> wrapper <> exeExt
|
|
||||||
destWrapperPath = inst </> toF
|
|
||||||
|
|
||||||
liftE $ throwIfFileAlreadyExists destWrapperPath
|
|
||||||
|
|
||||||
handleIO (throwE . CopyError . show) $ liftIO $ copyFile
|
handleIO (throwE . CopyError . show) $ liftIO $ copyFile
|
||||||
srcWrapperPath
|
(path </> wrapper <> exeExt)
|
||||||
destWrapperPath
|
(inst </> toF)
|
||||||
|
lift $ chmod_755 (inst </> toF)
|
||||||
lift $ chmod_755 destWrapperPath
|
|
||||||
|
|
||||||
-- | Installs hls binaries @haskell-language-server-\<ghcver\>@
|
-- | Installs hls binaries @haskell-language-server-\<ghcver\>@
|
||||||
-- into @~\/.ghcup\/bin/@, as well as @haskell-languager-server-wrapper@.
|
-- into @~\/.ghcup\/bin/@, as well as @haskell-languager-server-wrapper@.
|
||||||
@@ -643,7 +629,7 @@ installHLSBin :: ( MonadMask m
|
|||||||
, HasGHCupInfo env
|
, HasGHCupInfo env
|
||||||
, HasDirs env
|
, HasDirs env
|
||||||
, HasSettings env
|
, HasSettings env
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadResource m
|
, MonadResource m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, MonadUnliftIO m
|
, MonadUnliftIO m
|
||||||
@@ -661,7 +647,6 @@ installHLSBin :: ( MonadMask m
|
|||||||
, UnknownArchive
|
, UnknownArchive
|
||||||
, TarDirDoesNotExist
|
, TarDirDoesNotExist
|
||||||
, ArchiveResult
|
, ArchiveResult
|
||||||
, FileAlreadyExistsError
|
|
||||||
]
|
]
|
||||||
m
|
m
|
||||||
()
|
()
|
||||||
@@ -680,7 +665,7 @@ installStackBin :: ( MonadMask m
|
|||||||
, HasSettings env
|
, HasSettings env
|
||||||
, HasPlatformReq env
|
, HasPlatformReq env
|
||||||
, HasGHCupInfo env
|
, HasGHCupInfo env
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadResource m
|
, MonadResource m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, MonadUnliftIO m
|
, MonadUnliftIO m
|
||||||
@@ -698,7 +683,6 @@ installStackBin :: ( MonadMask m
|
|||||||
, UnknownArchive
|
, UnknownArchive
|
||||||
, TarDirDoesNotExist
|
, TarDirDoesNotExist
|
||||||
, ArchiveResult
|
, ArchiveResult
|
||||||
, FileAlreadyExistsError
|
|
||||||
]
|
]
|
||||||
m
|
m
|
||||||
()
|
()
|
||||||
@@ -715,7 +699,7 @@ installStackBindist :: ( MonadMask m
|
|||||||
, HasPlatformReq env
|
, HasPlatformReq env
|
||||||
, HasDirs env
|
, HasDirs env
|
||||||
, HasSettings env
|
, HasSettings env
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadResource m
|
, MonadResource m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, MonadUnliftIO m
|
, MonadUnliftIO m
|
||||||
@@ -734,12 +718,11 @@ installStackBindist :: ( MonadMask m
|
|||||||
, UnknownArchive
|
, UnknownArchive
|
||||||
, TarDirDoesNotExist
|
, TarDirDoesNotExist
|
||||||
, ArchiveResult
|
, ArchiveResult
|
||||||
, FileAlreadyExistsError
|
|
||||||
]
|
]
|
||||||
m
|
m
|
||||||
()
|
()
|
||||||
installStackBindist dlinfo ver isoFilepath = do
|
installStackBindist dlinfo ver isoFilepath = do
|
||||||
lift $ logDebug $ "Requested to install stack version " <> prettyVer ver
|
lift $ $(logDebug) $ "Requested to install stack version " <> prettyVer ver
|
||||||
|
|
||||||
PlatformRequest {..} <- lift getPlatformReq
|
PlatformRequest {..} <- lift getPlatformReq
|
||||||
Dirs {..} <- lift getDirs
|
Dirs {..} <- lift getDirs
|
||||||
@@ -764,7 +747,7 @@ installStackBindist dlinfo ver isoFilepath = do
|
|||||||
|
|
||||||
case isoFilepath of
|
case isoFilepath of
|
||||||
Just isoDir -> do -- isolated install
|
Just isoDir -> do -- isolated install
|
||||||
lift $ logInfo $ "isolated installing Stack to " <> T.pack isoDir
|
lift $ $(logInfo) $ "isolated installing Stack to " <> T.pack isoDir
|
||||||
liftE $ installStackUnpacked workdir isoDir Nothing
|
liftE $ installStackUnpacked workdir isoDir Nothing
|
||||||
Nothing -> do -- regular install
|
Nothing -> do -- regular install
|
||||||
liftE $ installStackUnpacked workdir binDir (Just ver)
|
liftE $ installStackUnpacked workdir binDir (Just ver)
|
||||||
@@ -776,22 +759,19 @@ installStackBindist dlinfo ver isoFilepath = do
|
|||||||
|
|
||||||
|
|
||||||
-- | Install an unpacked stack distribution.
|
-- | Install an unpacked stack distribution.
|
||||||
installStackUnpacked :: (MonadReader env m, HasLog env, MonadCatch m, MonadIO m)
|
installStackUnpacked :: (MonadLogger m, MonadCatch m, MonadIO m)
|
||||||
=> FilePath -- ^ Path to the unpacked stack bindist (where the executable resides)
|
=> FilePath -- ^ Path to the unpacked stack bindist (where the executable resides)
|
||||||
-> FilePath -- ^ Path to install to
|
-> FilePath -- ^ Path to install to
|
||||||
-> Maybe Version -- ^ Nothing for isolated installs
|
-> Maybe Version -- ^ Nothing for isolated installs
|
||||||
-> Excepts '[CopyError, FileAlreadyExistsError] m ()
|
-> Excepts '[CopyError] m ()
|
||||||
installStackUnpacked path inst mver' = do
|
installStackUnpacked path inst mver' = do
|
||||||
lift $ logInfo "Installing stack"
|
lift $ $(logInfo) "Installing stack"
|
||||||
let stackFile = "stack"
|
let stackFile = "stack"
|
||||||
liftIO $ createDirRecursive' inst
|
liftIO $ createDirRecursive' inst
|
||||||
let destFileName = stackFile
|
let destFileName = stackFile
|
||||||
<> maybe "" (("-" <>) . T.unpack . prettyVer) mver'
|
<> maybe "" (("-" <>) . T.unpack . prettyVer) mver'
|
||||||
<> exeExt
|
<> exeExt
|
||||||
destPath = inst </> destFileName
|
let destPath = inst </> destFileName
|
||||||
|
|
||||||
liftE $ throwIfFileAlreadyExists destPath
|
|
||||||
|
|
||||||
handleIO (throwE . CopyError . show) $ liftIO $ copyFile
|
handleIO (throwE . CopyError . show) $ liftIO $ copyFile
|
||||||
(path </> stackFile <> exeExt)
|
(path </> stackFile <> exeExt)
|
||||||
destPath
|
destPath
|
||||||
@@ -815,7 +795,7 @@ installStackUnpacked path inst mver' = do
|
|||||||
-- for 'SetGHCOnly' constructor.
|
-- for 'SetGHCOnly' constructor.
|
||||||
setGHC :: ( MonadReader env m
|
setGHC :: ( MonadReader env m
|
||||||
, HasDirs env
|
, HasDirs env
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
, MonadFail m
|
, MonadFail m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
@@ -849,7 +829,7 @@ setGHC ver sghc = do
|
|||||||
SetGHCOnly -> pure $ Just file
|
SetGHCOnly -> pure $ Just file
|
||||||
SetGHC_XY -> do
|
SetGHC_XY -> do
|
||||||
handle
|
handle
|
||||||
(\(e :: ParseError) -> lift $ logWarn (T.pack $ displayException e) >> pure Nothing)
|
(\(e :: ParseError) -> lift $ $(logWarn) (T.pack $ displayException e) >> pure Nothing)
|
||||||
$ do
|
$ do
|
||||||
(mj, mi) <- getMajorMinorV (_tvVersion ver)
|
(mj, mi) <- getMajorMinorV (_tvVersion ver)
|
||||||
let major' = intToText mj <> "." <> intToText mi
|
let major' = intToText mj <> "." <> intToText mi
|
||||||
@@ -874,7 +854,7 @@ setGHC ver sghc = do
|
|||||||
symlinkShareDir :: ( MonadReader env m
|
symlinkShareDir :: ( MonadReader env m
|
||||||
, HasDirs env
|
, HasDirs env
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadCatch m
|
, MonadCatch m
|
||||||
, MonadMask m
|
, MonadMask m
|
||||||
)
|
)
|
||||||
@@ -891,9 +871,9 @@ setGHC ver sghc = do
|
|||||||
whenM (liftIO $ doesDirectoryExist fullsharedir) $ do
|
whenM (liftIO $ doesDirectoryExist fullsharedir) $ do
|
||||||
let fullF = destdir </> sharedir
|
let fullF = destdir </> sharedir
|
||||||
let targetF = "." </> "ghc" </> ver' </> sharedir
|
let targetF = "." </> "ghc" </> ver' </> sharedir
|
||||||
logDebug $ "rm -f " <> T.pack fullF
|
$(logDebug) $ "rm -f " <> T.pack fullF
|
||||||
hideError doesNotExistErrorType $ rmDirectoryLink fullF
|
hideError doesNotExistErrorType $ rmDirectoryLink fullF
|
||||||
logDebug $ "ln -s " <> T.pack targetF <> " " <> T.pack fullF
|
$(logDebug) $ "ln -s " <> T.pack targetF <> " " <> T.pack fullF
|
||||||
liftIO
|
liftIO
|
||||||
#if defined(IS_WINDOWS)
|
#if defined(IS_WINDOWS)
|
||||||
-- On windows we need to be more permissive
|
-- On windows we need to be more permissive
|
||||||
@@ -911,7 +891,7 @@ setGHC ver sghc = do
|
|||||||
setCabal :: ( MonadMask m
|
setCabal :: ( MonadMask m
|
||||||
, MonadReader env m
|
, MonadReader env m
|
||||||
, HasDirs env
|
, HasDirs env
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
, MonadFail m
|
, MonadFail m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
@@ -943,7 +923,7 @@ setCabal ver = do
|
|||||||
setHLS :: ( MonadCatch m
|
setHLS :: ( MonadCatch m
|
||||||
, MonadReader env m
|
, MonadReader env m
|
||||||
, HasDirs env
|
, HasDirs env
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
, MonadFail m
|
, MonadFail m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
@@ -959,7 +939,7 @@ setHLS ver = do
|
|||||||
-- selected version, so we could end up with stray or incorrect symlinks.
|
-- selected version, so we could end up with stray or incorrect symlinks.
|
||||||
oldSyms <- lift hlsSymlinks
|
oldSyms <- lift hlsSymlinks
|
||||||
forM_ oldSyms $ \f -> do
|
forM_ oldSyms $ \f -> do
|
||||||
lift $ logDebug $ "rm " <> T.pack (binDir </> f)
|
lift $ $(logDebug) $ "rm " <> T.pack (binDir </> f)
|
||||||
lift $ rmLink (binDir </> f)
|
lift $ rmLink (binDir </> f)
|
||||||
|
|
||||||
-- set haskell-language-server-<ghcver> symlinks
|
-- set haskell-language-server-<ghcver> symlinks
|
||||||
@@ -984,7 +964,7 @@ setHLS ver = do
|
|||||||
setStack :: ( MonadMask m
|
setStack :: ( MonadMask m
|
||||||
, MonadReader env m
|
, MonadReader env m
|
||||||
, HasDirs env
|
, HasDirs env
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
, MonadFail m
|
, MonadFail m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
@@ -1047,9 +1027,9 @@ availableToolVersions av tool = view
|
|||||||
-- | List all versions from the download info, as well as stray
|
-- | List all versions from the download info, as well as stray
|
||||||
-- versions.
|
-- versions.
|
||||||
listVersions :: ( MonadCatch m
|
listVersions :: ( MonadCatch m
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, MonadReader env m
|
, MonadReader env m
|
||||||
, HasDirs env
|
, HasDirs env
|
||||||
@@ -1105,7 +1085,7 @@ listVersions lt' criteria = do
|
|||||||
, MonadReader env m
|
, MonadReader env m
|
||||||
, HasDirs env
|
, HasDirs env
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
)
|
)
|
||||||
=> Map.Map Version VersionInfo
|
=> Map.Map Version VersionInfo
|
||||||
@@ -1145,7 +1125,7 @@ listVersions lt' criteria = do
|
|||||||
, ..
|
, ..
|
||||||
}
|
}
|
||||||
Left e -> do
|
Left e -> do
|
||||||
logWarn
|
$(logWarn)
|
||||||
$ "Could not parse version of stray directory" <> T.pack e
|
$ "Could not parse version of stray directory" <> T.pack e
|
||||||
pure Nothing
|
pure Nothing
|
||||||
|
|
||||||
@@ -1153,7 +1133,7 @@ listVersions lt' criteria = do
|
|||||||
, HasDirs env
|
, HasDirs env
|
||||||
, MonadCatch m
|
, MonadCatch m
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
)
|
)
|
||||||
=> Map.Map Version VersionInfo
|
=> Map.Map Version VersionInfo
|
||||||
@@ -1180,7 +1160,7 @@ listVersions lt' criteria = do
|
|||||||
, ..
|
, ..
|
||||||
}
|
}
|
||||||
Left e -> do
|
Left e -> do
|
||||||
logWarn
|
$(logWarn)
|
||||||
$ "Could not parse version of stray directory" <> T.pack e
|
$ "Could not parse version of stray directory" <> T.pack e
|
||||||
pure Nothing
|
pure Nothing
|
||||||
|
|
||||||
@@ -1188,7 +1168,7 @@ listVersions lt' criteria = do
|
|||||||
, HasDirs env
|
, HasDirs env
|
||||||
, MonadCatch m
|
, MonadCatch m
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadIO m)
|
, MonadIO m)
|
||||||
=> Map.Map Version VersionInfo
|
=> Map.Map Version VersionInfo
|
||||||
-> Maybe Version
|
-> Maybe Version
|
||||||
@@ -1214,7 +1194,7 @@ listVersions lt' criteria = do
|
|||||||
, ..
|
, ..
|
||||||
}
|
}
|
||||||
Left e -> do
|
Left e -> do
|
||||||
logWarn
|
$(logWarn)
|
||||||
$ "Could not parse version of stray directory" <> T.pack e
|
$ "Could not parse version of stray directory" <> T.pack e
|
||||||
pure Nothing
|
pure Nothing
|
||||||
|
|
||||||
@@ -1222,7 +1202,7 @@ listVersions lt' criteria = do
|
|||||||
, HasDirs env
|
, HasDirs env
|
||||||
, MonadCatch m
|
, MonadCatch m
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
)
|
)
|
||||||
=> Map.Map Version VersionInfo
|
=> Map.Map Version VersionInfo
|
||||||
@@ -1249,7 +1229,7 @@ listVersions lt' criteria = do
|
|||||||
, ..
|
, ..
|
||||||
}
|
}
|
||||||
Left e -> do
|
Left e -> do
|
||||||
logWarn
|
$(logWarn)
|
||||||
$ "Could not parse version of stray directory" <> T.pack e
|
$ "Could not parse version of stray directory" <> T.pack e
|
||||||
pure Nothing
|
pure Nothing
|
||||||
|
|
||||||
@@ -1274,7 +1254,7 @@ listVersions lt' criteria = do
|
|||||||
}
|
}
|
||||||
|
|
||||||
-- NOTE: this are not cross ones, because no bindists
|
-- NOTE: this are not cross ones, because no bindists
|
||||||
toListResult :: ( HasLog env
|
toListResult :: ( MonadLogger m
|
||||||
, MonadReader env m
|
, MonadReader env m
|
||||||
, HasDirs env
|
, HasDirs env
|
||||||
, HasGHCupInfo env
|
, HasGHCupInfo env
|
||||||
@@ -1376,7 +1356,7 @@ listVersions lt' criteria = do
|
|||||||
rmGHCVer :: ( MonadReader env m
|
rmGHCVer :: ( MonadReader env m
|
||||||
, HasDirs env
|
, HasDirs env
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, MonadFail m
|
, MonadFail m
|
||||||
, MonadCatch m
|
, MonadCatch m
|
||||||
@@ -1393,23 +1373,23 @@ rmGHCVer ver = do
|
|||||||
|
|
||||||
-- this isn't atomic, order matters
|
-- this isn't atomic, order matters
|
||||||
when isSetGHC $ do
|
when isSetGHC $ do
|
||||||
lift $ logInfo "Removing ghc symlinks"
|
lift $ $(logInfo) "Removing ghc symlinks"
|
||||||
liftE $ rmPlain (_tvTarget ver)
|
liftE $ rmPlain (_tvTarget ver)
|
||||||
|
|
||||||
lift $ logInfo "Removing ghc-x.y.z symlinks"
|
lift $ $(logInfo) "Removing ghc-x.y.z symlinks"
|
||||||
liftE $ rmMinorSymlinks ver
|
liftE $ rmMinorSymlinks ver
|
||||||
|
|
||||||
lift $ logInfo "Removing/rewiring ghc-x.y symlinks"
|
lift $ $(logInfo) "Removing/rewiring ghc-x.y symlinks"
|
||||||
-- first remove
|
-- first remove
|
||||||
handle (\(_ :: ParseError) -> pure ()) $ liftE $ rmMajorSymlinks ver
|
handle (\(_ :: ParseError) -> pure ()) $ liftE $ rmMajorSymlinks ver
|
||||||
-- then fix them (e.g. with an earlier version)
|
-- then fix them (e.g. with an earlier version)
|
||||||
|
|
||||||
lift $ logInfo $ "Removing directory recursively: " <> T.pack dir
|
lift $ $(logInfo) $ "Removing directory recursively: " <> T.pack dir
|
||||||
lift $ recyclePathForcibly dir
|
lift $ recyclePathForcibly dir
|
||||||
|
|
||||||
v' <-
|
v' <-
|
||||||
handle
|
handle
|
||||||
(\(e :: ParseError) -> lift $ logWarn (T.pack $ displayException e) >> pure Nothing)
|
(\(e :: ParseError) -> lift $ $(logWarn) (T.pack $ displayException e) >> pure Nothing)
|
||||||
$ fmap Just
|
$ fmap Just
|
||||||
$ getMajorMinorV (_tvVersion ver)
|
$ getMajorMinorV (_tvVersion ver)
|
||||||
forM_ v' $ \(mj, mi) -> lift (getGHCForMajor mj mi (_tvTarget ver))
|
forM_ v' $ \(mj, mi) -> lift (getGHCForMajor mj mi (_tvTarget ver))
|
||||||
@@ -1426,7 +1406,7 @@ rmCabalVer :: ( MonadMask m
|
|||||||
, MonadReader env m
|
, MonadReader env m
|
||||||
, HasDirs env
|
, HasDirs env
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, MonadFail m
|
, MonadFail m
|
||||||
, MonadCatch m
|
, MonadCatch m
|
||||||
@@ -1457,7 +1437,7 @@ rmHLSVer :: ( MonadMask m
|
|||||||
, MonadReader env m
|
, MonadReader env m
|
||||||
, HasDirs env
|
, HasDirs env
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, MonadFail m
|
, MonadFail m
|
||||||
, MonadCatch m
|
, MonadCatch m
|
||||||
@@ -1480,7 +1460,7 @@ rmHLSVer ver = do
|
|||||||
oldSyms <- lift hlsSymlinks
|
oldSyms <- lift hlsSymlinks
|
||||||
forM_ oldSyms $ \f -> do
|
forM_ oldSyms $ \f -> do
|
||||||
let fullF = binDir </> f
|
let fullF = binDir </> f
|
||||||
lift $ logDebug $ "rm " <> T.pack fullF
|
lift $ $(logDebug) $ "rm " <> T.pack fullF
|
||||||
lift $ rmLink fullF
|
lift $ rmLink fullF
|
||||||
-- set latest hls
|
-- set latest hls
|
||||||
hlsVers <- lift $ fmap rights getInstalledHLSs
|
hlsVers <- lift $ fmap rights getInstalledHLSs
|
||||||
@@ -1495,7 +1475,7 @@ rmStackVer :: ( MonadMask m
|
|||||||
, MonadReader env m
|
, MonadReader env m
|
||||||
, HasDirs env
|
, HasDirs env
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, MonadFail m
|
, MonadFail m
|
||||||
, MonadCatch m
|
, MonadCatch m
|
||||||
@@ -1525,7 +1505,7 @@ rmGhcup :: ( MonadReader env m
|
|||||||
, HasDirs env
|
, HasDirs env
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, MonadCatch m
|
, MonadCatch m
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadMask m
|
, MonadMask m
|
||||||
, MonadUnliftIO m
|
, MonadUnliftIO m
|
||||||
)
|
)
|
||||||
@@ -1550,7 +1530,7 @@ rmGhcup = do
|
|||||||
|
|
||||||
let areEqualPaths = equalFilePath p1 p2
|
let areEqualPaths = equalFilePath p1 p2
|
||||||
|
|
||||||
unless areEqualPaths $ logWarn $ nonStandardInstallLocationMsg currentRunningExecPath
|
unless areEqualPaths $ $logWarn $ nonStandardInstallLocationMsg currentRunningExecPath
|
||||||
|
|
||||||
#if defined(IS_WINDOWS)
|
#if defined(IS_WINDOWS)
|
||||||
-- since it doesn't seem possible to delete a running exe on windows
|
-- since it doesn't seem possible to delete a running exe on windows
|
||||||
@@ -1566,7 +1546,7 @@ rmGhcup = do
|
|||||||
|
|
||||||
where
|
where
|
||||||
handlePathNotPresent fp _err = do
|
handlePathNotPresent fp _err = do
|
||||||
logDebug $ "Error: The path does not exist, " <> T.pack fp
|
$logDebug $ "Error: The path does not exist, " <> T.pack fp
|
||||||
pure fp
|
pure fp
|
||||||
|
|
||||||
nonStandardInstallLocationMsg path = T.pack $
|
nonStandardInstallLocationMsg path = T.pack $
|
||||||
@@ -1576,7 +1556,7 @@ rmGhcup = do
|
|||||||
|
|
||||||
rmTool :: ( MonadReader env m
|
rmTool :: ( MonadReader env m
|
||||||
, HasDirs env
|
, HasDirs env
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadFail m
|
, MonadFail m
|
||||||
, MonadMask m
|
, MonadMask m
|
||||||
, MonadUnliftIO m)
|
, MonadUnliftIO m)
|
||||||
@@ -1596,7 +1576,7 @@ rmTool ListResult {lVer, lTool, lCross} = do
|
|||||||
rmGhcupDirs :: ( MonadReader env m
|
rmGhcupDirs :: ( MonadReader env m
|
||||||
, HasDirs env
|
, HasDirs env
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadCatch m
|
, MonadCatch m
|
||||||
, MonadMask m )
|
, MonadMask m )
|
||||||
=> m [FilePath]
|
=> m [FilePath]
|
||||||
@@ -1623,7 +1603,7 @@ rmGhcupDirs = do
|
|||||||
handleRm $ rmBinDir binDir
|
handleRm $ rmBinDir binDir
|
||||||
handleRm $ rmDir recycleDir
|
handleRm $ rmDir recycleDir
|
||||||
#if defined(IS_WINDOWS)
|
#if defined(IS_WINDOWS)
|
||||||
logInfo $ "removing " <> T.pack (baseDir </> "msys64")
|
$logInfo $ "removing " <> T.pack (baseDir </> "msys64")
|
||||||
handleRm $ rmPathForcibly (baseDir </> "msys64")
|
handleRm $ rmPathForcibly (baseDir </> "msys64")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1634,27 +1614,27 @@ rmGhcupDirs = do
|
|||||||
hideErrorDef [doesNotExistErrorType] [] $ reportRemainingFiles baseDir
|
hideErrorDef [doesNotExistErrorType] [] $ reportRemainingFiles baseDir
|
||||||
|
|
||||||
where
|
where
|
||||||
handleRm :: (MonadReader env m, MonadCatch m, HasLog env, MonadIO m) => m () -> m ()
|
handleRm :: (MonadCatch m, MonadLogger m) => m () -> m ()
|
||||||
handleRm = handleIO (\e -> logDebug $ "Part of the cleanup action failed with error: " <> T.pack (displayException e) <> "\n"
|
handleRm = handleIO (\e -> $logDebug $ "Part of the cleanup action failed with error: " <> T.pack (displayException e) <> "\n"
|
||||||
<> "continuing regardless...")
|
<> "continuing regardless...")
|
||||||
|
|
||||||
rmEnvFile :: (HasLog env, MonadReader env m, HasDirs env, MonadMask m, MonadIO m, MonadCatch m) => FilePath -> m ()
|
rmEnvFile :: (MonadLogger m, MonadReader env m, HasDirs env, MonadMask m, MonadIO m, MonadCatch m) => FilePath -> m ()
|
||||||
rmEnvFile enFilePath = do
|
rmEnvFile enFilePath = do
|
||||||
logInfo "Removing Ghcup Environment File"
|
$logInfo "Removing Ghcup Environment File"
|
||||||
hideErrorDef [permissionErrorType] () $ deleteFile enFilePath
|
hideErrorDef [permissionErrorType] () $ deleteFile enFilePath
|
||||||
|
|
||||||
rmConfFile :: (HasLog env, MonadReader env m, HasDirs env, MonadMask m, MonadIO m, MonadCatch m) => FilePath -> m ()
|
rmConfFile :: (MonadLogger m, MonadReader env m, HasDirs env, MonadMask m, MonadIO m, MonadCatch m) => FilePath -> m ()
|
||||||
rmConfFile confFilePath = do
|
rmConfFile confFilePath = do
|
||||||
logInfo "removing Ghcup Config File"
|
$logInfo "removing Ghcup Config File"
|
||||||
hideErrorDef [permissionErrorType] () $ deleteFile confFilePath
|
hideErrorDef [permissionErrorType] () $ deleteFile confFilePath
|
||||||
|
|
||||||
rmDir :: (HasLog env, MonadReader env m, HasDirs env, MonadMask m, MonadIO m, MonadCatch m) => FilePath -> m ()
|
rmDir :: (MonadLogger m, MonadReader env m, HasDirs env, MonadMask m, MonadIO m, MonadCatch m) => FilePath -> m ()
|
||||||
rmDir dir =
|
rmDir dir =
|
||||||
-- 'getDirectoryContentsRecursive' is lazy IO. In case
|
-- 'getDirectoryContentsRecursive' is lazy IO. In case
|
||||||
-- an error leaks through, we catch it here as well,
|
-- an error leaks through, we catch it here as well,
|
||||||
-- althought 'deleteFile' should already handle it.
|
-- althought 'deleteFile' should already handle it.
|
||||||
hideErrorDef [doesNotExistErrorType] () $ do
|
hideErrorDef [doesNotExistErrorType] () $ do
|
||||||
logInfo $ "removing " <> T.pack dir
|
$logInfo $ "removing " <> T.pack dir
|
||||||
contents <- liftIO $ getDirectoryContentsRecursive dir
|
contents <- liftIO $ getDirectoryContentsRecursive dir
|
||||||
forM_ contents (deleteFile . (dir </>))
|
forM_ contents (deleteFile . (dir </>))
|
||||||
|
|
||||||
@@ -1727,7 +1707,7 @@ getDebugInfo :: ( Alternative m
|
|||||||
, MonadFail m
|
, MonadFail m
|
||||||
, MonadReader env m
|
, MonadReader env m
|
||||||
, HasDirs env
|
, HasDirs env
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadCatch m
|
, MonadCatch m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
)
|
)
|
||||||
@@ -1763,7 +1743,7 @@ compileGHC :: ( MonadMask m
|
|||||||
, HasSettings env
|
, HasSettings env
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
, MonadResource m
|
, MonadResource m
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, MonadUnliftIO m
|
, MonadUnliftIO m
|
||||||
, MonadFail m
|
, MonadFail m
|
||||||
@@ -1803,7 +1783,7 @@ compileGHC targetGhc ov bstrap jobs mbuildConfig patchdir aargs buildFlavour had
|
|||||||
(workdir, tmpUnpack, tver) <- case targetGhc of
|
(workdir, tmpUnpack, tver) <- case targetGhc of
|
||||||
-- unpack from version tarball
|
-- unpack from version tarball
|
||||||
Left tver -> do
|
Left tver -> do
|
||||||
lift $ logDebug $ "Requested to compile: " <> tVerToText tver <> " with " <> either prettyVer T.pack bstrap
|
lift $ $(logDebug) $ "Requested to compile: " <> tVerToText tver <> " with " <> either prettyVer T.pack bstrap
|
||||||
|
|
||||||
-- download source tarball
|
-- download source tarball
|
||||||
dlInfo <-
|
dlInfo <-
|
||||||
@@ -1828,7 +1808,7 @@ compileGHC targetGhc ov bstrap jobs mbuildConfig patchdir aargs buildFlavour had
|
|||||||
let git args = execLogged "git" ("--no-pager":args) (Just tmpUnpack) "git" Nothing
|
let git args = execLogged "git" ("--no-pager":args) (Just tmpUnpack) "git" Nothing
|
||||||
tver <- reThrowAll @_ @'[ProcessError] DownloadFailed $ do
|
tver <- reThrowAll @_ @'[ProcessError] DownloadFailed $ do
|
||||||
let rep = fromMaybe "https://gitlab.haskell.org/ghc/ghc.git" repo
|
let rep = fromMaybe "https://gitlab.haskell.org/ghc/ghc.git" repo
|
||||||
lift $ logInfo $ "Fetching git repo " <> T.pack rep <> " at ref " <> T.pack ref <> " (this may take a while)"
|
lift $ $(logInfo) $ "Fetching git repo " <> T.pack rep <> " at ref " <> T.pack ref <> " (this may take a while)"
|
||||||
lEM $ git [ "init" ]
|
lEM $ git [ "init" ]
|
||||||
lEM $ git [ "remote"
|
lEM $ git [ "remote"
|
||||||
, "add"
|
, "add"
|
||||||
@@ -1855,7 +1835,7 @@ compileGHC targetGhc ov bstrap jobs mbuildConfig patchdir aargs buildFlavour had
|
|||||||
ExitFailure c -> fail ("Could not figure out GHC project version. Exit code was: " <> show c <> ". Error was: " <> T.unpack (decUTF8Safe' _stdErr))
|
ExitFailure c -> fail ("Could not figure out GHC project version. Exit code was: " <> show c <> ". Error was: " <> T.unpack (decUTF8Safe' _stdErr))
|
||||||
|
|
||||||
liftE $ catchWarn $ lEM @_ @'[ProcessError] $ darwinNotarization _rPlatform tmpUnpack
|
liftE $ catchWarn $ lEM @_ @'[ProcessError] $ darwinNotarization _rPlatform tmpUnpack
|
||||||
lift $ logInfo $ "Git version " <> T.pack ref <> " corresponds to GHC version " <> prettyVer tver
|
lift $ $(logInfo) $ "Git version " <> T.pack ref <> " corresponds to GHC version " <> prettyVer tver
|
||||||
|
|
||||||
pure (tmpUnpack, tmpUnpack, GHCTargetVersion Nothing tver)
|
pure (tmpUnpack, tmpUnpack, GHCTargetVersion Nothing tver)
|
||||||
-- the version that's installed may differ from the
|
-- the version that's installed may differ from the
|
||||||
@@ -1867,10 +1847,10 @@ compileGHC targetGhc ov bstrap jobs mbuildConfig patchdir aargs buildFlavour had
|
|||||||
when alreadyInstalled $ do
|
when alreadyInstalled $ do
|
||||||
case isolateDir of
|
case isolateDir of
|
||||||
Just isoDir ->
|
Just isoDir ->
|
||||||
lift $ logWarn $ "GHC " <> T.pack (prettyShow tver) <> " already installed. Isolate installing to " <> T.pack isoDir
|
lift $ $(logWarn) $ "GHC " <> T.pack (prettyShow tver) <> " already installed. Isolate installing to " <> T.pack isoDir
|
||||||
Nothing ->
|
Nothing ->
|
||||||
lift $ logWarn $ "GHC " <> T.pack (prettyShow tver) <> " already installed. Will overwrite existing version."
|
lift $ $(logWarn) $ "GHC " <> T.pack (prettyShow tver) <> " already installed. Will overwrite existing version."
|
||||||
lift $ logWarn
|
lift $ $(logWarn)
|
||||||
"...waiting for 10 seconds before continuing, you can still abort..."
|
"...waiting for 10 seconds before continuing, you can still abort..."
|
||||||
liftIO $ threadDelay 10000000 -- give the user a sec to intervene
|
liftIO $ threadDelay 10000000 -- give the user a sec to intervene
|
||||||
|
|
||||||
@@ -1897,7 +1877,7 @@ compileGHC targetGhc ov bstrap jobs mbuildConfig patchdir aargs buildFlavour had
|
|||||||
Nothing ->
|
Nothing ->
|
||||||
-- only remove old ghc in regular installs
|
-- only remove old ghc in regular installs
|
||||||
when alreadyInstalled $ do
|
when alreadyInstalled $ do
|
||||||
lift $ logInfo "Deleting existing installation"
|
lift $ $(logInfo) "Deleting existing installation"
|
||||||
liftE $ rmGHCVer tver
|
liftE $ rmGHCVer tver
|
||||||
|
|
||||||
_ -> pure ()
|
_ -> pure ()
|
||||||
@@ -1949,7 +1929,7 @@ endif|]
|
|||||||
, HasPlatformReq env
|
, HasPlatformReq env
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
, MonadCatch m
|
, MonadCatch m
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, MonadFail m
|
, MonadFail m
|
||||||
)
|
)
|
||||||
@@ -1972,7 +1952,7 @@ endif|]
|
|||||||
|
|
||||||
liftE $ configureBindist bghc tver workdir ghcdir
|
liftE $ configureBindist bghc tver workdir ghcdir
|
||||||
|
|
||||||
lift $ logInfo "Building (this may take a while)..."
|
lift $ $(logInfo) "Building (this may take a while)..."
|
||||||
hadrian_build <- liftE $ findHadrianFile workdir
|
hadrian_build <- liftE $ findHadrianFile workdir
|
||||||
lEM $ execLogged hadrian_build
|
lEM $ execLogged hadrian_build
|
||||||
( maybe [] (\j -> ["-j" <> show j] ) jobs
|
( maybe [] (\j -> ["-j" <> show j] ) jobs
|
||||||
@@ -2011,7 +1991,7 @@ endif|]
|
|||||||
, HasPlatformReq env
|
, HasPlatformReq env
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
, MonadCatch m
|
, MonadCatch m
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, MonadFail m
|
, MonadFail m
|
||||||
)
|
)
|
||||||
@@ -2042,15 +2022,15 @@ endif|]
|
|||||||
|
|
||||||
liftE $ checkBuildConfig (build_mk workdir)
|
liftE $ checkBuildConfig (build_mk workdir)
|
||||||
|
|
||||||
lift $ logInfo "Building (this may take a while)..."
|
lift $ $(logInfo) "Building (this may take a while)..."
|
||||||
lEM $ make (maybe [] (\j -> ["-j" <> fS (show j)]) jobs) (Just workdir)
|
lEM $ make (maybe [] (\j -> ["-j" <> fS (show j)]) jobs) (Just workdir)
|
||||||
|
|
||||||
if | isCross tver -> do
|
if | isCross tver -> do
|
||||||
lift $ logInfo "Installing cross toolchain..."
|
lift $ $(logInfo) "Installing cross toolchain..."
|
||||||
lEM $ make ["install"] (Just workdir)
|
lEM $ make ["install"] (Just workdir)
|
||||||
pure Nothing
|
pure Nothing
|
||||||
| otherwise -> do
|
| otherwise -> do
|
||||||
lift $ logInfo "Creating bindist..."
|
lift $ $(logInfo) "Creating bindist..."
|
||||||
lEM $ make ["binary-dist"] (Just workdir)
|
lEM $ make ["binary-dist"] (Just workdir)
|
||||||
[tar] <- liftIO $ findFiles
|
[tar] <- liftIO $ findFiles
|
||||||
workdir
|
workdir
|
||||||
@@ -2069,7 +2049,7 @@ endif|]
|
|||||||
, MonadIO m
|
, MonadIO m
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
, MonadCatch m
|
, MonadCatch m
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
)
|
)
|
||||||
=> GHCTargetVersion
|
=> GHCTargetVersion
|
||||||
-> FilePath -- ^ tar file
|
-> FilePath -- ^ tar file
|
||||||
@@ -2104,10 +2084,10 @@ endif|]
|
|||||||
let tarPath = cacheDir </> tarName
|
let tarPath = cacheDir </> tarName
|
||||||
handleIO (throwE . CopyError . show) $ liftIO $ copyFile (workdir </> tar)
|
handleIO (throwE . CopyError . show) $ liftIO $ copyFile (workdir </> tar)
|
||||||
tarPath
|
tarPath
|
||||||
lift $ logInfo $ "Copied bindist to " <> T.pack tarPath
|
lift $ $(logInfo) $ "Copied bindist to " <> T.pack tarPath
|
||||||
pure tarPath
|
pure tarPath
|
||||||
|
|
||||||
checkBuildConfig :: (MonadReader env m, MonadCatch m, MonadIO m, HasLog env)
|
checkBuildConfig :: (MonadCatch m, MonadIO m, MonadLogger m)
|
||||||
=> FilePath
|
=> FilePath
|
||||||
-> Excepts
|
-> Excepts
|
||||||
'[FileDoesNotExistError, InvalidBuildConfig]
|
'[FileDoesNotExistError, InvalidBuildConfig]
|
||||||
@@ -2130,7 +2110,7 @@ endif|]
|
|||||||
|
|
||||||
forM_ buildFlavour $ \bf ->
|
forM_ buildFlavour $ \bf ->
|
||||||
when (T.pack ("BuildFlavour = " <> bf) `notElem` lines') $ do
|
when (T.pack ("BuildFlavour = " <> bf) `notElem` lines') $ do
|
||||||
lift $ logWarn $ "Customly specified build config overwrites --flavour=" <> T.pack bf <> " switch! Waiting 5 seconds..."
|
lift $ $(logWarn) $ "Customly specified build config overwrites --flavour=" <> T.pack bf <> " switch! Waiting 5 seconds..."
|
||||||
liftIO $ threadDelay 5000000
|
liftIO $ threadDelay 5000000
|
||||||
|
|
||||||
addBuildFlavourToConf bc = case buildFlavour of
|
addBuildFlavourToConf bc = case buildFlavour of
|
||||||
@@ -2147,7 +2127,7 @@ endif|]
|
|||||||
, HasPlatformReq env
|
, HasPlatformReq env
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
, MonadCatch m
|
, MonadCatch m
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, MonadFail m
|
, MonadFail m
|
||||||
)
|
)
|
||||||
@@ -2166,7 +2146,7 @@ endif|]
|
|||||||
m
|
m
|
||||||
()
|
()
|
||||||
configureBindist bghc tver workdir ghcdir = do
|
configureBindist bghc tver workdir ghcdir = do
|
||||||
lift $ logInfo [s|configuring build|]
|
lift $ $(logInfo) [s|configuring build|]
|
||||||
|
|
||||||
forM_ patchdir (\dir -> liftE $ applyPatches dir workdir)
|
forM_ patchdir (\dir -> liftE $ applyPatches dir workdir)
|
||||||
|
|
||||||
@@ -2230,7 +2210,7 @@ upgradeGHCup :: ( MonadMask m
|
|||||||
, HasGHCupInfo env
|
, HasGHCupInfo env
|
||||||
, HasSettings env
|
, HasSettings env
|
||||||
, MonadCatch m
|
, MonadCatch m
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
, MonadResource m
|
, MonadResource m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
@@ -2252,7 +2232,7 @@ upgradeGHCup mtarget force' = do
|
|||||||
Dirs {..} <- lift getDirs
|
Dirs {..} <- lift getDirs
|
||||||
GHCupInfo { _ghcupDownloads = dls } <- lift getGHCupInfo
|
GHCupInfo { _ghcupDownloads = dls } <- lift getGHCupInfo
|
||||||
|
|
||||||
lift $ logInfo "Upgrading GHCup..."
|
lift $ $(logInfo) "Upgrading GHCup..."
|
||||||
let latestVer = fromJust $ fst <$> getLatest dls GHCup
|
let latestVer = fromJust $ fst <$> getLatest dls GHCup
|
||||||
when (not force' && (latestVer <= pvpToVersion ghcUpVer)) $ throwE NoUpdate
|
when (not force' && (latestVer <= pvpToVersion ghcUpVer)) $ throwE NoUpdate
|
||||||
dli <- liftE $ getDownloadInfo GHCup latestVer
|
dli <- liftE $ getDownloadInfo GHCup latestVer
|
||||||
@@ -2261,20 +2241,20 @@ upgradeGHCup mtarget force' = do
|
|||||||
p <- liftE $ download (_dlUri dli) (Just (_dlHash dli)) tmp (Just fn) False
|
p <- liftE $ download (_dlUri dli) (Just (_dlHash dli)) tmp (Just fn) False
|
||||||
let destDir = takeDirectory destFile
|
let destDir = takeDirectory destFile
|
||||||
destFile = fromMaybe (binDir </> fn) mtarget
|
destFile = fromMaybe (binDir </> fn) mtarget
|
||||||
lift $ logDebug $ "mkdir -p " <> T.pack destDir
|
lift $ $(logDebug) $ "mkdir -p " <> T.pack destDir
|
||||||
liftIO $ createDirRecursive' destDir
|
liftIO $ createDirRecursive' destDir
|
||||||
lift $ logDebug $ "rm -f " <> T.pack destFile
|
lift $ $(logDebug) $ "rm -f " <> T.pack destFile
|
||||||
lift $ hideError NoSuchThing $ recycleFile destFile
|
lift $ hideError NoSuchThing $ recycleFile destFile
|
||||||
lift $ logDebug $ "cp " <> T.pack p <> " " <> T.pack destFile
|
lift $ $(logDebug) $ "cp " <> T.pack p <> " " <> T.pack destFile
|
||||||
handleIO (throwE . CopyError . show) $ liftIO $ copyFile p
|
handleIO (throwE . CopyError . show) $ liftIO $ copyFile p
|
||||||
destFile
|
destFile
|
||||||
lift $ chmod_755 destFile
|
lift $ chmod_755 destFile
|
||||||
|
|
||||||
liftIO (isInPath destFile) >>= \b -> unless b $
|
liftIO (isInPath destFile) >>= \b -> unless b $
|
||||||
lift $ logWarn $ T.pack (takeFileName destFile) <> " is not in PATH! You have to add it in order to use ghcup."
|
lift $ $(logWarn) $ T.pack (takeFileName destFile) <> " is not in PATH! You have to add it in order to use ghcup."
|
||||||
liftIO (isShadowed destFile) >>= \case
|
liftIO (isShadowed destFile) >>= \case
|
||||||
Nothing -> pure ()
|
Nothing -> pure ()
|
||||||
Just pa -> lift $ logWarn $ "ghcup is shadowed by "
|
Just pa -> lift $ $(logWarn) $ "ghcup is shadowed by "
|
||||||
<> T.pack pa
|
<> T.pack pa
|
||||||
<> ". The upgrade will not be in effect, unless you remove "
|
<> ". The upgrade will not be in effect, unless you remove "
|
||||||
<> T.pack pa
|
<> T.pack pa
|
||||||
@@ -2298,7 +2278,7 @@ upgradeGHCup mtarget force' = do
|
|||||||
-- both installing from source and bindist.
|
-- both installing from source and bindist.
|
||||||
postGHCInstall :: ( MonadReader env m
|
postGHCInstall :: ( MonadReader env m
|
||||||
, HasDirs env
|
, HasDirs env
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
, MonadFail m
|
, MonadFail m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
@@ -2314,7 +2294,7 @@ postGHCInstall ver@GHCTargetVersion {..} = do
|
|||||||
-- Create ghc-x.y symlinks. This may not be the current
|
-- Create ghc-x.y symlinks. This may not be the current
|
||||||
-- version, create it regardless.
|
-- version, create it regardless.
|
||||||
v' <-
|
v' <-
|
||||||
handle (\(e :: ParseError) -> lift $ logWarn (T.pack $ displayException e) >> pure Nothing)
|
handle (\(e :: ParseError) -> lift $ $(logWarn) (T.pack $ displayException e) >> pure Nothing)
|
||||||
$ fmap Just
|
$ fmap Just
|
||||||
$ getMajorMinorV _tvVersion
|
$ getMajorMinorV _tvVersion
|
||||||
forM_ v' $ \(mj, mi) -> lift (getGHCForMajor mj mi _tvTarget)
|
forM_ v' $ \(mj, mi) -> lift (getGHCForMajor mj mi _tvTarget)
|
||||||
@@ -2330,7 +2310,7 @@ postGHCInstall ver@GHCTargetVersion {..} = do
|
|||||||
-- * for ghcup, this reports the location of the currently running executable
|
-- * for ghcup, this reports the location of the currently running executable
|
||||||
whereIsTool :: ( MonadReader env m
|
whereIsTool :: ( MonadReader env m
|
||||||
, HasDirs env
|
, HasDirs env
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
, MonadFail m
|
, MonadFail m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
@@ -2368,10 +2348,3 @@ whereIsTool tool ver@GHCTargetVersion {..} = do
|
|||||||
liftIO $ canonicalizePath currentRunningExecPath
|
liftIO $ canonicalizePath currentRunningExecPath
|
||||||
|
|
||||||
|
|
||||||
throwIfFileAlreadyExists :: ( MonadIO m ) =>
|
|
||||||
FilePath ->
|
|
||||||
Excepts '[FileAlreadyExistsError] m ()
|
|
||||||
|
|
||||||
throwIfFileAlreadyExists fp = whenM (checkFileAlreadyExists fp)
|
|
||||||
(throwE $ FileAlreadyExistsError fp)
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
{-# LANGUAGE CPP #-}
|
{-# LANGUAGE CPP #-}
|
||||||
{-# LANGUAGE DataKinds #-}
|
{-# LANGUAGE DataKinds #-}
|
||||||
|
{-# LANGUAGE DeriveGeneric #-}
|
||||||
{-# LANGUAGE FlexibleContexts #-}
|
{-# LANGUAGE FlexibleContexts #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
{-# LANGUAGE QuasiQuotes #-}
|
||||||
|
{-# LANGUAGE TemplateHaskell #-}
|
||||||
{-# LANGUAGE TypeApplications #-}
|
{-# LANGUAGE TypeApplications #-}
|
||||||
{-# LANGUAGE TypeFamilies #-}
|
{-# LANGUAGE TypeFamilies #-}
|
||||||
|
|
||||||
@@ -31,8 +34,8 @@ import GHCup.Download.Utils
|
|||||||
#endif
|
#endif
|
||||||
import GHCup.Errors
|
import GHCup.Errors
|
||||||
import GHCup.Types
|
import GHCup.Types
|
||||||
import GHCup.Types.Optics
|
|
||||||
import GHCup.Types.JSON ( )
|
import GHCup.Types.JSON ( )
|
||||||
|
import GHCup.Types.Optics
|
||||||
import GHCup.Utils.Dirs
|
import GHCup.Utils.Dirs
|
||||||
import GHCup.Utils.File
|
import GHCup.Utils.File
|
||||||
import GHCup.Utils.Prelude
|
import GHCup.Utils.Prelude
|
||||||
@@ -44,6 +47,7 @@ import Control.Monad
|
|||||||
#if !MIN_VERSION_base(4,13,0)
|
#if !MIN_VERSION_base(4,13,0)
|
||||||
import Control.Monad.Fail ( MonadFail )
|
import Control.Monad.Fail ( MonadFail )
|
||||||
#endif
|
#endif
|
||||||
|
import Control.Monad.Logger
|
||||||
import Control.Monad.Reader
|
import Control.Monad.Reader
|
||||||
import Control.Monad.Trans.Resource
|
import Control.Monad.Trans.Resource
|
||||||
hiding ( throwM )
|
hiding ( throwM )
|
||||||
@@ -53,8 +57,8 @@ import Data.ByteString ( ByteString )
|
|||||||
#if defined(INTERNAL_DOWNLOADER)
|
#if defined(INTERNAL_DOWNLOADER)
|
||||||
import Data.CaseInsensitive ( mk )
|
import Data.CaseInsensitive ( mk )
|
||||||
#endif
|
#endif
|
||||||
|
import Data.List.Extra
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import Data.List
|
|
||||||
import Data.Time.Clock
|
import Data.Time.Clock
|
||||||
import Data.Time.Clock.POSIX
|
import Data.Time.Clock.POSIX
|
||||||
import Data.Versions
|
import Data.Versions
|
||||||
@@ -68,7 +72,6 @@ import Prelude hiding ( abs
|
|||||||
, readFile
|
, readFile
|
||||||
, writeFile
|
, writeFile
|
||||||
)
|
)
|
||||||
import Safe
|
|
||||||
import System.Directory
|
import System.Directory
|
||||||
import System.Environment
|
import System.Environment
|
||||||
import System.Exit
|
import System.Exit
|
||||||
@@ -86,7 +89,7 @@ import qualified Data.Map.Strict as M
|
|||||||
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 qualified Data.Text.Encoding as E
|
import qualified Data.Text.Encoding as E
|
||||||
import qualified Data.YAML.Aeson as Y
|
import qualified Data.Yaml as Y
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -108,7 +111,7 @@ getDownloadsF :: ( FromJSONKey Tool
|
|||||||
, HasDirs env
|
, HasDirs env
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, MonadCatch m
|
, MonadCatch m
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
, MonadFail m
|
, MonadFail m
|
||||||
, MonadMask m
|
, MonadMask m
|
||||||
@@ -161,7 +164,7 @@ getBase :: ( MonadReader env m
|
|||||||
, MonadFail m
|
, MonadFail m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, MonadCatch m
|
, MonadCatch m
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadMask m
|
, MonadMask m
|
||||||
)
|
)
|
||||||
=> URI
|
=> URI
|
||||||
@@ -183,27 +186,28 @@ getBase uri = do
|
|||||||
|
|
||||||
-- if we didn't get a filepath from the download, use the cached yaml
|
-- if we didn't get a filepath from the download, use the cached yaml
|
||||||
actualYaml <- maybe (lift $ yamlFromCache uri) pure mYaml
|
actualYaml <- maybe (lift $ yamlFromCache uri) pure mYaml
|
||||||
yamlContents <- liftIO $ L.readFile actualYaml
|
lift $ $(logDebug) $ "Decoding yaml at: " <> T.pack actualYaml
|
||||||
lift $ logDebug $ "Decoding yaml at: " <> T.pack actualYaml
|
|
||||||
|
|
||||||
liftE
|
liftE
|
||||||
. onE_ (onError actualYaml)
|
. onE_ (onError actualYaml)
|
||||||
. lE' @_ @_ @'[JSONError] JSONDecodeError
|
. lEM' @_ @_ @'[JSONError] JSONDecodeError
|
||||||
. first (\(_, e) -> unlines [e, "Consider removing " <> actualYaml <> " manually."])
|
. fmap (first (\e -> unlines [displayException e
|
||||||
. Y.decode1
|
,"Consider removing " <> actualYaml <> " manually."]))
|
||||||
$ yamlContents
|
. liftIO
|
||||||
|
. Y.decodeFileEither
|
||||||
|
$ actualYaml
|
||||||
where
|
where
|
||||||
-- On error, remove the etags file and set access time to 0. This should ensure the next invocation
|
-- On error, remove the etags file and set access time to 0. This should ensure the next invocation
|
||||||
-- may re-download and succeed.
|
-- may re-download and succeed.
|
||||||
onError :: (MonadReader env m, HasLog env, MonadMask m, MonadCatch m, MonadIO m) => FilePath -> m ()
|
onError :: (MonadLogger m, MonadMask m, MonadCatch m, MonadIO m) => FilePath -> m ()
|
||||||
onError fp = do
|
onError fp = do
|
||||||
let efp = etagsFile fp
|
let efp = etagsFile fp
|
||||||
handleIO (\e -> logWarn $ "Couldn't remove file " <> T.pack efp <> ", error was: " <> T.pack (displayException e))
|
handleIO (\e -> $(logWarn) $ "Couldn't remove file " <> T.pack efp <> ", error was: " <> T.pack (displayException e))
|
||||||
(hideError doesNotExistErrorType $ rmFile efp)
|
(hideError doesNotExistErrorType $ rmFile efp)
|
||||||
liftIO $ hideError doesNotExistErrorType $ setAccessTime fp (posixSecondsToUTCTime (fromIntegral @Int 0))
|
liftIO $ hideError doesNotExistErrorType $ setAccessTime fp (posixSecondsToUTCTime (fromIntegral @Int 0))
|
||||||
warnCache s = do
|
warnCache s = do
|
||||||
lift $ logWarn "Could not get download info, trying cached version (this may not be recent!)"
|
lift $ $(logWarn) "Could not get download info, trying cached version (this may not be recent!)"
|
||||||
lift $ logDebug $ "Error was: " <> T.pack s
|
lift $ $(logDebug) $ "Error was: " <> T.pack s
|
||||||
|
|
||||||
-- First check if the json file is in the ~/.ghcup/cache dir
|
-- First check if the json file is in the ~/.ghcup/cache dir
|
||||||
-- and check it's access time. If it has been accessed within the
|
-- and check it's access time. If it has been accessed within the
|
||||||
@@ -217,7 +221,7 @@ getBase uri = do
|
|||||||
, MonadCatch m1
|
, MonadCatch m1
|
||||||
, MonadIO m1
|
, MonadIO m1
|
||||||
, MonadFail m1
|
, MonadFail m1
|
||||||
, HasLog env1
|
, MonadLogger m1
|
||||||
, MonadMask m1
|
, MonadMask m1
|
||||||
)
|
)
|
||||||
=> URI
|
=> URI
|
||||||
@@ -308,7 +312,7 @@ download :: ( MonadReader env m
|
|||||||
, HasDirs env
|
, HasDirs env
|
||||||
, MonadMask m
|
, MonadMask m
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
)
|
)
|
||||||
=> URI
|
=> URI
|
||||||
@@ -322,7 +326,7 @@ download uri eDigest dest mfn etags
|
|||||||
| scheme == "http" = dl
|
| scheme == "http" = dl
|
||||||
| scheme == "file" = do
|
| scheme == "file" = do
|
||||||
let destFile' = T.unpack . decUTF8Safe $ path
|
let destFile' = T.unpack . decUTF8Safe $ path
|
||||||
lift $ logDebug $ "using local file: " <> T.pack destFile'
|
lift $ $(logDebug) $ "using local file: " <> T.pack destFile'
|
||||||
forM_ eDigest (liftE . flip checkDigest destFile')
|
forM_ eDigest (liftE . flip checkDigest destFile')
|
||||||
pure destFile'
|
pure destFile'
|
||||||
| otherwise = throwE $ DownloadFailed (variantFromValue UnsupportedScheme)
|
| otherwise = throwE $ DownloadFailed (variantFromValue UnsupportedScheme)
|
||||||
@@ -331,7 +335,7 @@ download uri eDigest dest mfn etags
|
|||||||
scheme = view (uriSchemeL' % schemeBSL') uri
|
scheme = view (uriSchemeL' % schemeBSL') uri
|
||||||
dl = do
|
dl = do
|
||||||
destFile <- liftE . reThrowAll @_ @_ @'[DownloadFailed] DownloadFailed $ getDestFile
|
destFile <- liftE . reThrowAll @_ @_ @'[DownloadFailed] DownloadFailed $ getDestFile
|
||||||
lift $ logInfo $ "downloading: " <> uri' <> " as file " <> T.pack destFile
|
lift $ $(logInfo) $ "downloading: " <> uri' <> " as file " <> T.pack destFile
|
||||||
|
|
||||||
-- destination dir must exist
|
-- destination dir must exist
|
||||||
liftIO $ createDirRecursive' dest
|
liftIO $ createDirRecursive' dest
|
||||||
@@ -354,7 +358,7 @@ download uri eDigest dest mfn etags
|
|||||||
dh <- liftIO $ emptySystemTempFile "curl-header"
|
dh <- liftIO $ emptySystemTempFile "curl-header"
|
||||||
flip finally (try @_ @SomeException $ rmFile dh) $
|
flip finally (try @_ @SomeException $ rmFile dh) $
|
||||||
flip finally (try @_ @SomeException $ rmFile (destFile <.> "tmp")) $ do
|
flip finally (try @_ @SomeException $ rmFile (destFile <.> "tmp")) $ do
|
||||||
metag <- lift $ readETag destFile
|
metag <- readETag destFile
|
||||||
liftE $ lEM @_ @'[ProcessError] $ exec "curl"
|
liftE $ lEM @_ @'[ProcessError] $ exec "curl"
|
||||||
(o' ++ (if etags then ["--dump-header", dh] else [])
|
(o' ++ (if etags then ["--dump-header", dh] else [])
|
||||||
++ maybe [] (\t -> ["-H", "If-None-Match: " <> T.unpack t]) metag
|
++ maybe [] (\t -> ["-H", "If-None-Match: " <> T.unpack t]) metag
|
||||||
@@ -366,14 +370,14 @@ download uri eDigest dest mfn etags
|
|||||||
case fmap T.words . listToMaybe . fmap T.strip . T.lines . getLastHeader $ headers of
|
case fmap T.words . listToMaybe . fmap T.strip . T.lines . getLastHeader $ headers of
|
||||||
Just (http':sc:_)
|
Just (http':sc:_)
|
||||||
| sc == "304"
|
| sc == "304"
|
||||||
, T.pack "HTTP" `T.isPrefixOf` http' -> lift $ logDebug "Status code was 304, not overwriting"
|
, T.pack "HTTP" `T.isPrefixOf` http' -> $logDebug "Status code was 304, not overwriting"
|
||||||
| T.pack "HTTP" `T.isPrefixOf` http' -> do
|
| T.pack "HTTP" `T.isPrefixOf` http' -> do
|
||||||
lift $ logDebug $ "Status code was " <> sc <> ", overwriting"
|
$logDebug $ "Status code was " <> sc <> ", overwriting"
|
||||||
liftIO $ copyFile (destFile <.> "tmp") destFile
|
liftIO $ copyFile (destFile <.> "tmp") destFile
|
||||||
_ -> liftE $ throwE @_ @'[DownloadFailed] (DownloadFailed (toVariantAt @0 (MalformedHeaders headers)
|
_ -> liftE $ throwE @_ @'[DownloadFailed] (DownloadFailed (toVariantAt @0 (MalformedHeaders headers)
|
||||||
:: V '[MalformedHeaders]))
|
:: V '[MalformedHeaders]))
|
||||||
|
|
||||||
lift $ writeEtags destFile (parseEtags headers)
|
writeEtags destFile (parseEtags headers)
|
||||||
else
|
else
|
||||||
liftE $ lEM @_ @'[ProcessError] $ exec "curl"
|
liftE $ lEM @_ @'[ProcessError] $ exec "curl"
|
||||||
(o' ++ ["-fL", "-o", destFile, T.unpack uri']) Nothing Nothing
|
(o' ++ ["-fL", "-o", destFile, T.unpack uri']) Nothing Nothing
|
||||||
@@ -383,20 +387,20 @@ download uri eDigest dest mfn etags
|
|||||||
o' <- liftIO getWgetOpts
|
o' <- liftIO getWgetOpts
|
||||||
if etags
|
if etags
|
||||||
then do
|
then do
|
||||||
metag <- lift $ readETag destFile
|
metag <- readETag destFile
|
||||||
let opts = o' ++ maybe [] (\t -> ["--header", "If-None-Match: " <> T.unpack t]) metag
|
let opts = o' ++ maybe [] (\t -> ["--header", "If-None-Match: " <> T.unpack t]) metag
|
||||||
++ ["-q", "-S", "-O", destFileTemp , T.unpack uri']
|
++ ["-q", "-S", "-O", destFileTemp , T.unpack uri']
|
||||||
CapturedProcess {_exitCode, _stdErr} <- lift $ executeOut "wget" opts Nothing
|
CapturedProcess {_exitCode, _stdErr} <- lift $ executeOut "wget" opts Nothing
|
||||||
case _exitCode of
|
case _exitCode of
|
||||||
ExitSuccess -> do
|
ExitSuccess -> do
|
||||||
liftIO $ copyFile destFileTemp destFile
|
liftIO $ copyFile destFileTemp destFile
|
||||||
lift $ writeEtags destFile (parseEtags (decUTF8Safe' _stdErr))
|
writeEtags destFile (parseEtags (decUTF8Safe' _stdErr))
|
||||||
ExitFailure i'
|
ExitFailure i'
|
||||||
| i' == 8
|
| i' == 8
|
||||||
, Just _ <- find (T.pack "304 Not Modified" `T.isInfixOf`) . T.lines . decUTF8Safe' $ _stdErr
|
, Just _ <- find (T.pack "304 Not Modified" `T.isInfixOf`) . T.lines . decUTF8Safe' $ _stdErr
|
||||||
-> do
|
-> do
|
||||||
lift $ logDebug "Not modified, skipping download"
|
$logDebug "Not modified, skipping download"
|
||||||
lift $ writeEtags destFile (parseEtags (decUTF8Safe' _stdErr))
|
writeEtags destFile (parseEtags (decUTF8Safe' _stdErr))
|
||||||
| otherwise -> throwE (NonZeroExit i' "wget" opts)
|
| otherwise -> throwE (NonZeroExit i' "wget" opts)
|
||||||
else do
|
else do
|
||||||
let opts = o' ++ ["-O", destFileTemp , T.unpack uri']
|
let opts = o' ++ ["-O", destFileTemp , T.unpack uri']
|
||||||
@@ -407,14 +411,14 @@ download uri eDigest dest mfn etags
|
|||||||
(https, host, fullPath, port) <- liftE $ uriToQuadruple uri
|
(https, host, fullPath, port) <- liftE $ uriToQuadruple uri
|
||||||
if etags
|
if etags
|
||||||
then do
|
then do
|
||||||
metag <- lift $ readETag destFile
|
metag <- readETag destFile
|
||||||
let addHeaders = maybe mempty (\etag -> M.fromList [ (mk . E.encodeUtf8 . T.pack $ "If-None-Match"
|
let addHeaders = maybe mempty (\etag -> M.fromList [ (mk . E.encodeUtf8 . T.pack $ "If-None-Match"
|
||||||
, E.encodeUtf8 etag)]) metag
|
, E.encodeUtf8 etag)]) metag
|
||||||
liftE
|
liftE
|
||||||
$ catchE @HTTPNotModified @'[DownloadFailed] @'[] (\(HTTPNotModified etag) -> lift $ writeEtags destFile (pure $ Just etag))
|
$ catchE @HTTPNotModified @'[DownloadFailed] @'[] (\(HTTPNotModified etag) -> lift $ writeEtags destFile (pure $ Just etag))
|
||||||
$ do
|
$ do
|
||||||
r <- downloadToFile https host fullPath port destFile addHeaders
|
r <- downloadToFile https host fullPath port destFile addHeaders
|
||||||
lift $ writeEtags destFile (pure $ decUTF8Safe <$> getHeader r "etag")
|
writeEtags destFile (pure $ decUTF8Safe <$> getHeader r "etag")
|
||||||
else void $ liftE $ catchE @HTTPNotModified
|
else void $ liftE $ catchE @HTTPNotModified
|
||||||
@'[DownloadFailed]
|
@'[DownloadFailed]
|
||||||
(\e@(HTTPNotModified _) ->
|
(\e@(HTTPNotModified _) ->
|
||||||
@@ -440,33 +444,33 @@ download uri eDigest dest mfn etags
|
|||||||
path = view pathL' uri
|
path = view pathL' uri
|
||||||
uri' = decUTF8Safe (serializeURIRef' uri)
|
uri' = decUTF8Safe (serializeURIRef' uri)
|
||||||
|
|
||||||
parseEtags :: (MonadReader env m, HasLog env, MonadIO m, MonadThrow m) => T.Text -> m (Maybe T.Text)
|
parseEtags :: (MonadLogger m, MonadIO m, MonadThrow m) => T.Text -> m (Maybe T.Text)
|
||||||
parseEtags stderr = do
|
parseEtags stderr = do
|
||||||
let mEtag = find (\line -> T.pack "etag:" `T.isPrefixOf` T.toLower line) . fmap T.strip . T.lines . getLastHeader $ stderr
|
let mEtag = find (\line -> T.pack "etag:" `T.isPrefixOf` T.toLower line) . fmap T.strip . T.lines . getLastHeader $ stderr
|
||||||
case T.words <$> mEtag of
|
case T.words <$> mEtag of
|
||||||
(Just []) -> do
|
(Just []) -> do
|
||||||
logDebug "Couldn't parse etags, no input: "
|
$logDebug "Couldn't parse etags, no input: "
|
||||||
pure Nothing
|
pure Nothing
|
||||||
(Just [_, etag']) -> do
|
(Just [_, etag']) -> do
|
||||||
logDebug $ "Parsed etag: " <> etag'
|
$logDebug $ "Parsed etag: " <> etag'
|
||||||
pure (Just etag')
|
pure (Just etag')
|
||||||
(Just xs) -> do
|
(Just xs) -> do
|
||||||
logDebug ("Couldn't parse etags, unexpected input: " <> T.unwords xs)
|
$logDebug ("Couldn't parse etags, unexpected input: " <> T.unwords xs)
|
||||||
pure Nothing
|
pure Nothing
|
||||||
Nothing -> do
|
Nothing -> do
|
||||||
logDebug "No etags header found"
|
$logDebug "No etags header found"
|
||||||
pure Nothing
|
pure Nothing
|
||||||
|
|
||||||
writeEtags :: (MonadReader env m, HasLog env, MonadIO m, MonadThrow m) => FilePath -> m (Maybe T.Text) -> m ()
|
writeEtags :: (MonadLogger m, MonadIO m, MonadThrow m) => FilePath -> m (Maybe T.Text) -> m ()
|
||||||
writeEtags destFile getTags = do
|
writeEtags destFile getTags = do
|
||||||
getTags >>= \case
|
getTags >>= \case
|
||||||
Just t -> do
|
Just t -> do
|
||||||
logDebug $ "Writing etagsFile " <> T.pack (etagsFile destFile)
|
$logDebug $ "Writing etagsFile " <> T.pack (etagsFile destFile)
|
||||||
liftIO $ T.writeFile (etagsFile destFile) t
|
liftIO $ T.writeFile (etagsFile destFile) t
|
||||||
Nothing ->
|
Nothing ->
|
||||||
logDebug "No etags files written"
|
$logDebug "No etags files written"
|
||||||
|
|
||||||
readETag :: (MonadReader env m, HasLog env, MonadCatch m, MonadIO m) => FilePath -> m (Maybe T.Text)
|
readETag :: (MonadLogger m, MonadCatch m, MonadIO m) => FilePath -> m (Maybe T.Text)
|
||||||
readETag fp = do
|
readETag fp = do
|
||||||
e <- liftIO $ doesFileExist fp
|
e <- liftIO $ doesFileExist fp
|
||||||
if e
|
if e
|
||||||
@@ -474,13 +478,13 @@ download uri eDigest dest mfn etags
|
|||||||
rE <- try @_ @SomeException $ liftIO $ fmap stripNewline' $ T.readFile (etagsFile fp)
|
rE <- try @_ @SomeException $ liftIO $ fmap stripNewline' $ T.readFile (etagsFile fp)
|
||||||
case rE of
|
case rE of
|
||||||
(Right et) -> do
|
(Right et) -> do
|
||||||
logDebug $ "Read etag: " <> et
|
$logDebug $ "Read etag: " <> et
|
||||||
pure (Just et)
|
pure (Just et)
|
||||||
(Left _) -> do
|
(Left _) -> do
|
||||||
logDebug "Etag file doesn't exist (yet)"
|
$logDebug "Etag file doesn't exist (yet)"
|
||||||
pure Nothing
|
pure Nothing
|
||||||
else do
|
else do
|
||||||
logDebug $ "Skipping and deleting etags file because destination file " <> T.pack fp <> " doesn't exist"
|
$logDebug $ "Skipping and deleting etags file because destination file " <> T.pack fp <> " doesn't exist"
|
||||||
liftIO $ hideError doesNotExistErrorType $ rmFile (etagsFile fp)
|
liftIO $ hideError doesNotExistErrorType $ rmFile (etagsFile fp)
|
||||||
pure Nothing
|
pure Nothing
|
||||||
|
|
||||||
@@ -493,7 +497,7 @@ downloadCached :: ( MonadReader env m
|
|||||||
, MonadMask m
|
, MonadMask m
|
||||||
, MonadResource m
|
, MonadResource m
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, MonadUnliftIO m
|
, MonadUnliftIO m
|
||||||
)
|
)
|
||||||
@@ -514,7 +518,7 @@ downloadCached' :: ( MonadReader env m
|
|||||||
, HasSettings env
|
, HasSettings env
|
||||||
, MonadMask m
|
, MonadMask m
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, MonadUnliftIO m
|
, MonadUnliftIO m
|
||||||
)
|
)
|
||||||
@@ -548,7 +552,7 @@ checkDigest :: ( MonadReader env m
|
|||||||
, HasSettings env
|
, HasSettings env
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
)
|
)
|
||||||
=> T.Text -- ^ the hash
|
=> T.Text -- ^ the hash
|
||||||
-> FilePath
|
-> FilePath
|
||||||
@@ -558,7 +562,7 @@ checkDigest eDigest file = do
|
|||||||
let verify = not noVerify
|
let verify = not noVerify
|
||||||
when verify $ do
|
when verify $ do
|
||||||
let p' = takeFileName file
|
let p' = takeFileName file
|
||||||
lift $ logInfo $ "verifying digest of: " <> T.pack p'
|
lift $ $(logInfo) $ "verifying digest of: " <> T.pack p'
|
||||||
c <- liftIO $ L.readFile file
|
c <- liftIO $ L.readFile file
|
||||||
cDigest <- throwEither . E.decodeUtf8' . B16.encode . SHA256.hashlazy $ c
|
cDigest <- throwEither . E.decodeUtf8' . B16.encode . SHA256.hashlazy $ c
|
||||||
when ((cDigest /= eDigest) && verify) $ throwE (DigestError cDigest eDigest)
|
when ((cDigest /= eDigest) && verify) $ throwE (DigestError cDigest eDigest)
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ instance Pretty NoCompatiblePlatform where
|
|||||||
pPrint (NoCompatiblePlatform str') =
|
pPrint (NoCompatiblePlatform str') =
|
||||||
text ("Could not find a compatible platform. Got: " ++ str')
|
text ("Could not find a compatible platform. Got: " ++ str')
|
||||||
|
|
||||||
-- | Unable to find a download for the requested version/distro.
|
-- | Unable to find a download for the requested versio/distro.
|
||||||
data NoDownload = NoDownload
|
data NoDownload = NoDownload
|
||||||
deriving Show
|
deriving Show
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ module GHCup.Platform where
|
|||||||
|
|
||||||
import GHCup.Errors
|
import GHCup.Errors
|
||||||
import GHCup.Types
|
import GHCup.Types
|
||||||
import GHCup.Types.Optics
|
|
||||||
import GHCup.Types.JSON ( )
|
import GHCup.Types.JSON ( )
|
||||||
import GHCup.Utils.File
|
import GHCup.Utils.File
|
||||||
import GHCup.Utils.Prelude
|
import GHCup.Utils.Prelude
|
||||||
@@ -29,6 +28,7 @@ import GHCup.Utils.String.QQ
|
|||||||
import Control.Applicative
|
import Control.Applicative
|
||||||
import Control.Exception.Safe
|
import Control.Exception.Safe
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
|
import Control.Monad.Logger
|
||||||
import Control.Monad.Reader
|
import Control.Monad.Reader
|
||||||
import Data.ByteString ( ByteString )
|
import Data.ByteString ( ByteString )
|
||||||
import Data.Foldable
|
import Data.Foldable
|
||||||
@@ -57,7 +57,7 @@ import qualified Data.Text.IO as T
|
|||||||
|
|
||||||
|
|
||||||
-- | Get the full platform request, consisting of architecture, distro, ...
|
-- | Get the full platform request, consisting of architecture, distro, ...
|
||||||
platformRequest :: (MonadReader env m, Alternative m, MonadFail m, HasLog env, MonadCatch m, MonadIO m)
|
platformRequest :: (Alternative m, MonadFail m, MonadLogger m, MonadCatch m, MonadIO m)
|
||||||
=> Excepts
|
=> Excepts
|
||||||
'[NoCompatiblePlatform, NoCompatibleArch, DistroNotFound]
|
'[NoCompatiblePlatform, NoCompatibleArch, DistroNotFound]
|
||||||
m
|
m
|
||||||
@@ -82,7 +82,7 @@ getArchitecture = case arch of
|
|||||||
what -> Left (NoCompatibleArch what)
|
what -> Left (NoCompatibleArch what)
|
||||||
|
|
||||||
|
|
||||||
getPlatform :: (Alternative m, MonadReader env m, HasLog env, MonadCatch m, MonadIO m, MonadFail m)
|
getPlatform :: (Alternative m, MonadLogger m, MonadCatch m, MonadIO m, MonadFail m)
|
||||||
=> Excepts
|
=> Excepts
|
||||||
'[NoCompatiblePlatform, DistroNotFound]
|
'[NoCompatiblePlatform, DistroNotFound]
|
||||||
m
|
m
|
||||||
@@ -107,7 +107,7 @@ getPlatform = do
|
|||||||
pure $ PlatformResult { _platform = FreeBSD, _distroVersion = ver }
|
pure $ PlatformResult { _platform = FreeBSD, _distroVersion = ver }
|
||||||
"mingw32" -> pure PlatformResult { _platform = Windows, _distroVersion = Nothing }
|
"mingw32" -> pure PlatformResult { _platform = Windows, _distroVersion = Nothing }
|
||||||
what -> throwE $ NoCompatiblePlatform what
|
what -> throwE $ NoCompatiblePlatform what
|
||||||
lift $ logDebug $ "Identified Platform as: " <> T.pack (prettyShow pfr)
|
lift $ $(logDebug) $ "Identified Platform as: " <> T.pack (prettyShow pfr)
|
||||||
pure pfr
|
pure pfr
|
||||||
where
|
where
|
||||||
getFreeBSDVersion = lift $ fmap _stdOut $ executeOut "freebsd-version" [] Nothing
|
getFreeBSDVersion = lift $ fmap _stdOut $ executeOut "freebsd-version" [] Nothing
|
||||||
@@ -138,11 +138,12 @@ getLinuxDistro = do
|
|||||||
| hasWord name ["exherbo"] -> Exherbo
|
| hasWord name ["exherbo"] -> Exherbo
|
||||||
| hasWord name ["gentoo"] -> Gentoo
|
| hasWord name ["gentoo"] -> Gentoo
|
||||||
| hasWord name ["amazonlinux", "Amazon Linux"] -> AmazonLinux
|
| hasWord name ["amazonlinux", "Amazon Linux"] -> AmazonLinux
|
||||||
| hasWord name ["solus"] -> Solus
|
|
||||||
| otherwise -> UnknownLinux
|
| otherwise -> UnknownLinux
|
||||||
pure (distro, parsedVer)
|
pure (distro, parsedVer)
|
||||||
where
|
where
|
||||||
hasWord t = any (\x -> match (regex x) (T.unpack t))
|
hasWord t matches = foldr (\x y -> match (regex x) (T.unpack t) || y)
|
||||||
|
False
|
||||||
|
matches
|
||||||
where
|
where
|
||||||
regex x = makeRegexOpts compIgnoreCase execBlank ([s|\<|] ++ x ++ [s|\>|])
|
regex x = makeRegexOpts compIgnoreCase execBlank ([s|\<|] ++ x ++ [s|\>|])
|
||||||
|
|
||||||
|
|||||||
@@ -25,17 +25,21 @@ module GHCup.Types
|
|||||||
)
|
)
|
||||||
where
|
where
|
||||||
|
|
||||||
|
import Control.Applicative
|
||||||
import Control.DeepSeq ( NFData, rnf )
|
import Control.DeepSeq ( NFData, rnf )
|
||||||
|
import Control.Monad.Logger
|
||||||
import Data.Map.Strict ( Map )
|
import Data.Map.Strict ( Map )
|
||||||
import Data.List.NonEmpty ( NonEmpty (..) )
|
import Data.List.NonEmpty ( NonEmpty (..) )
|
||||||
import Data.Text ( Text )
|
import Data.Text ( Text )
|
||||||
import Data.Versions
|
import Data.Versions
|
||||||
|
import Haskus.Utils.Variant.Excepts
|
||||||
import Text.PrettyPrint.HughesPJClass (Pretty, pPrint, text)
|
import Text.PrettyPrint.HughesPJClass (Pretty, pPrint, text)
|
||||||
import URI.ByteString
|
import URI.ByteString
|
||||||
#if defined(BRICK)
|
#if defined(BRICK)
|
||||||
import Graphics.Vty ( Key(..) )
|
import Graphics.Vty ( Key(..) )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
import qualified Control.Monad.Trans.Class as Trans
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
import qualified GHC.Generics as GHC
|
import qualified GHC.Generics as GHC
|
||||||
|
|
||||||
@@ -148,7 +152,7 @@ data Tag = Latest
|
|||||||
| Recommended
|
| Recommended
|
||||||
| Prerelease
|
| Prerelease
|
||||||
| Base PVP
|
| Base PVP
|
||||||
| Old -- ^ old versions are hidden by default in TUI
|
| Old -- ^ old version are hidden by default in TUI
|
||||||
| UnknownTag String -- ^ used for upwardscompat
|
| UnknownTag String -- ^ used for upwardscompat
|
||||||
deriving (Ord, Eq, GHC.Generic, Show) -- FIXME: manual JSON instance
|
deriving (Ord, Eq, GHC.Generic, Show) -- FIXME: manual JSON instance
|
||||||
|
|
||||||
@@ -237,7 +241,7 @@ instance NFData LinuxDistro
|
|||||||
distroToString :: LinuxDistro -> String
|
distroToString :: LinuxDistro -> String
|
||||||
distroToString Debian = "debian"
|
distroToString Debian = "debian"
|
||||||
distroToString Ubuntu = "ubuntu"
|
distroToString Ubuntu = "ubuntu"
|
||||||
distroToString Mint = "mint"
|
distroToString Mint= "mint"
|
||||||
distroToString Fedora = "fedora"
|
distroToString Fedora = "fedora"
|
||||||
distroToString CentOS = "centos"
|
distroToString CentOS = "centos"
|
||||||
distroToString RedHat = "redhat"
|
distroToString RedHat = "redhat"
|
||||||
@@ -392,7 +396,6 @@ data AppState = AppState
|
|||||||
, keyBindings :: KeyBindings
|
, keyBindings :: KeyBindings
|
||||||
, ghcupInfo :: GHCupInfo
|
, ghcupInfo :: GHCupInfo
|
||||||
, pfreq :: PlatformRequest
|
, pfreq :: PlatformRequest
|
||||||
, loggerConfig :: LoggerConfig
|
|
||||||
} deriving (Show, GHC.Generic)
|
} deriving (Show, GHC.Generic)
|
||||||
|
|
||||||
instance NFData AppState
|
instance NFData AppState
|
||||||
@@ -401,7 +404,6 @@ data LeanAppState = LeanAppState
|
|||||||
{ settings :: Settings
|
{ settings :: Settings
|
||||||
, dirs :: Dirs
|
, dirs :: Dirs
|
||||||
, keyBindings :: KeyBindings
|
, keyBindings :: KeyBindings
|
||||||
, loggerConfig :: LoggerConfig
|
|
||||||
} deriving (Show, GHC.Generic)
|
} deriving (Show, GHC.Generic)
|
||||||
|
|
||||||
instance NFData LeanAppState
|
instance NFData LeanAppState
|
||||||
@@ -553,25 +555,14 @@ instance Pretty Versioning where
|
|||||||
instance Pretty Version where
|
instance Pretty Version where
|
||||||
pPrint = text . T.unpack . prettyVer
|
pPrint = text . T.unpack . prettyVer
|
||||||
|
|
||||||
instance Show (a -> b) where
|
|
||||||
show _ = "<function>"
|
|
||||||
|
|
||||||
instance Show (IO ()) where
|
instance (Monad m, Alternative m) => Alternative (LoggingT m) where
|
||||||
show _ = "<io>"
|
empty = Trans.lift empty
|
||||||
|
{-# INLINE empty #-}
|
||||||
|
m <|> n = LoggingT $ \ r -> runLoggingT m r <|> runLoggingT n r
|
||||||
|
{-# INLINE (<|>) #-}
|
||||||
|
|
||||||
|
|
||||||
data LogLevel = Warn
|
instance MonadLogger m => MonadLogger (Excepts e m) where
|
||||||
| Info
|
monadLoggerLog a b c d = Trans.lift $ monadLoggerLog a b c d
|
||||||
| Debug
|
|
||||||
| Error
|
|
||||||
deriving (Eq, Ord, Show)
|
|
||||||
|
|
||||||
data LoggerConfig = LoggerConfig
|
|
||||||
{ lcPrintDebug :: Bool -- ^ whether to print debug in colorOutter
|
|
||||||
, colorOutter :: T.Text -> IO () -- ^ how to write the color output
|
|
||||||
, rawOutter :: T.Text -> IO () -- ^ how to write the full raw output
|
|
||||||
}
|
|
||||||
deriving Show
|
|
||||||
|
|
||||||
instance NFData LoggerConfig where
|
|
||||||
rnf (LoggerConfig !lcPrintDebug !_ !_) = rnf lcPrintDebug
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ import qualified Text.Megaparsec as MP
|
|||||||
import qualified Text.Megaparsec.Char as MPC
|
import qualified Text.Megaparsec.Char as MPC
|
||||||
|
|
||||||
|
|
||||||
deriveJSON defaultOptions { fieldLabelModifier = removeLensFieldLabel } ''Architecture
|
deriveJSON defaultOptions { fieldLabelModifier = removeLensFieldLabel } { fieldLabelModifier = removeLensFieldLabel } ''Architecture
|
||||||
deriveJSON defaultOptions { fieldLabelModifier = removeLensFieldLabel } ''LinuxDistro
|
deriveJSON defaultOptions { fieldLabelModifier = removeLensFieldLabel } ''LinuxDistro
|
||||||
deriveJSON defaultOptions { fieldLabelModifier = removeLensFieldLabel } ''VSep
|
deriveJSON defaultOptions { fieldLabelModifier = removeLensFieldLabel } ''VSep
|
||||||
deriveJSON defaultOptions { fieldLabelModifier = removeLensFieldLabel } ''VUnit
|
deriveJSON defaultOptions { fieldLabelModifier = removeLensFieldLabel } ''VUnit
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
{-# LANGUAGE FlexibleContexts #-}
|
{-# LANGUAGE FlexibleContexts #-}
|
||||||
{-# LANGUAGE AllowAmbiguousTypes #-}
|
{-# LANGUAGE AllowAmbiguousTypes #-}
|
||||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
{-# LANGUAGE MultiParamTypeClasses #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
|
|
||||||
{-|
|
{-|
|
||||||
Module : GHCup.Types.Optics
|
Module : GHCup.Types.Optics
|
||||||
@@ -22,13 +21,9 @@ module GHCup.Types.Optics where
|
|||||||
import GHCup.Types
|
import GHCup.Types
|
||||||
|
|
||||||
import Control.Monad.Reader
|
import Control.Monad.Reader
|
||||||
import Data.ByteString ( ByteString )
|
import Data.ByteString ( ByteString )
|
||||||
import Data.Text ( Text )
|
|
||||||
import Optics
|
import Optics
|
||||||
import URI.ByteString
|
import URI.ByteString
|
||||||
import System.Console.Pretty
|
|
||||||
|
|
||||||
import qualified Data.Text as T
|
|
||||||
|
|
||||||
makePrisms ''Tool
|
makePrisms ''Tool
|
||||||
makePrisms ''Architecture
|
makePrisms ''Architecture
|
||||||
@@ -92,15 +87,13 @@ getLeanAppState :: ( MonadReader env m
|
|||||||
, LabelOptic' "settings" A_Lens env Settings
|
, LabelOptic' "settings" A_Lens env Settings
|
||||||
, LabelOptic' "dirs" A_Lens env Dirs
|
, LabelOptic' "dirs" A_Lens env Dirs
|
||||||
, LabelOptic' "keyBindings" A_Lens env KeyBindings
|
, LabelOptic' "keyBindings" A_Lens env KeyBindings
|
||||||
, LabelOptic' "loggerConfig" A_Lens env LoggerConfig
|
|
||||||
)
|
)
|
||||||
=> m LeanAppState
|
=> m LeanAppState
|
||||||
getLeanAppState = do
|
getLeanAppState = do
|
||||||
s <- gets @"settings"
|
s <- gets @"settings"
|
||||||
d <- gets @"dirs"
|
d <- gets @"dirs"
|
||||||
k <- gets @"keyBindings"
|
k <- gets @"keyBindings"
|
||||||
l <- gets @"loggerConfig"
|
pure (LeanAppState s d k)
|
||||||
pure (LeanAppState s d k l)
|
|
||||||
|
|
||||||
|
|
||||||
getSettings :: ( MonadReader env m
|
getSettings :: ( MonadReader env m
|
||||||
@@ -117,87 +110,6 @@ getDirs :: ( MonadReader env m
|
|||||||
getDirs = gets @"dirs"
|
getDirs = gets @"dirs"
|
||||||
|
|
||||||
|
|
||||||
logInfo :: ( MonadReader env m
|
|
||||||
, LabelOptic' "loggerConfig" A_Lens env LoggerConfig
|
|
||||||
, MonadIO m
|
|
||||||
)
|
|
||||||
=> Text
|
|
||||||
-> m ()
|
|
||||||
logInfo = logInternal Info
|
|
||||||
|
|
||||||
logWarn :: ( MonadReader env m
|
|
||||||
, LabelOptic' "loggerConfig" A_Lens env LoggerConfig
|
|
||||||
, MonadIO m
|
|
||||||
)
|
|
||||||
=> Text
|
|
||||||
-> m ()
|
|
||||||
logWarn = logInternal Warn
|
|
||||||
|
|
||||||
logDebug :: ( MonadReader env m
|
|
||||||
, LabelOptic' "loggerConfig" A_Lens env LoggerConfig
|
|
||||||
, MonadIO m
|
|
||||||
)
|
|
||||||
=> Text
|
|
||||||
-> m ()
|
|
||||||
logDebug = logInternal Debug
|
|
||||||
|
|
||||||
logError :: ( MonadReader env m
|
|
||||||
, LabelOptic' "loggerConfig" A_Lens env LoggerConfig
|
|
||||||
, MonadIO m
|
|
||||||
)
|
|
||||||
=> Text
|
|
||||||
-> m ()
|
|
||||||
logError = logInternal Error
|
|
||||||
|
|
||||||
|
|
||||||
logInternal :: ( MonadReader env m
|
|
||||||
, LabelOptic' "loggerConfig" A_Lens env LoggerConfig
|
|
||||||
, MonadIO m
|
|
||||||
) => LogLevel
|
|
||||||
-> Text
|
|
||||||
-> m ()
|
|
||||||
logInternal logLevel msg = do
|
|
||||||
LoggerConfig {..} <- gets @"loggerConfig"
|
|
||||||
let style' = case logLevel of
|
|
||||||
Debug -> style Bold . color Blue
|
|
||||||
Info -> style Bold . color Green
|
|
||||||
Warn -> style Bold . color Yellow
|
|
||||||
Error -> style Bold . color Red
|
|
||||||
let l = case logLevel of
|
|
||||||
Debug -> style' "[ Debug ]"
|
|
||||||
Info -> style' "[ Info ]"
|
|
||||||
Warn -> style' "[ Warn ]"
|
|
||||||
Error -> style' "[ Error ]"
|
|
||||||
let strs = T.split (== '\n') msg
|
|
||||||
let out = case strs of
|
|
||||||
[] -> T.empty
|
|
||||||
(x:xs) ->
|
|
||||||
foldr (\a b -> a <> "\n" <> b) mempty
|
|
||||||
. ((l <> " " <> x) :)
|
|
||||||
. fmap (\line' -> style' "[ ... ] " <> line' )
|
|
||||||
$ xs
|
|
||||||
|
|
||||||
when (lcPrintDebug || (not lcPrintDebug && (logLevel /= Debug)))
|
|
||||||
$ liftIO $ colorOutter out
|
|
||||||
|
|
||||||
-- raw output
|
|
||||||
let lr = case logLevel of
|
|
||||||
Debug -> "Debug:"
|
|
||||||
Info -> "Info:"
|
|
||||||
Warn -> "Warn:"
|
|
||||||
Error -> "Error:"
|
|
||||||
let outr = lr <> " " <> msg <> "\n"
|
|
||||||
liftIO $ rawOutter outr
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
getLogCleanup :: ( MonadReader env m
|
|
||||||
, LabelOptic' "logCleanup" A_Lens env (IO ())
|
|
||||||
)
|
|
||||||
=> m (IO ())
|
|
||||||
getLogCleanup = gets @"logCleanup"
|
|
||||||
|
|
||||||
|
|
||||||
getKeyBindings :: ( MonadReader env m
|
getKeyBindings :: ( MonadReader env m
|
||||||
, LabelOptic' "keyBindings" A_Lens env KeyBindings
|
, LabelOptic' "keyBindings" A_Lens env KeyBindings
|
||||||
)
|
)
|
||||||
@@ -224,7 +136,6 @@ type HasDirs env = (LabelOptic' "dirs" A_Lens env Dirs)
|
|||||||
type HasKeyBindings env = (LabelOptic' "keyBindings" A_Lens env KeyBindings)
|
type HasKeyBindings env = (LabelOptic' "keyBindings" A_Lens env KeyBindings)
|
||||||
type HasGHCupInfo env = (LabelOptic' "ghcupInfo" A_Lens env GHCupInfo)
|
type HasGHCupInfo env = (LabelOptic' "ghcupInfo" A_Lens env GHCupInfo)
|
||||||
type HasPlatformReq env = (LabelOptic' "pfreq" A_Lens env PlatformRequest)
|
type HasPlatformReq env = (LabelOptic' "pfreq" A_Lens env PlatformRequest)
|
||||||
type HasLog env = (LabelOptic' "loggerConfig" A_Lens env LoggerConfig)
|
|
||||||
|
|
||||||
|
|
||||||
getCache :: (MonadReader env m, HasSettings env) => m Bool
|
getCache :: (MonadReader env m, HasSettings env) => m Bool
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ import Control.Monad
|
|||||||
#if !MIN_VERSION_base(4,13,0)
|
#if !MIN_VERSION_base(4,13,0)
|
||||||
import Control.Monad.Fail ( MonadFail )
|
import Control.Monad.Fail ( MonadFail )
|
||||||
#endif
|
#endif
|
||||||
|
import Control.Monad.Logger
|
||||||
import Control.Monad.Reader
|
import Control.Monad.Reader
|
||||||
import Control.Monad.Trans.Resource
|
import Control.Monad.Trans.Resource
|
||||||
hiding ( throwM )
|
hiding ( throwM )
|
||||||
@@ -57,6 +58,7 @@ import Data.ByteString ( ByteString )
|
|||||||
import Data.Either
|
import Data.Either
|
||||||
import Data.Foldable
|
import Data.Foldable
|
||||||
import Data.List
|
import Data.List
|
||||||
|
import Data.List.Extra
|
||||||
import Data.List.NonEmpty ( NonEmpty( (:|) ))
|
import Data.List.NonEmpty ( NonEmpty( (:|) ))
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import Data.Text ( Text )
|
import Data.Text ( Text )
|
||||||
@@ -112,7 +114,7 @@ ghcLinkDestination tool ver = do
|
|||||||
rmMinorSymlinks :: ( MonadReader env m
|
rmMinorSymlinks :: ( MonadReader env m
|
||||||
, HasDirs env
|
, HasDirs env
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
, MonadFail m
|
, MonadFail m
|
||||||
, MonadMask m
|
, MonadMask m
|
||||||
@@ -126,14 +128,14 @@ rmMinorSymlinks tv@GHCTargetVersion{..} = do
|
|||||||
forM_ files $ \f -> do
|
forM_ files $ \f -> do
|
||||||
let f_xyz = f <> "-" <> T.unpack (prettyVer _tvVersion) <> exeExt
|
let f_xyz = f <> "-" <> T.unpack (prettyVer _tvVersion) <> exeExt
|
||||||
let fullF = binDir </> f_xyz
|
let fullF = binDir </> f_xyz
|
||||||
lift $ logDebug ("rm -f " <> T.pack fullF)
|
lift $ $(logDebug) ("rm -f " <> T.pack fullF)
|
||||||
lift $ hideError doesNotExistErrorType $ rmLink fullF
|
lift $ hideError doesNotExistErrorType $ rmLink fullF
|
||||||
|
|
||||||
|
|
||||||
-- | Removes the set ghc version for the given target, if any.
|
-- | Removes the set ghc version for the given target, if any.
|
||||||
rmPlain :: ( MonadReader env m
|
rmPlain :: ( MonadReader env m
|
||||||
, HasDirs env
|
, HasDirs env
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
, MonadFail m
|
, MonadFail m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
@@ -148,11 +150,11 @@ rmPlain target = do
|
|||||||
files <- liftE $ ghcToolFiles tv
|
files <- liftE $ ghcToolFiles tv
|
||||||
forM_ files $ \f -> do
|
forM_ files $ \f -> do
|
||||||
let fullF = binDir </> f <> exeExt
|
let fullF = binDir </> f <> exeExt
|
||||||
lift $ logDebug ("rm -f " <> T.pack fullF)
|
lift $ $(logDebug) ("rm -f " <> T.pack fullF)
|
||||||
lift $ hideError doesNotExistErrorType $ rmLink fullF
|
lift $ hideError doesNotExistErrorType $ rmLink fullF
|
||||||
-- old ghcup
|
-- old ghcup
|
||||||
let hdc_file = binDir </> "haddock-ghc" <> exeExt
|
let hdc_file = binDir </> "haddock-ghc" <> exeExt
|
||||||
lift $ logDebug ("rm -f " <> T.pack hdc_file)
|
lift $ $(logDebug) ("rm -f " <> T.pack hdc_file)
|
||||||
lift $ hideError doesNotExistErrorType $ rmLink hdc_file
|
lift $ hideError doesNotExistErrorType $ rmLink hdc_file
|
||||||
|
|
||||||
|
|
||||||
@@ -160,7 +162,7 @@ rmPlain target = do
|
|||||||
rmMajorSymlinks :: ( MonadReader env m
|
rmMajorSymlinks :: ( MonadReader env m
|
||||||
, HasDirs env
|
, HasDirs env
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
, MonadFail m
|
, MonadFail m
|
||||||
, MonadMask m
|
, MonadMask m
|
||||||
@@ -176,7 +178,7 @@ rmMajorSymlinks tv@GHCTargetVersion{..} = do
|
|||||||
forM_ files $ \f -> do
|
forM_ files $ \f -> do
|
||||||
let f_xy = f <> "-" <> T.unpack v' <> exeExt
|
let f_xy = f <> "-" <> T.unpack v' <> exeExt
|
||||||
let fullF = binDir </> f_xy
|
let fullF = binDir </> f_xy
|
||||||
lift $ logDebug "rm -f #{fullF}"
|
lift $ $(logDebug) "rm -f #{fullF}"
|
||||||
lift $ hideError doesNotExistErrorType $ rmLink fullF
|
lift $ hideError doesNotExistErrorType $ rmLink fullF
|
||||||
|
|
||||||
|
|
||||||
@@ -248,9 +250,9 @@ getInstalledGHCs = do
|
|||||||
|
|
||||||
|
|
||||||
-- | Get all installed cabals, by matching on @~\/.ghcup\/bin/cabal-*@.
|
-- | Get all installed cabals, by matching on @~\/.ghcup\/bin/cabal-*@.
|
||||||
getInstalledCabals :: ( MonadReader env m
|
getInstalledCabals :: ( MonadLogger m
|
||||||
|
, MonadReader env m
|
||||||
, HasDirs env
|
, HasDirs env
|
||||||
, HasLog env
|
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, MonadCatch m
|
, MonadCatch m
|
||||||
)
|
)
|
||||||
@@ -268,14 +270,14 @@ getInstalledCabals = do
|
|||||||
|
|
||||||
|
|
||||||
-- | Whether the given cabal version is installed.
|
-- | Whether the given cabal version is installed.
|
||||||
cabalInstalled :: (HasLog env, MonadIO m, MonadReader env m, HasDirs env, MonadCatch m) => Version -> m Bool
|
cabalInstalled :: (MonadLogger m, MonadIO m, MonadReader env m, HasDirs env, MonadCatch m) => Version -> m Bool
|
||||||
cabalInstalled ver = do
|
cabalInstalled ver = do
|
||||||
vers <- fmap rights getInstalledCabals
|
vers <- fmap rights getInstalledCabals
|
||||||
pure $ elem ver vers
|
pure $ elem ver vers
|
||||||
|
|
||||||
|
|
||||||
-- Return the currently set cabal version, if any.
|
-- Return the currently set cabal version, if any.
|
||||||
cabalSet :: (HasLog env, MonadReader env m, HasDirs env, MonadIO m, MonadThrow m, MonadCatch m) => m (Maybe Version)
|
cabalSet :: (MonadLogger m, MonadReader env m, HasDirs env, MonadIO m, MonadThrow m, MonadCatch m) => m (Maybe Version)
|
||||||
cabalSet = do
|
cabalSet = do
|
||||||
Dirs {..} <- getDirs
|
Dirs {..} <- getDirs
|
||||||
let cabalbin = binDir </> "cabal" <> exeExt
|
let cabalbin = binDir </> "cabal" <> exeExt
|
||||||
@@ -292,7 +294,7 @@ cabalSet = do
|
|||||||
case linkVersion =<< link of
|
case linkVersion =<< link of
|
||||||
Right v -> pure $ Just v
|
Right v -> pure $ Just v
|
||||||
Left err -> do
|
Left err -> do
|
||||||
logWarn $ "Failed to parse cabal symlink target with: "
|
$(logWarn) $ "Failed to parse cabal symlink target with: "
|
||||||
<> T.pack (displayException err)
|
<> T.pack (displayException err)
|
||||||
<> ". The symlink "
|
<> ". The symlink "
|
||||||
<> T.pack cabalbin
|
<> T.pack cabalbin
|
||||||
@@ -363,7 +365,7 @@ getInstalledStacks = do
|
|||||||
|
|
||||||
-- Return the currently set stack version, if any.
|
-- Return the currently set stack version, if any.
|
||||||
-- TODO: there's a lot of code duplication here :>
|
-- TODO: there's a lot of code duplication here :>
|
||||||
stackSet :: (MonadReader env m, HasDirs env, MonadIO m, MonadThrow m, MonadCatch m, HasLog env) => m (Maybe Version)
|
stackSet :: (MonadReader env m, HasDirs env, MonadIO m, MonadThrow m, MonadCatch m, MonadLogger m) => m (Maybe Version)
|
||||||
stackSet = do
|
stackSet = do
|
||||||
Dirs {..} <- getDirs
|
Dirs {..} <- getDirs
|
||||||
let stackBin = binDir </> "stack" <> exeExt
|
let stackBin = binDir </> "stack" <> exeExt
|
||||||
@@ -380,7 +382,7 @@ stackSet = do
|
|||||||
case linkVersion =<< link of
|
case linkVersion =<< link of
|
||||||
Right v -> pure $ Just v
|
Right v -> pure $ Just v
|
||||||
Left err -> do
|
Left err -> do
|
||||||
logWarn $ "Failed to parse stack symlink target with: "
|
$(logWarn) $ "Failed to parse stack symlink target with: "
|
||||||
<> T.pack (displayException err)
|
<> T.pack (displayException err)
|
||||||
<> ". The symlink "
|
<> ". The symlink "
|
||||||
<> T.pack stackBin
|
<> T.pack stackBin
|
||||||
@@ -598,7 +600,7 @@ getLatestGHCFor major' minor' dls =
|
|||||||
|
|
||||||
|
|
||||||
-- | Unpack an archive to a temporary directory and return that path.
|
-- | Unpack an archive to a temporary directory and return that path.
|
||||||
unpackToDir :: (MonadReader env m, HasLog env, MonadIO m, MonadThrow m)
|
unpackToDir :: (MonadLogger m, MonadIO m, MonadThrow m)
|
||||||
=> FilePath -- ^ destination dir
|
=> FilePath -- ^ destination dir
|
||||||
-> FilePath -- ^ archive path
|
-> FilePath -- ^ archive path
|
||||||
-> Excepts '[UnknownArchive
|
-> Excepts '[UnknownArchive
|
||||||
@@ -606,7 +608,7 @@ unpackToDir :: (MonadReader env m, HasLog env, MonadIO m, MonadThrow m)
|
|||||||
] m ()
|
] m ()
|
||||||
unpackToDir dfp av = do
|
unpackToDir dfp av = do
|
||||||
let fn = takeFileName av
|
let fn = takeFileName av
|
||||||
lift $ logInfo $ "Unpacking: " <> T.pack fn <> " to " <> T.pack dfp
|
lift $ $(logInfo) $ "Unpacking: " <> T.pack fn <> " to " <> T.pack dfp
|
||||||
|
|
||||||
let untar :: MonadIO m => BL.ByteString -> Excepts '[ArchiveResult] m ()
|
let untar :: MonadIO m => BL.ByteString -> Excepts '[ArchiveResult] m ()
|
||||||
untar = lEM . liftIO . runArchiveM . unpackToDirLazy dfp
|
untar = lEM . liftIO . runArchiveM . unpackToDirLazy dfp
|
||||||
@@ -629,7 +631,7 @@ unpackToDir dfp av = do
|
|||||||
| otherwise -> throwE $ UnknownArchive fn
|
| otherwise -> throwE $ UnknownArchive fn
|
||||||
|
|
||||||
|
|
||||||
getArchiveFiles :: (MonadReader env m, HasLog env, MonadIO m, MonadThrow m)
|
getArchiveFiles :: (MonadLogger m, MonadIO m, MonadThrow m)
|
||||||
=> FilePath -- ^ archive path
|
=> FilePath -- ^ archive path
|
||||||
-> Excepts '[UnknownArchive
|
-> Excepts '[UnknownArchive
|
||||||
, ArchiveResult
|
, ArchiveResult
|
||||||
@@ -658,7 +660,7 @@ getArchiveFiles av = do
|
|||||||
| otherwise -> throwE $ UnknownArchive fn
|
| otherwise -> throwE $ UnknownArchive fn
|
||||||
|
|
||||||
|
|
||||||
intoSubdir :: (MonadReader env m, HasLog env, MonadIO m, MonadThrow m, MonadCatch m)
|
intoSubdir :: (MonadLogger m, MonadIO m, MonadThrow m, MonadCatch m)
|
||||||
=> FilePath -- ^ unpacked tar dir
|
=> FilePath -- ^ unpacked tar dir
|
||||||
-> TarDir -- ^ how to descend
|
-> TarDir -- ^ how to descend
|
||||||
-> Excepts '[TarDirDoesNotExist] m FilePath
|
-> Excepts '[TarDirDoesNotExist] m FilePath
|
||||||
@@ -786,14 +788,14 @@ makeOut args workdir = do
|
|||||||
|
|
||||||
-- | Try to apply patches in order. Fails with 'PatchFailed'
|
-- | Try to apply patches in order. Fails with 'PatchFailed'
|
||||||
-- on first failure.
|
-- on first failure.
|
||||||
applyPatches :: (MonadReader env m, HasDirs env, HasLog env, MonadIO m)
|
applyPatches :: (MonadReader env m, HasDirs env, MonadLogger m, MonadIO m)
|
||||||
=> FilePath -- ^ dir containing patches
|
=> FilePath -- ^ dir containing patches
|
||||||
-> FilePath -- ^ dir to apply patches in
|
-> FilePath -- ^ dir to apply patches in
|
||||||
-> Excepts '[PatchFailed] m ()
|
-> Excepts '[PatchFailed] m ()
|
||||||
applyPatches pdir ddir = do
|
applyPatches pdir ddir = do
|
||||||
patches <- (fmap . fmap) (pdir </>) $ liftIO $ listDirectory pdir
|
patches <- (fmap . fmap) (pdir </>) $ liftIO $ listDirectory pdir
|
||||||
forM_ (sort patches) $ \patch' -> do
|
forM_ (sort patches) $ \patch' -> do
|
||||||
lift $ logInfo $ "Applying patch " <> T.pack patch'
|
lift $ $(logInfo) $ "Applying patch " <> T.pack patch'
|
||||||
fmap (either (const Nothing) Just)
|
fmap (either (const Nothing) Just)
|
||||||
(exec
|
(exec
|
||||||
"patch"
|
"patch"
|
||||||
@@ -834,7 +836,7 @@ runBuildAction :: ( Pretty (V e)
|
|||||||
, HasSettings env
|
, HasSettings env
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, MonadMask m
|
, MonadMask m
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadUnliftIO m
|
, MonadUnliftIO m
|
||||||
)
|
)
|
||||||
=> FilePath -- ^ build directory (cleaned up depending on Settings)
|
=> FilePath -- ^ build directory (cleaned up depending on Settings)
|
||||||
@@ -862,9 +864,9 @@ runBuildAction bdir instdir action = do
|
|||||||
|
|
||||||
-- | Remove a build directory, ignoring if it doesn't exist and gracefully
|
-- | Remove a build directory, ignoring if it doesn't exist and gracefully
|
||||||
-- printing other errors without crashing.
|
-- printing other errors without crashing.
|
||||||
rmBDir :: (MonadReader env m, HasLog env, MonadUnliftIO m, MonadIO m) => FilePath -> m ()
|
rmBDir :: (MonadLogger m, MonadUnliftIO m, MonadIO m) => FilePath -> m ()
|
||||||
rmBDir dir = withRunInIO (\run -> run $
|
rmBDir dir = withRunInIO (\run -> run $
|
||||||
liftIO $ handleIO (\e -> run $ logWarn $
|
liftIO $ handleIO (\e -> run $ $(logWarn) $
|
||||||
"Couldn't remove build dir " <> T.pack dir <> ", error was: " <> T.pack (displayException e))
|
"Couldn't remove build dir " <> T.pack dir <> ", error was: " <> T.pack (displayException e))
|
||||||
$ hideError doesNotExistErrorType
|
$ hideError doesNotExistErrorType
|
||||||
$ rmPathForcibly dir)
|
$ rmPathForcibly dir)
|
||||||
@@ -977,7 +979,7 @@ rmLink = hideError doesNotExistErrorType . recycleFile
|
|||||||
-- On windows, this requires that 'ensureGlobalTools' was run beforehand.
|
-- On windows, this requires that 'ensureGlobalTools' was run beforehand.
|
||||||
createLink :: ( MonadMask m
|
createLink :: ( MonadMask m
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, MonadReader env m
|
, MonadReader env m
|
||||||
, HasDirs env
|
, HasDirs env
|
||||||
@@ -999,24 +1001,24 @@ createLink link exe = do
|
|||||||
fullLink = takeDirectory exe </> link
|
fullLink = takeDirectory exe </> link
|
||||||
shimContents = "path = " <> fullLink
|
shimContents = "path = " <> fullLink
|
||||||
|
|
||||||
logDebug $ "rm -f " <> T.pack exe
|
$(logDebug) $ "rm -f " <> T.pack exe
|
||||||
rmLink exe
|
rmLink exe
|
||||||
|
|
||||||
logDebug $ "ln -s " <> T.pack fullLink <> " " <> T.pack exe
|
$(logDebug) $ "ln -s " <> T.pack fullLink <> " " <> T.pack exe
|
||||||
liftIO $ copyFile shimGen exe
|
liftIO $ copyFile shimGen exe
|
||||||
liftIO $ writeFile shim shimContents
|
liftIO $ writeFile shim shimContents
|
||||||
#else
|
#else
|
||||||
logDebug $ "rm -f " <> T.pack exe
|
$(logDebug) $ "rm -f " <> T.pack exe
|
||||||
hideError doesNotExistErrorType $ recycleFile exe
|
hideError doesNotExistErrorType $ recycleFile exe
|
||||||
|
|
||||||
logDebug $ "ln -s " <> T.pack link <> " " <> T.pack exe
|
$(logDebug) $ "ln -s " <> T.pack link <> " " <> T.pack exe
|
||||||
liftIO $ createFileLink link exe
|
liftIO $ createFileLink link exe
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
ensureGlobalTools :: ( MonadMask m
|
ensureGlobalTools :: ( MonadMask m
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
, MonadReader env m
|
, MonadReader env m
|
||||||
, HasDirs env
|
, HasDirs env
|
||||||
@@ -1034,8 +1036,8 @@ ensureGlobalTools = do
|
|||||||
$ maybe (Left NoDownload) Right $ Map.lookup ShimGen gTools
|
$ maybe (Left NoDownload) Right $ Map.lookup ShimGen gTools
|
||||||
let dl = downloadCached' shimDownload (Just "gs.exe") Nothing
|
let dl = downloadCached' shimDownload (Just "gs.exe") Nothing
|
||||||
void $ (\(DigestError _ _) -> do
|
void $ (\(DigestError _ _) -> do
|
||||||
lift $ logWarn "Digest doesn't match, redownloading gs.exe..."
|
lift $ $(logWarn) "Digest doesn't match, redownloading gs.exe..."
|
||||||
lift $ logDebug "rm -f #{shimDownload}"
|
lift $ $(logDebug) "rm -f #{shimDownload}"
|
||||||
lift $ hideError doesNotExistErrorType $ recycleFile (cacheDir dirs </> "gs.exe")
|
lift $ hideError doesNotExistErrorType $ recycleFile (cacheDir dirs </> "gs.exe")
|
||||||
liftE @'[DigestError , DownloadFailed] $ dl
|
liftE @'[DigestError , DownloadFailed] $ dl
|
||||||
) `catchE` (liftE @'[DigestError , DownloadFailed] dl)
|
) `catchE` (liftE @'[DigestError , DownloadFailed] dl)
|
||||||
|
|||||||
@@ -2,7 +2,9 @@
|
|||||||
{-# LANGUAGE DataKinds #-}
|
{-# LANGUAGE DataKinds #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
{-# LANGUAGE FlexibleContexts #-}
|
{-# LANGUAGE FlexibleContexts #-}
|
||||||
|
{-# LANGUAGE QuasiQuotes #-}
|
||||||
{-# LANGUAGE ViewPatterns #-}
|
{-# LANGUAGE ViewPatterns #-}
|
||||||
|
{-# LANGUAGE TemplateHaskell #-}
|
||||||
|
|
||||||
{-|
|
{-|
|
||||||
Module : GHCup.Utils.Dirs
|
Module : GHCup.Utils.Dirs
|
||||||
@@ -43,6 +45,7 @@ import GHCup.Utils.Prelude
|
|||||||
import Control.Exception.Safe
|
import Control.Exception.Safe
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
import Control.Monad.IO.Unlift
|
import Control.Monad.IO.Unlift
|
||||||
|
import Control.Monad.Logger
|
||||||
import Control.Monad.Reader
|
import Control.Monad.Reader
|
||||||
import Control.Monad.Trans.Resource hiding (throwM)
|
import Control.Monad.Trans.Resource hiding (throwM)
|
||||||
import Data.Bifunctor
|
import Data.Bifunctor
|
||||||
@@ -58,7 +61,7 @@ import System.IO.Temp
|
|||||||
|
|
||||||
import qualified Data.ByteString as BS
|
import qualified Data.ByteString as BS
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
import qualified Data.YAML.Aeson as Y
|
import qualified Data.Yaml as Y
|
||||||
import qualified Text.Megaparsec as MP
|
import qualified Text.Megaparsec as MP
|
||||||
import Control.Concurrent (threadDelay)
|
import Control.Concurrent (threadDelay)
|
||||||
|
|
||||||
@@ -221,7 +224,7 @@ ghcupConfigFile = do
|
|||||||
contents <- liftIO $ handleIO' NoSuchThing (\_ -> pure Nothing) $ Just <$> BS.readFile filepath
|
contents <- liftIO $ handleIO' NoSuchThing (\_ -> pure Nothing) $ Just <$> BS.readFile filepath
|
||||||
case contents of
|
case contents of
|
||||||
Nothing -> pure defaultUserSettings
|
Nothing -> pure defaultUserSettings
|
||||||
Just contents' -> lE' JSONDecodeError . first snd . Y.decode1Strict $ contents'
|
Just contents' -> lE' JSONDecodeError . first show . Y.decodeEither' $ contents'
|
||||||
|
|
||||||
|
|
||||||
-------------------------
|
-------------------------
|
||||||
@@ -258,7 +261,7 @@ parseGHCupGHCDir (T.pack -> fp) =
|
|||||||
mkGhcupTmpDir :: ( MonadReader env m
|
mkGhcupTmpDir :: ( MonadReader env m
|
||||||
, HasDirs env
|
, HasDirs env
|
||||||
, MonadUnliftIO m
|
, MonadUnliftIO m
|
||||||
, HasLog env
|
, MonadLogger m
|
||||||
, MonadCatch m
|
, MonadCatch m
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
, MonadMask m
|
, MonadMask m
|
||||||
@@ -270,14 +273,14 @@ mkGhcupTmpDir = do
|
|||||||
let minSpace = 5000 -- a rough guess, aight?
|
let minSpace = 5000 -- a rough guess, aight?
|
||||||
space <- handleIO (\_ -> pure Nothing) $ fmap Just $ liftIO $ getAvailSpace tmpdir
|
space <- handleIO (\_ -> pure Nothing) $ fmap Just $ liftIO $ getAvailSpace tmpdir
|
||||||
when (maybe False (toBytes minSpace >) space) $ do
|
when (maybe False (toBytes minSpace >) space) $ do
|
||||||
logWarn ("Possibly insufficient disk space on "
|
$(logWarn) ("Possibly insufficient disk space on "
|
||||||
<> T.pack tmpdir
|
<> T.pack tmpdir
|
||||||
<> ". At least "
|
<> ". At least "
|
||||||
<> T.pack (show minSpace)
|
<> T.pack (show minSpace)
|
||||||
<> " MB are recommended, but only "
|
<> " MB are recommended, but only "
|
||||||
<> toMB (fromJust space)
|
<> toMB (fromJust space)
|
||||||
<> " are free. Consider freeing up disk space or setting TMPDIR env variable.")
|
<> " are free. Consider freeing up disk space or setting TMPDIR env variable.")
|
||||||
logWarn
|
$(logWarn)
|
||||||
"...waiting for 10 seconds before continuing anyway, you can still abort..."
|
"...waiting for 10 seconds before continuing anyway, you can still abort..."
|
||||||
liftIO $ threadDelay 10000000 -- give the user a sec to intervene
|
liftIO $ threadDelay 10000000 -- give the user a sec to intervene
|
||||||
|
|
||||||
@@ -292,9 +295,8 @@ mkGhcupTmpDir = do
|
|||||||
|
|
||||||
withGHCupTmpDir :: ( MonadReader env m
|
withGHCupTmpDir :: ( MonadReader env m
|
||||||
, HasDirs env
|
, HasDirs env
|
||||||
, HasLog env
|
|
||||||
, HasSettings env
|
|
||||||
, MonadUnliftIO m
|
, MonadUnliftIO m
|
||||||
|
, MonadLogger m
|
||||||
, MonadCatch m
|
, MonadCatch m
|
||||||
, MonadResource m
|
, MonadResource m
|
||||||
, MonadThrow m
|
, MonadThrow m
|
||||||
@@ -307,7 +309,7 @@ withGHCupTmpDir = snd <$> withRunInIO (\run ->
|
|||||||
(run mkGhcupTmpDir)
|
(run mkGhcupTmpDir)
|
||||||
(\fp ->
|
(\fp ->
|
||||||
handleIO (\e -> run
|
handleIO (\e -> run
|
||||||
$ logDebug ("Resource cleanup failed for " <> T.pack fp <> ", error was: " <> T.pack (displayException e)))
|
$ $(logDebug) ("Resource cleanup failed for " <> T.pack fp <> ", error was: " <> T.pack (displayException e)))
|
||||||
. rmPathForcibly
|
. rmPathForcibly
|
||||||
$ fp))
|
$ fp))
|
||||||
|
|
||||||
@@ -339,10 +341,9 @@ relativeSymlink p1 p2 =
|
|||||||
|
|
||||||
cleanupTrash :: ( MonadIO m
|
cleanupTrash :: ( MonadIO m
|
||||||
, MonadMask m
|
, MonadMask m
|
||||||
|
, MonadLogger m
|
||||||
, MonadReader env m
|
, MonadReader env m
|
||||||
, HasLog env
|
|
||||||
, HasDirs env
|
, HasDirs env
|
||||||
, HasSettings env
|
|
||||||
)
|
)
|
||||||
=> m ()
|
=> m ()
|
||||||
cleanupTrash = do
|
cleanupTrash = do
|
||||||
@@ -351,8 +352,8 @@ cleanupTrash = do
|
|||||||
if null contents
|
if null contents
|
||||||
then pure ()
|
then pure ()
|
||||||
else do
|
else do
|
||||||
logWarn ("Removing leftover files in " <> T.pack recycleDir)
|
$(logWarn) ("Removing leftover files in " <> T.pack recycleDir)
|
||||||
forM_ contents (\fp -> handleIO (\e ->
|
forM_ contents (\fp -> handleIO (\e ->
|
||||||
logDebug ("Resource cleanup failed for " <> T.pack fp <> ", error was: " <> T.pack (displayException e))
|
$(logDebug) ("Resource cleanup failed for " <> T.pack fp <> ", error was: " <> T.pack (displayException e))
|
||||||
) $ liftIO $ removePathForcibly (recycleDir </> fp))
|
) $ liftIO $ removePathForcibly (recycleDir </> fp))
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ module GHCup.Utils.File.Common where
|
|||||||
|
|
||||||
import GHCup.Utils.Prelude
|
import GHCup.Utils.Prelude
|
||||||
|
|
||||||
|
import Control.Monad.Extra
|
||||||
import Control.Monad.Reader
|
import Control.Monad.Reader
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import GHC.IO.Exception
|
import GHC.IO.Exception
|
||||||
@@ -101,6 +102,3 @@ findFiles path regex = do
|
|||||||
contents <- listDirectory path
|
contents <- listDirectory path
|
||||||
pure $ filter (match regex) contents
|
pure $ filter (match regex) contents
|
||||||
|
|
||||||
|
|
||||||
checkFileAlreadyExists :: (MonadIO m) => FilePath -> m Bool
|
|
||||||
checkFileAlreadyExists fp = liftIO $ doesFileExist fp
|
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
|
{-# LANGUAGE QuasiQuotes #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
{-# LANGUAGE FlexibleContexts #-}
|
{-# LANGUAGE FlexibleContexts #-}
|
||||||
|
{-# LANGUAGE TemplateHaskell #-}
|
||||||
|
{-# LANGUAGE ViewPatterns #-}
|
||||||
|
|
||||||
{-|
|
{-|
|
||||||
Module : GHCup.Utils.File.Posix
|
Module : GHCup.Utils.File.Posix
|
||||||
@@ -25,6 +28,7 @@ import Control.Concurrent.Async
|
|||||||
import Control.Exception ( evaluate )
|
import Control.Exception ( evaluate )
|
||||||
import Control.Exception.Safe
|
import Control.Exception.Safe
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
|
import Control.Monad.Logger
|
||||||
import Control.Monad.Reader
|
import Control.Monad.Reader
|
||||||
import Control.Monad.Trans.State.Strict
|
import Control.Monad.Trans.State.Strict
|
||||||
import Data.ByteString ( ByteString )
|
import Data.ByteString ( ByteString )
|
||||||
@@ -127,7 +131,7 @@ execLogged exe args chdir lfile env = do
|
|||||||
pure e
|
pure e
|
||||||
|
|
||||||
tee :: Fd -> Fd -> IO ()
|
tee :: Fd -> Fd -> IO ()
|
||||||
tee fileFd = readTilEOF lineAction
|
tee fileFd fdIn = readTilEOF lineAction fdIn
|
||||||
|
|
||||||
where
|
where
|
||||||
lineAction :: ByteString -> IO ()
|
lineAction :: ByteString -> IO ()
|
||||||
@@ -346,7 +350,7 @@ toProcessError exe args mps = case mps of
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
chmod_755 :: (MonadReader env m, HasLog env, MonadIO m) => FilePath -> m ()
|
chmod_755 :: (MonadLogger m, MonadIO m) => FilePath -> m ()
|
||||||
chmod_755 fp = do
|
chmod_755 fp = do
|
||||||
let exe_mode =
|
let exe_mode =
|
||||||
nullFileMode
|
nullFileMode
|
||||||
@@ -357,7 +361,7 @@ chmod_755 fp = do
|
|||||||
`unionFileModes` groupReadMode
|
`unionFileModes` groupReadMode
|
||||||
`unionFileModes` otherExecuteMode
|
`unionFileModes` otherExecuteMode
|
||||||
`unionFileModes` otherReadMode
|
`unionFileModes` otherReadMode
|
||||||
logDebug ("chmod 755 " <> T.pack fp)
|
$(logDebug) ("chmod 755 " <> T.pack fp)
|
||||||
liftIO $ setFileMode fp exe_mode
|
liftIO $ setFileMode fp exe_mode
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -22,8 +22,11 @@ import GHCup.Utils.String.QQ
|
|||||||
import Control.Exception.Safe
|
import Control.Exception.Safe
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
import Control.Monad.IO.Class
|
import Control.Monad.IO.Class
|
||||||
|
import Control.Monad.Logger
|
||||||
import Control.Monad.Reader
|
import Control.Monad.Reader
|
||||||
|
import Data.Char ( ord )
|
||||||
import Prelude hiding ( appendFile )
|
import Prelude hiding ( appendFile )
|
||||||
|
import System.Console.Pretty
|
||||||
import System.FilePath
|
import System.FilePath
|
||||||
import System.IO.Error
|
import System.IO.Error
|
||||||
import Text.Regex.Posix
|
import Text.Regex.Posix
|
||||||
@@ -32,6 +35,53 @@ import qualified Data.ByteString as B
|
|||||||
import GHCup.Utils.Prelude
|
import GHCup.Utils.Prelude
|
||||||
|
|
||||||
|
|
||||||
|
data LoggerConfig = LoggerConfig
|
||||||
|
{ lcPrintDebug :: Bool -- ^ whether to print debug in colorOutter
|
||||||
|
, colorOutter :: B.ByteString -> IO () -- ^ how to write the color output
|
||||||
|
, rawOutter :: B.ByteString -> IO () -- ^ how to write the full raw output
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
myLoggerT :: LoggerConfig -> LoggingT m a -> m a
|
||||||
|
myLoggerT LoggerConfig {..} loggingt = runLoggingT loggingt mylogger
|
||||||
|
where
|
||||||
|
mylogger :: Loc -> LogSource -> LogLevel -> LogStr -> IO ()
|
||||||
|
mylogger _ _ level str' = do
|
||||||
|
-- color output
|
||||||
|
let style' = case level of
|
||||||
|
LevelDebug -> style Bold . color Blue
|
||||||
|
LevelInfo -> style Bold . color Green
|
||||||
|
LevelWarn -> style Bold . color Yellow
|
||||||
|
LevelError -> style Bold . color Red
|
||||||
|
LevelOther _ -> id
|
||||||
|
let l = case level of
|
||||||
|
LevelDebug -> toLogStr (style' "[ Debug ]")
|
||||||
|
LevelInfo -> toLogStr (style' "[ Info ]")
|
||||||
|
LevelWarn -> toLogStr (style' "[ Warn ]")
|
||||||
|
LevelError -> toLogStr (style' "[ Error ]")
|
||||||
|
LevelOther t -> toLogStr "[ " <> toLogStr t <> toLogStr " ]"
|
||||||
|
let strs = fmap toLogStr . B.split (fromIntegral $ ord '\n') . fromLogStr $ str'
|
||||||
|
let out = case strs of
|
||||||
|
[] -> B.empty
|
||||||
|
(x:xs) -> fromLogStr
|
||||||
|
. foldr (\a b -> a <> toLogStr "\n" <> b) mempty
|
||||||
|
. ((l <> toLogStr " " <> x) :)
|
||||||
|
. fmap (\line' -> toLogStr (style' "[ ... ] ") <> line' )
|
||||||
|
$ xs
|
||||||
|
|
||||||
|
when (lcPrintDebug || (not lcPrintDebug && (level /= LevelDebug)))
|
||||||
|
$ colorOutter out
|
||||||
|
|
||||||
|
-- raw output
|
||||||
|
let lr = case level of
|
||||||
|
LevelDebug -> toLogStr "Debug:"
|
||||||
|
LevelInfo -> toLogStr "Info:"
|
||||||
|
LevelWarn -> toLogStr "Warn:"
|
||||||
|
LevelError -> toLogStr "Error:"
|
||||||
|
LevelOther t -> toLogStr t <> toLogStr ":"
|
||||||
|
let outr = fromLogStr (lr <> toLogStr " " <> str' <> toLogStr "\n")
|
||||||
|
rawOutter outr
|
||||||
|
|
||||||
|
|
||||||
initGHCupFileLogging :: ( MonadReader env m
|
initGHCupFileLogging :: ( MonadReader env m
|
||||||
, HasDirs env
|
, HasDirs env
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
{-# LANGUAGE ScopedTypeVariables #-}
|
{-# LANGUAGE ScopedTypeVariables #-}
|
||||||
{-# LANGUAGE TypeFamilies #-}
|
{-# LANGUAGE TypeFamilies #-}
|
||||||
{-# LANGUAGE TypeOperators #-}
|
{-# LANGUAGE TypeOperators #-}
|
||||||
|
{-# LANGUAGE TemplateHaskell #-}
|
||||||
|
|
||||||
{-|
|
{-|
|
||||||
Module : GHCup.Utils.Prelude
|
Module : GHCup.Utils.Prelude
|
||||||
@@ -29,10 +30,10 @@ import Control.Exception.Safe
|
|||||||
import Control.Monad
|
import Control.Monad
|
||||||
import Control.Monad.IO.Class
|
import Control.Monad.IO.Class
|
||||||
import Control.Monad.Reader
|
import Control.Monad.Reader
|
||||||
|
import Control.Monad.Logger
|
||||||
import Data.Bifunctor
|
import Data.Bifunctor
|
||||||
import Data.ByteString ( ByteString )
|
import Data.ByteString ( ByteString )
|
||||||
import Data.List ( nub, intercalate, stripPrefix, isPrefixOf )
|
import Data.List ( nub, intercalate )
|
||||||
import Data.Maybe
|
|
||||||
import Data.Foldable
|
import Data.Foldable
|
||||||
import Data.String
|
import Data.String
|
||||||
import Data.Text ( Text )
|
import Data.Text ( Text )
|
||||||
@@ -74,9 +75,8 @@ import qualified System.Win32.File as Win32
|
|||||||
-- >>> import Data.ByteString.Internal (c2w, w2c)
|
-- >>> import Data.ByteString.Internal (c2w, w2c)
|
||||||
-- >>> import Test.QuickCheck
|
-- >>> import Test.QuickCheck
|
||||||
-- >>> import Data.Word8
|
-- >>> import Data.Word8
|
||||||
|
-- >>> import Data.Word8
|
||||||
-- >>> import qualified Data.Text as T
|
-- >>> import qualified Data.Text as T
|
||||||
-- >>> import qualified Data.Char as C
|
|
||||||
-- >>> import Data.List
|
|
||||||
-- >>> instance Arbitrary T.Text where arbitrary = T.pack <$> arbitrary
|
-- >>> instance Arbitrary T.Text where arbitrary = T.pack <$> arbitrary
|
||||||
|
|
||||||
|
|
||||||
@@ -174,12 +174,8 @@ lEM' :: forall e' e es a m
|
|||||||
lEM' f em = lift em >>= lE . first f
|
lEM' f em = lift em >>= lE . first f
|
||||||
|
|
||||||
-- for some obscure reason... this won't type-check if we move it to a different module
|
-- for some obscure reason... this won't type-check if we move it to a different module
|
||||||
catchWarn :: forall es m env . ( Pretty (V es)
|
catchWarn :: forall es m . (Pretty (V es), MonadLogger m, Monad m) => Excepts es m () -> Excepts '[] m ()
|
||||||
, MonadReader env m
|
catchWarn = catchAllE @_ @es (\v -> lift $ $(logWarn) (T.pack . prettyShow $ v))
|
||||||
, HasLog env
|
|
||||||
, MonadIO m
|
|
||||||
, Monad m) => Excepts es m () -> Excepts '[] m ()
|
|
||||||
catchWarn = catchAllE @_ @es (\v -> lift $ logWarn (T.pack . prettyShow $ v))
|
|
||||||
|
|
||||||
fromEither :: Either a b -> VEither '[a] b
|
fromEither :: Either a b -> VEither '[a] b
|
||||||
fromEither = either (VLeft . V) VRight
|
fromEither = either (VLeft . V) VRight
|
||||||
@@ -524,7 +520,7 @@ forFold :: (Foldable t, Applicative m, Monoid b) => t a -> (a -> m b) -> m b
|
|||||||
forFold = \t -> (`traverseFold` t)
|
forFold = \t -> (`traverseFold` t)
|
||||||
|
|
||||||
|
|
||||||
-- | Strip @\\r@ and @\\n@ from 'String's
|
-- | Strip @\\r@ and @\\n@ from 'ByteString's
|
||||||
--
|
--
|
||||||
-- >>> stripNewline "foo\n\n\n"
|
-- >>> stripNewline "foo\n\n\n"
|
||||||
-- "foo"
|
-- "foo"
|
||||||
@@ -536,10 +532,13 @@ forFold = \t -> (`traverseFold` t)
|
|||||||
-- prop> \t -> stripNewline (t <> "\n") === stripNewline t
|
-- prop> \t -> stripNewline (t <> "\n") === stripNewline t
|
||||||
-- prop> \t -> not (any (isNewLine . c2w) t) ==> stripNewline t == t
|
-- prop> \t -> not (any (isNewLine . c2w) t) ==> stripNewline t == t
|
||||||
stripNewline :: String -> String
|
stripNewline :: String -> String
|
||||||
stripNewline = filter (`notElem` "\n\r")
|
stripNewline s
|
||||||
|
| null s = []
|
||||||
|
| head s `elem` "\n\r" = stripNewline (tail s)
|
||||||
|
| otherwise = head s : stripNewline (tail s)
|
||||||
|
|
||||||
|
|
||||||
-- | Strip @\\r@ and @\\n@ from 'Text's
|
-- | Strip @\\r@ and @\\n@ from 'ByteString's
|
||||||
--
|
--
|
||||||
-- >>> stripNewline' "foo\n\n\n"
|
-- >>> stripNewline' "foo\n\n\n"
|
||||||
-- "foo"
|
-- "foo"
|
||||||
@@ -551,7 +550,10 @@ stripNewline = filter (`notElem` "\n\r")
|
|||||||
-- prop> \t -> stripNewline' (t <> "\n") === stripNewline' t
|
-- prop> \t -> stripNewline' (t <> "\n") === stripNewline' t
|
||||||
-- prop> \t -> not (T.any (isNewLine . c2w) t) ==> stripNewline' t == t
|
-- prop> \t -> not (T.any (isNewLine . c2w) t) ==> stripNewline' t == t
|
||||||
stripNewline' :: T.Text -> T.Text
|
stripNewline' :: T.Text -> T.Text
|
||||||
stripNewline' = T.filter (`notElem` "\n\r")
|
stripNewline' s
|
||||||
|
| T.null s = mempty
|
||||||
|
| T.head s `elem` "\n\r" = stripNewline' (T.tail s)
|
||||||
|
| otherwise = T.singleton (T.head s) <> stripNewline' (T.tail s)
|
||||||
|
|
||||||
|
|
||||||
-- | Is the word8 a newline?
|
-- | Is the word8 a newline?
|
||||||
@@ -585,117 +587,3 @@ splitOnPVP c s = case Split.splitOn c s of
|
|||||||
| otherwise -> def
|
| otherwise -> def
|
||||||
where
|
where
|
||||||
def = (s, "")
|
def = (s, "")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- | Like 'find', but where the test can be monadic.
|
|
||||||
--
|
|
||||||
-- >>> findM (Just . C.isUpper) "teST"
|
|
||||||
-- Just (Just 'S')
|
|
||||||
-- >>> findM (Just . C.isUpper) "test"
|
|
||||||
-- Just Nothing
|
|
||||||
-- >>> findM (Just . const True) ["x",undefined]
|
|
||||||
-- Just (Just "x")
|
|
||||||
findM :: Monad m => (a -> m Bool) -> [a] -> m (Maybe a)
|
|
||||||
findM ~p = foldr (\x -> ifM (p x) (pure $ Just x)) (pure Nothing)
|
|
||||||
|
|
||||||
|
|
||||||
-- | Drops the given suffix from a list.
|
|
||||||
-- It returns the original sequence if the sequence doesn't end with the given suffix.
|
|
||||||
--
|
|
||||||
-- >>> dropSuffix "!" "Hello World!"
|
|
||||||
-- "Hello World"
|
|
||||||
-- >>> dropSuffix "!" "Hello World!!"
|
|
||||||
-- "Hello World!"
|
|
||||||
-- >>> dropSuffix "!" "Hello World."
|
|
||||||
-- "Hello World."
|
|
||||||
dropSuffix :: Eq a => [a] -> [a] -> [a]
|
|
||||||
dropSuffix a b = fromMaybe b $ stripSuffix a b
|
|
||||||
|
|
||||||
-- | Return the prefix of the second list if its suffix
|
|
||||||
-- matches the entire first list.
|
|
||||||
--
|
|
||||||
-- >>> stripSuffix "bar" "foobar"
|
|
||||||
-- Just "foo"
|
|
||||||
-- >>> stripSuffix "" "baz"
|
|
||||||
-- Just "baz"
|
|
||||||
-- >>> stripSuffix "foo" "quux"
|
|
||||||
-- Nothing
|
|
||||||
stripSuffix :: Eq a => [a] -> [a] -> Maybe [a]
|
|
||||||
stripSuffix a b = reverse <$> stripPrefix (reverse a) (reverse b)
|
|
||||||
|
|
||||||
|
|
||||||
-- | Drops the given prefix from a list.
|
|
||||||
-- It returns the original sequence if the sequence doesn't start with the given prefix.
|
|
||||||
--
|
|
||||||
-- >>> dropPrefix "Mr. " "Mr. Men"
|
|
||||||
-- "Men"
|
|
||||||
-- >>> dropPrefix "Mr. " "Dr. Men"
|
|
||||||
-- "Dr. Men"
|
|
||||||
dropPrefix :: Eq a => [a] -> [a] -> [a]
|
|
||||||
dropPrefix a b = fromMaybe b $ stripPrefix a b
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- | Break a list into pieces separated by the first
|
|
||||||
-- list argument, consuming the delimiter. An empty delimiter is
|
|
||||||
-- invalid, and will cause an error to be raised.
|
|
||||||
--
|
|
||||||
-- >>> splitOn "\r\n" "a\r\nb\r\nd\r\ne"
|
|
||||||
-- ["a","b","d","e"]
|
|
||||||
-- >>> splitOn "aaa" "aaaXaaaXaaaXaaa"
|
|
||||||
-- ["","X","X","X",""]
|
|
||||||
-- >>> splitOn "x" "x"
|
|
||||||
-- ["",""]
|
|
||||||
-- >>> splitOn "x" ""
|
|
||||||
-- [""]
|
|
||||||
--
|
|
||||||
-- prop> \s x -> s /= "" ==> intercalate s (splitOn s x) == x
|
|
||||||
-- prop> \c x -> splitOn [c] x == split (==c) x
|
|
||||||
splitOn :: Eq a => [a] -> [a] -> [[a]]
|
|
||||||
splitOn [] _ = error "splitOn, needle may not be empty"
|
|
||||||
splitOn _ [] = [[]]
|
|
||||||
splitOn needle haystack = a : if null b then [] else splitOn needle $ drop (length needle) b
|
|
||||||
where (a,b) = breakOn needle haystack
|
|
||||||
|
|
||||||
|
|
||||||
-- | Splits a list into components delimited by separators,
|
|
||||||
-- where the predicate returns True for a separator element. The
|
|
||||||
-- resulting components do not contain the separators. Two adjacent
|
|
||||||
-- separators result in an empty component in the output.
|
|
||||||
--
|
|
||||||
-- >>> split (== 'a') "aabbaca"
|
|
||||||
-- ["","","bb","c",""]
|
|
||||||
-- >>> split (== 'a') ""
|
|
||||||
-- [""]
|
|
||||||
-- >>> split (== ':') "::xyz:abc::123::"
|
|
||||||
-- ["","","xyz","abc","","123","",""]
|
|
||||||
-- >>> split (== ',') "my,list,here"
|
|
||||||
-- ["my","list","here"]
|
|
||||||
split :: (a -> Bool) -> [a] -> [[a]]
|
|
||||||
split _ [] = [[]]
|
|
||||||
split f (x:xs)
|
|
||||||
| f x = [] : split f xs
|
|
||||||
| y:ys <- split f xs = (x:y) : ys
|
|
||||||
| otherwise = [[]]
|
|
||||||
|
|
||||||
|
|
||||||
-- | Find the first instance of @needle@ in @haystack@.
|
|
||||||
-- The first element of the returned tuple
|
|
||||||
-- is the prefix of @haystack@ before @needle@ is matched. The second
|
|
||||||
-- is the remainder of @haystack@, starting with the match.
|
|
||||||
-- If you want the remainder /without/ the match, use 'stripInfix'.
|
|
||||||
--
|
|
||||||
-- >>> breakOn "::" "a::b::c"
|
|
||||||
-- ("a","::b::c")
|
|
||||||
-- >>> breakOn "/" "foobar"
|
|
||||||
-- ("foobar","")
|
|
||||||
--
|
|
||||||
-- prop> \needle haystack -> let (prefix,match) = breakOn needle haystack in prefix ++ match == haystack
|
|
||||||
breakOn :: Eq a => [a] -> [a] -> ([a], [a])
|
|
||||||
breakOn needle haystack | needle `isPrefixOf` haystack = ([], haystack)
|
|
||||||
breakOn _ [] = ([], [])
|
|
||||||
breakOn needle (x:xs) = first (x:) $ breakOn needle xs
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -44,14 +44,15 @@ import Language.Haskell.TH.Quote
|
|||||||
-- The pattern portion is undefined.
|
-- The pattern portion is undefined.
|
||||||
s :: QuasiQuoter
|
s :: QuasiQuoter
|
||||||
s = QuasiQuoter
|
s = QuasiQuoter
|
||||||
(\s' -> case all isAscii s' of
|
(\s' -> case and $ fmap isAscii s' of
|
||||||
True -> (\a -> [|fromString a|]) . trimLeadingNewline . removeCRs $ s'
|
True -> (\a -> [|fromString a|]) . trimLeadingNewline . removeCRs $ s'
|
||||||
False -> fail "Not ascii"
|
False -> fail "Not ascii"
|
||||||
)
|
)
|
||||||
(error "Cannot use s as a pattern")
|
(error "Cannot use q as a pattern")
|
||||||
(error "Cannot use s as a type")
|
(error "Cannot use q as a type")
|
||||||
(error "Cannot use s as a dec")
|
(error "Cannot use q as a dec")
|
||||||
where
|
where
|
||||||
removeCRs = filter (/= '\r')
|
removeCRs = filter (/= '\r')
|
||||||
trimLeadingNewline ('\n' : xs) = xs
|
trimLeadingNewline ('\n' : xs) = xs
|
||||||
trimLeadingNewline xs = xs
|
trimLeadingNewline xs = xs
|
||||||
|
|
||||||
|
|||||||
11
stack.yaml
11
stack.yaml
@@ -1,4 +1,4 @@
|
|||||||
resolver: lts-18.2
|
resolver: lts-18.7
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
- .
|
- .
|
||||||
@@ -6,9 +6,8 @@ packages:
|
|||||||
extra-deps:
|
extra-deps:
|
||||||
- git: https://github.com/bgamari/terminal-size
|
- git: https://github.com/bgamari/terminal-size
|
||||||
commit: 34ea816bd63f75f800eedac12c6908c6f3736036
|
commit: 34ea816bd63f75f800eedac12c6908c6f3736036
|
||||||
|
|
||||||
- git: https://github.com/hasufell/libarchive
|
- git: https://github.com/hasufell/libarchive
|
||||||
commit: 8587aab78dd515928024ecd82c8f215e06db85cd
|
commit: 024a7e8ab7b4d3848dc64dca1e70a04831eedc99
|
||||||
|
|
||||||
- brick-0.64@sha256:f03fa14607c22cf48af99e24c44f79a0fb073f7ec229f15e969fed9ff73c93f6,16530
|
- brick-0.64@sha256:f03fa14607c22cf48af99e24c44f79a0fb073f7ec229f15e969fed9ff73c93f6,16530
|
||||||
- IfElse-0.85@sha256:6939b94acc6a55f545f63a168a349dd2fbe4b9a7cca73bf60282db5cc6aa47d2,445
|
- IfElse-0.85@sha256:6939b94acc6a55f545f63a168a349dd2fbe4b9a7cca73bf60282db5cc6aa47d2,445
|
||||||
@@ -53,12 +52,6 @@ flags:
|
|||||||
regex-posix:
|
regex-posix:
|
||||||
_regex-posix-clib: true
|
_regex-posix-clib: true
|
||||||
|
|
||||||
aeson-pretty:
|
|
||||||
lib-only: true
|
|
||||||
|
|
||||||
cabal-plan:
|
|
||||||
exe: false
|
|
||||||
|
|
||||||
ghc-options:
|
ghc-options:
|
||||||
"$locals": -O2
|
"$locals": -O2
|
||||||
streamly: -O2 -fspec-constr-recursive=16 -fmax-worker-args=16
|
streamly: -O2 -fspec-constr-recursive=16 -fmax-worker-args=16
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ instance Arbitrary ByteString where
|
|||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
instance Arbitrary Scheme where
|
instance Arbitrary Scheme where
|
||||||
arbitrary = elements [ Scheme "http", Scheme "https" ]
|
arbitrary = oneof [ pure (Scheme "http"), pure (Scheme "https") ]
|
||||||
|
|
||||||
instance Arbitrary Host where
|
instance Arbitrary Host where
|
||||||
arbitrary = genericArbitrary
|
arbitrary = genericArbitrary
|
||||||
|
|||||||
Reference in New Issue
Block a user