update installGhcBindist
to take a "Maybe FilePath" to work with isolated installs
This commit is contained in:
parent
ba51cbad6f
commit
338f5f309d
23
lib/GHCup.hs
23
lib/GHCup.hs
@ -183,6 +183,7 @@ installGHCBindist :: ( MonadFail m
|
|||||||
)
|
)
|
||||||
=> DownloadInfo -- ^ where/how to download
|
=> DownloadInfo -- ^ where/how to download
|
||||||
-> Version -- ^ the version to install
|
-> Version -- ^ the version to install
|
||||||
|
-> Maybe FilePath -- ^ isolated filepath if user passed any
|
||||||
-> Excepts
|
-> Excepts
|
||||||
'[ AlreadyInstalled
|
'[ AlreadyInstalled
|
||||||
, BuildFailed
|
, BuildFailed
|
||||||
@ -198,9 +199,15 @@ installGHCBindist :: ( MonadFail m
|
|||||||
]
|
]
|
||||||
m
|
m
|
||||||
()
|
()
|
||||||
installGHCBindist dlinfo ver = do
|
installGHCBindist dlinfo ver isoFilepath = do
|
||||||
let tver = mkTVer ver
|
let tver = mkTVer ver
|
||||||
|
let isIsolatedInstall = isJust isoFilepath
|
||||||
|
|
||||||
|
|
||||||
lift $ $(logDebug) [i|Requested to install GHC with #{ver}|]
|
lift $ $(logDebug) [i|Requested to install GHC with #{ver}|]
|
||||||
|
|
||||||
|
-- we only care for already installed errors in regular (non-isolated) installs
|
||||||
|
when (not isIsolatedInstall) $
|
||||||
whenM (lift $ ghcInstalled tver) (throwE $ AlreadyInstalled GHC ver)
|
whenM (lift $ ghcInstalled tver) (throwE $ AlreadyInstalled GHC ver)
|
||||||
|
|
||||||
-- download (or use cached version)
|
-- download (or use cached version)
|
||||||
@ -209,11 +216,21 @@ installGHCBindist dlinfo ver = do
|
|||||||
-- prepare paths
|
-- prepare paths
|
||||||
ghcdir <- lift $ ghcupGHCDir tver
|
ghcdir <- lift $ ghcupGHCDir tver
|
||||||
|
|
||||||
toolchainSanityChecks
|
let isoDir = if isIsolatedInstall
|
||||||
|
then fromJust isoFilepath
|
||||||
|
else mempty :: FilePath
|
||||||
|
|
||||||
|
if isIsolatedInstall
|
||||||
|
then do
|
||||||
|
lift $ $(logInfo) [i|isolated installing GHC to #{isoDir}|]
|
||||||
|
liftE $ installPackedGHC dl (view dlSubdir dlinfo) isoDir ver
|
||||||
|
else do
|
||||||
|
toolchainSanityChecks
|
||||||
liftE $ installPackedGHC dl (view dlSubdir dlinfo) ghcdir ver
|
liftE $ installPackedGHC dl (view dlSubdir dlinfo) ghcdir ver
|
||||||
|
|
||||||
liftE $ postGHCInstall tver
|
-- make symlinks & stuff when regular install,
|
||||||
|
-- don't make any for isolated installs.
|
||||||
|
whenM (pure $ not isIsolatedInstall) (liftE $ postGHCInstall tver)
|
||||||
|
|
||||||
where
|
where
|
||||||
toolchainSanityChecks = do
|
toolchainSanityChecks = do
|
||||||
|
Loading…
Reference in New Issue
Block a user