From 37ea18a0d8a1f344a842e71424301ad8ca7a4b24 Mon Sep 17 00:00:00 2001 From: Arjun Kathuria Date: Sun, 25 Jul 2021 13:38:32 +0530 Subject: [PATCH] updates usages of new installGHCBindist and related installGHCBin --- app/ghcup/BrickMain.hs | 2 +- app/ghcup/Main.hs | 38 ++++++++++++++++---------------------- lib/GHCup.hs | 5 +++-- 3 files changed, 20 insertions(+), 25 deletions(-) diff --git a/app/ghcup/BrickMain.hs b/app/ghcup/BrickMain.hs index c6a2e66..17acc9e 100644 --- a/app/ghcup/BrickMain.hs +++ b/app/ghcup/BrickMain.hs @@ -448,7 +448,7 @@ install' _ (_, ListResult {..}) = do case lTool of GHC -> do let vi = getVersionInfo lVer GHC dls - liftE $ installGHCBin lVer $> vi + liftE $ installGHCBin lVer Nothing $> vi Cabal -> do let vi = getVersionInfo lVer Cabal dls liftE $ installCabalBin lVer $> vi diff --git a/app/ghcup/Main.hs b/app/ghcup/Main.hs index 7e8e026..f43de0e 100644 --- a/app/ghcup/Main.hs +++ b/app/ghcup/Main.hs @@ -1631,28 +1631,22 @@ Report bugs at |] ----------------------- let installGHC InstallOptions{..} = - (case isolateDir of - Just isoDir -> runInstTool instPlatform $ do - (v, vi) <- liftE $ fromVersion instVer GHC - let ghcVersion = _tvVersion v - liftE $ installGHCBinIsolated isoDir ghcVersion - pure vi - Nothing -> - case instBindist of - Nothing -> runInstTool instPlatform $ do - (v, vi) <- liftE $ fromVersion instVer GHC - liftE $ installGHCBin (_tvVersion v) - when instSet $ void $ liftE $ setGHC v SetGHCOnly - pure vi - Just uri -> do - s' <- liftIO appState - runInstTool' s'{ settings = settings {noVerify = True}} instPlatform $ do - (v, vi) <- liftE $ fromVersion instVer GHC - liftE $ installGHCBindist - (DownloadInfo uri (Just $ RegexDir "ghc-.*") "") - (_tvVersion v) - when instSet $ void $ liftE $ setGHC v SetGHCOnly - pure vi + (case instBindist of + Nothing -> runInstTool instPlatform $ do + (v, vi) <- liftE $ fromVersion instVer GHC + liftE $ installGHCBin (_tvVersion v) isolateDir + when instSet $ void $ liftE $ setGHC v SetGHCOnly + pure vi + Just uri -> do + s' <- liftIO appState + runInstTool' s'{ settings = settings {noVerify = True}} instPlatform $ do + (v, vi) <- liftE $ fromVersion instVer GHC + liftE $ installGHCBindist + (DownloadInfo uri (Just $ RegexDir "ghc-.*") "") + (_tvVersion v) + isolateDir + when instSet $ void $ liftE $ setGHC v SetGHCOnly + pure vi ) >>= \case VRight vi -> do diff --git a/lib/GHCup.hs b/lib/GHCup.hs index 021e9a7..1344849 100644 --- a/lib/GHCup.hs +++ b/lib/GHCup.hs @@ -405,6 +405,7 @@ installGHCBin :: ( MonadFail m , MonadUnliftIO m ) => Version -- ^ the version to install + -> Maybe FilePath -- ^ isolated install filepath, if user passed any -> Excepts '[ AlreadyInstalled , BuildFailed @@ -420,9 +421,9 @@ installGHCBin :: ( MonadFail m ] m () -installGHCBin ver = do +installGHCBin ver isoFilepath = do dlinfo <- liftE $ getDownloadInfo GHC ver - installGHCBindist dlinfo ver + installGHCBindist dlinfo ver isoFilepath -- | Like 'installCabalBin', except takes the 'DownloadInfo' as