Compare commits
11 Commits
cabal-inst
...
v0.1.10
| Author | SHA1 | Date | |
|---|---|---|---|
| 672ebf6426 | |||
| fd76fde23a | |||
| e24c9a3ffe | |||
| 2641d50c21 | |||
| 202f3ea3ba | |||
| 4f09e3ff7e | |||
| 1148219130 | |||
| 4b47800dfb | |||
| e2c4db9132 | |||
| 90af68b211 | |||
| 80603662b4 |
16
CHANGELOG.md
16
CHANGELOG.md
@@ -1,5 +1,21 @@
|
|||||||
# Revision history for ghcup
|
# Revision history for ghcup
|
||||||
|
|
||||||
|
## 0.1.10 -- yyyy-mm-dd
|
||||||
|
|
||||||
|
* Show stray Cabals (useful for pre-releases or compiled ones)
|
||||||
|
|
||||||
|
## 0.1.9 -- 2020-08-14
|
||||||
|
|
||||||
|
* Fix bug when uninstalling all cabal versions
|
||||||
|
* Fix bug when setting a non-installed ghc version as current default
|
||||||
|
* Use yaml instead of generated json for download info for ease of adding new GHC versions #44
|
||||||
|
* Allow pre-release versions of GHC/cabal
|
||||||
|
* Add XDG dirs support (set `GHCUP_USE_XDG_DIRS`) wrt #39
|
||||||
|
* Allow to specify regex for tarball subdir (e.g. `ghc-.*`)
|
||||||
|
* Allow installing arbitrary bindists more seamlessly:
|
||||||
|
- e.g. installing GHC HEAD: `ghcup -n install ghc -u '{"dlHash": "", "dlSubdir": { "RegexDir": "ghc-.*"}, "dlUri": "https://gitlab.haskell.org/api/v4/projects/1/jobs/artifacts/master/raw/ghc-x86_64-fedora27-linux.tar.xz?job=validate-x86_64-linux-fedora27" }' head`
|
||||||
|
* Avoid duplicate edits to .bashrc/.zshrc wrt #43
|
||||||
|
|
||||||
## 0.1.8 -- 2020-07-21
|
## 0.1.8 -- 2020-07-21
|
||||||
|
|
||||||
* Fix bug in logging thread dying on newlines
|
* Fix bug in logging thread dying on newlines
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ For distributions with non-standard locations of cross toolchain and
|
|||||||
libraries, this may need some tweaking of `build.mk` or configure args.
|
libraries, this may need some tweaking of `build.mk` or configure args.
|
||||||
See `ghcup compile ghc --help` for further information.
|
See `ghcup compile ghc --help` for further information.
|
||||||
|
|
||||||
### Cross support
|
### XDG support
|
||||||
|
|
||||||
To enable XDG style directories, set the environment variable `GHCUP_USE_XDG_DIRS` to anything.
|
To enable XDG style directories, set the environment variable `GHCUP_USE_XDG_DIRS` to anything.
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
# !!! if you use RegexDir, then the version must be bumped !!!
|
|
||||||
---
|
---
|
||||||
toolRequirements:
|
toolRequirements:
|
||||||
GHC:
|
GHC:
|
||||||
@@ -1295,8 +1294,31 @@ ghcupDownloads:
|
|||||||
unknown_versioning:
|
unknown_versioning:
|
||||||
dlUri: https://downloads.haskell.org/~cabal/cabal-install-3.2.0.0/cabal-install-3.2.0.0-i386-unknown-linux.tar.xz
|
dlUri: https://downloads.haskell.org/~cabal/cabal-install-3.2.0.0/cabal-install-3.2.0.0-i386-unknown-linux.tar.xz
|
||||||
dlHash: 2b3ac28549916de5f3379241797eaf60e84b6c001f2abbe73d9fadbbaf768e93
|
dlHash: 2b3ac28549916de5f3379241797eaf60e84b6c001f2abbe73d9fadbbaf768e93
|
||||||
|
3.4.0.0-rc1:
|
||||||
|
viTags:
|
||||||
|
- Prerelease
|
||||||
|
viArch:
|
||||||
|
A_64:
|
||||||
|
Linux_Ubuntu:
|
||||||
|
unknown_versioning: &cabal-3400rc1-trusty
|
||||||
|
dlUri: https://oleg.fi/cabal-install-3.4.0.0-rc1-bootstrapped/cabal-install-3.4.0.0-x86_64-trusty-linux-bootstrapped.tar.xz
|
||||||
|
dlHash: 553ce7e6ab6e375d4a1e437a76eaab0bb418983804d2da13da1f634707e1015a
|
||||||
|
Linux_Alpine:
|
||||||
|
unknown_versioning:
|
||||||
|
dlUri: https://oleg.fi/cabal-install-3.4.0.0-rc1-bootstrapped/cabal-install-3.4.0.0-x86_64-alpine-3.11.6-linux-bootstrapped.tar.xz
|
||||||
|
dlHash: 7e030563242036975b37be707e43d9ba53df6e41ccb68faf9bf879cbf41abb47
|
||||||
|
Linux_UnknownLinux:
|
||||||
|
unknown_versioning: *cabal-3400rc1-trusty
|
||||||
|
Darwin:
|
||||||
|
unknown_versioning:
|
||||||
|
dlUri: https://oleg.fi/cabal-install-3.4.0.0-rc1-bootstrapped/cabal-install-3.4.0.0-x86_64-sierra-darwin-bootstrapped.tar.xz
|
||||||
|
dlHash: 755d32757b91e00e535fc601208ecd11567dbc4d832ae3bf8ce24eaba795aa1d
|
||||||
|
FreeBSD:
|
||||||
|
unknown_versioning:
|
||||||
|
dlUri: https://oleg.fi/cabal-install-3.4.0.0-rc1-bootstrapped/cabal-install-3.4.0.0-amd64-unknown-freebsd-bootstrapped.tar.xz
|
||||||
|
dlHash: 8660f588366355ad4487f7a2e81f31ecb24e15d168d31e227d43d5618a2948d0
|
||||||
GHCup:
|
GHCup:
|
||||||
0.1.8:
|
0.1.9:
|
||||||
viTags:
|
viTags:
|
||||||
- Recommended
|
- Recommended
|
||||||
- Latest
|
- Latest
|
||||||
@@ -1306,22 +1328,22 @@ ghcupDownloads:
|
|||||||
A_64:
|
A_64:
|
||||||
Linux_UnknownLinux:
|
Linux_UnknownLinux:
|
||||||
unknown_versioning: &ghcup-64
|
unknown_versioning: &ghcup-64
|
||||||
dlUri: https://downloads.haskell.org/~ghcup/0.1.8/x86_64-linux-ghcup-0.1.8
|
dlUri: https://downloads.haskell.org/~ghcup/0.1.9/x86_64-linux-ghcup-0.1.9
|
||||||
dlHash: 7ffcd4c3de156e895b648c75a36c762be2a4932883f3cd598f7a483c97d4a8a9
|
dlHash: d779ada6156b08da21e40c5bf218ec21d1308d5a9e48f7b9533f56b5d063a41c
|
||||||
Darwin:
|
Darwin:
|
||||||
unknown_versioning:
|
unknown_versioning:
|
||||||
dlUri: https://downloads.haskell.org/~ghcup/0.1.8/x86_64-apple-darwin-ghcup-0.1.8
|
dlUri: https://downloads.haskell.org/~ghcup/0.1.9/x86_64-apple-darwin-ghcup-0.1.9
|
||||||
dlHash: b6efc25013a20734e93ad7ae4ecf319f19eeee2129d515d568ccf0003f26615f
|
dlHash: 58ad3bbdb9cbbc7599364c39013bd25394b2cc123645c91fea9dd10c1198d035
|
||||||
FreeBSD:
|
FreeBSD:
|
||||||
unknown_versioning:
|
unknown_versioning:
|
||||||
dlUri: https://downloads.haskell.org/~ghcup/0.1.8/x86_64-portbld-freebsd-ghcup-0.1.8
|
dlUri: https://downloads.haskell.org/~ghcup/0.1.9/x86_64-portbld-freebsd-ghcup-0.1.9
|
||||||
dlHash: 442cdfe1b4525a327d9566e6270f909f7deba21c16dd4c7912537cf67e6cd521
|
dlHash: 5fca520307d9d888b4536c394fafea590104a1f4fb5d5fb5a9f738ee7b473dd9
|
||||||
Linux_Alpine:
|
Linux_Alpine:
|
||||||
unknown_versioning: *ghcup-64
|
unknown_versioning: *ghcup-64
|
||||||
A_32:
|
A_32:
|
||||||
Linux_UnknownLinux:
|
Linux_UnknownLinux:
|
||||||
unknown_versioning: &ghcup-32
|
unknown_versioning: &ghcup-32
|
||||||
dlUri: https://downloads.haskell.org/~ghcup/0.1.8/i386-linux-ghcup-0.1.8
|
dlUri: https://downloads.haskell.org/~ghcup/0.1.9/i386-linux-ghcup-0.1.9
|
||||||
dlHash: 18ab162920cea662feae4b08f39d3879e9e416fde7b734afd8072c39d3c43cde
|
dlHash: ad7faf32665d19ced5dc636c0a0c1b14995c530fbd26ca88705a08498b572145
|
||||||
Linux_Alpine:
|
Linux_Alpine:
|
||||||
unknown_versioning: *ghcup-32
|
unknown_versioning: *ghcup-32
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
cabal-version: 3.0
|
cabal-version: 3.0
|
||||||
name: ghcup
|
name: ghcup
|
||||||
version: 0.1.8
|
version: 0.1.10
|
||||||
synopsis: ghc toolchain installer as an exe/library
|
synopsis: ghc toolchain installer as an exe/library
|
||||||
description:
|
description:
|
||||||
A rewrite of the shell script ghcup, for providing
|
A rewrite of the shell script ghcup, for providing
|
||||||
|
|||||||
88
lib/GHCup.hs
88
lib/GHCup.hs
@@ -346,6 +346,8 @@ setGHC ver sghc = do
|
|||||||
let verBS = verToBS (_tvVersion ver)
|
let verBS = verToBS (_tvVersion ver)
|
||||||
ghcdir <- lift $ ghcupGHCDir ver
|
ghcdir <- lift $ ghcupGHCDir ver
|
||||||
|
|
||||||
|
whenM (lift $ fmap not $ ghcInstalled ver) (throwE (NotInstalled GHC (ver ^. tvVersion % to prettyVer)))
|
||||||
|
|
||||||
-- symlink destination
|
-- symlink destination
|
||||||
Settings { dirs = Dirs {..} } <- lift ask
|
Settings { dirs = Dirs {..} } <- lift ask
|
||||||
liftIO $ hideError AlreadyExists $ createDirRecursive newDirPerms binDir
|
liftIO $ hideError AlreadyExists $ createDirRecursive newDirPerms binDir
|
||||||
@@ -504,6 +506,9 @@ listVersions av lt criteria pfreq = do
|
|||||||
GHC -> do
|
GHC -> do
|
||||||
slr <- strayGHCs avTools
|
slr <- strayGHCs avTools
|
||||||
pure $ (sort (slr ++ lr))
|
pure $ (sort (slr ++ lr))
|
||||||
|
Cabal -> do
|
||||||
|
slr <- strayCabals avTools
|
||||||
|
pure $ (sort (slr ++ lr))
|
||||||
_ -> pure lr
|
_ -> pure lr
|
||||||
Nothing -> do
|
Nothing -> do
|
||||||
ghcvers <- listVersions av (Just GHC) criteria pfreq
|
ghcvers <- listVersions av (Just GHC) criteria pfreq
|
||||||
@@ -552,6 +557,33 @@ listVersions av lt criteria pfreq = do
|
|||||||
[i|Could not parse version of stray directory #{toFilePath e}|]
|
[i|Could not parse version of stray directory #{toFilePath e}|]
|
||||||
pure Nothing
|
pure Nothing
|
||||||
|
|
||||||
|
strayCabals :: (MonadReader Settings m, MonadCatch m, MonadThrow m, MonadLogger m, MonadIO m)
|
||||||
|
=> Map.Map Version [Tag]
|
||||||
|
-> m [ListResult]
|
||||||
|
strayCabals avTools = do
|
||||||
|
cabals <- getInstalledCabals
|
||||||
|
fmap catMaybes $ forM cabals $ \case
|
||||||
|
Right ver ->
|
||||||
|
case Map.lookup ver avTools of
|
||||||
|
Just _ -> pure Nothing
|
||||||
|
Nothing -> do
|
||||||
|
lSet <- fmap (maybe False (== ver)) $ cabalSet
|
||||||
|
pure $ Just $ ListResult
|
||||||
|
{ lTool = Cabal
|
||||||
|
, lVer = ver
|
||||||
|
, lCross = Nothing
|
||||||
|
, lTag = []
|
||||||
|
, lInstalled = True
|
||||||
|
, lStray = maybe True (const False) (Map.lookup ver avTools)
|
||||||
|
, lNoBindist = False
|
||||||
|
, fromSrc = False -- actually, we don't know :>
|
||||||
|
, ..
|
||||||
|
}
|
||||||
|
Left e -> do
|
||||||
|
$(logWarn)
|
||||||
|
[i|Could not parse version of stray directory #{toFilePath e}|]
|
||||||
|
pure Nothing
|
||||||
|
|
||||||
-- NOTE: this are not cross ones, because no bindists
|
-- NOTE: this are not cross ones, because no bindists
|
||||||
toListResult :: (MonadReader Settings m, MonadIO m, MonadCatch m) => Tool -> (Version, [Tag]) -> m ListResult
|
toListResult :: (MonadReader Settings m, MonadIO m, MonadCatch m) => Tool -> (Version, [Tag]) -> m ListResult
|
||||||
toListResult t (v, tags) = case t of
|
toListResult t (v, tags) = case t of
|
||||||
@@ -617,43 +649,39 @@ rmGHCVer :: ( MonadReader Settings m
|
|||||||
-> Excepts '[NotInstalled] m ()
|
-> Excepts '[NotInstalled] m ()
|
||||||
rmGHCVer ver = do
|
rmGHCVer ver = do
|
||||||
isSetGHC <- lift $ fmap (maybe False (== ver)) $ ghcSet (_tvTarget ver)
|
isSetGHC <- lift $ fmap (maybe False (== ver)) $ ghcSet (_tvTarget ver)
|
||||||
dir <- lift $ ghcupGHCDir ver
|
|
||||||
let d' = toFilePath dir
|
|
||||||
exists <- liftIO $ doesDirectoryExist dir
|
|
||||||
|
|
||||||
|
whenM (lift $ fmap not $ ghcInstalled ver) (throwE (NotInstalled GHC (ver ^. tvVersion % to prettyVer)))
|
||||||
|
dir <- lift $ ghcupGHCDir ver
|
||||||
|
|
||||||
if exists
|
-- this isn't atomic, order matters
|
||||||
then do
|
when isSetGHC $ do
|
||||||
-- this isn't atomic, order matters
|
lift $ $(logInfo) [i|Removing ghc symlinks|]
|
||||||
when isSetGHC $ do
|
liftE $ rmPlain (_tvTarget ver)
|
||||||
lift $ $(logInfo) [i|Removing ghc symlinks|]
|
|
||||||
liftE $ rmPlain (_tvTarget ver)
|
|
||||||
|
|
||||||
lift $ $(logInfo) [i|Removing directory recursively: #{d'}|]
|
lift $ $(logInfo) [i|Removing directory recursively: #{toFilePath dir}|]
|
||||||
liftIO $ deleteDirRecursive dir
|
liftIO $ deleteDirRecursive dir
|
||||||
|
|
||||||
lift $ $(logInfo) [i|Removing ghc-x.y.z symlinks|]
|
lift $ $(logInfo) [i|Removing ghc-x.y.z symlinks|]
|
||||||
lift $ rmMinorSymlinks ver
|
lift $ rmMinorSymlinks ver
|
||||||
|
|
||||||
lift $ $(logInfo) [i|Removing/rewiring ghc-x.y symlinks|]
|
lift $ $(logInfo) [i|Removing/rewiring ghc-x.y symlinks|]
|
||||||
-- first remove
|
-- first remove
|
||||||
handle (\(_ :: ParseError) -> pure ()) $ lift $ rmMajorSymlinks ver
|
handle (\(_ :: ParseError) -> pure ()) $ lift $ rmMajorSymlinks ver
|
||||||
-- then fix them (e.g. with an earlier version)
|
-- then fix them (e.g. with an earlier version)
|
||||||
v' <-
|
v' <-
|
||||||
handle
|
handle
|
||||||
(\(e :: ParseError) -> lift $ $(logWarn) [i|#{e}|] >> pure Nothing)
|
(\(e :: ParseError) -> lift $ $(logWarn) [i|#{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))
|
||||||
>>= mapM_ (\v -> liftE $ setGHC v SetGHC_XY)
|
>>= mapM_ (\v -> liftE $ setGHC v SetGHC_XY)
|
||||||
|
|
||||||
Settings { dirs = Dirs {..} } <- lift ask
|
Settings { dirs = Dirs {..} } <- lift ask
|
||||||
|
|
||||||
liftIO
|
liftIO
|
||||||
$ hideError doesNotExistErrorType
|
$ hideError doesNotExistErrorType
|
||||||
$ deleteFile
|
$ deleteFile
|
||||||
$ (baseDir </> [rel|share|])
|
$ (baseDir </> [rel|share|])
|
||||||
else throwE (NotInstalled GHC (ver ^. tvVersion % to prettyVer))
|
|
||||||
|
|
||||||
|
|
||||||
-- | Delete a cabal version. Will try to fix the @cabal@ symlink
|
-- | Delete a cabal version. Will try to fix the @cabal@ symlink
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ ghcupURL = [uri|https://www.haskell.org/ghcup/data/ghcup-0.0.2.yaml|]
|
|||||||
|
|
||||||
-- | The current ghcup version.
|
-- | The current ghcup version.
|
||||||
ghcUpVer :: PVP
|
ghcUpVer :: PVP
|
||||||
ghcUpVer = [pver|0.1.8|]
|
ghcUpVer = [pver|0.1.10|]
|
||||||
|
|
||||||
-- | ghcup version as numeric string.
|
-- | ghcup version as numeric string.
|
||||||
numericVer :: String
|
numericVer :: String
|
||||||
|
|||||||
Reference in New Issue
Block a user