From 300cfd3ba6234c8e05c3344788c734befc4e7e9e Mon Sep 17 00:00:00 2001 From: Arjun Kathuria Date: Tue, 10 Aug 2021 20:14:46 +0530 Subject: [PATCH] implements isolated install sanity-checking for Cabal installs --- app/ghcup/BrickMain.hs | 1 + app/ghcup/Main.hs | 1 + lib/GHCup.hs | 5 ++++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/ghcup/BrickMain.hs b/app/ghcup/BrickMain.hs index e23724f..4e21adf 100644 --- a/app/ghcup/BrickMain.hs +++ b/app/ghcup/BrickMain.hs @@ -442,6 +442,7 @@ install' _ (_, ListResult {..}) = do , DownloadFailed , NoUpdate , TarDirDoesNotExist + , IsolatedDirNotEmpty ] run (do diff --git a/app/ghcup/Main.hs b/app/ghcup/Main.hs index aef3ed7..382ddc8 100644 --- a/app/ghcup/Main.hs +++ b/app/ghcup/Main.hs @@ -1478,6 +1478,7 @@ Report bugs at |] , TarDirDoesNotExist , NextVerNotFound , NoToolVersionSet + , IsolatedDirNotEmpty ] let runInstTool mInstPlatform action' = do diff --git a/lib/GHCup.hs b/lib/GHCup.hs index da07ff2..6874737 100644 --- a/lib/GHCup.hs +++ b/lib/GHCup.hs @@ -405,6 +405,7 @@ installCabalBindist :: ( MonadMask m #if !defined(TAR) , ArchiveResult #endif + , IsolatedDirNotEmpty ] m () @@ -425,7 +426,8 @@ installCabalBindist dlinfo ver isoFilepath = do ) (throwE $ AlreadyInstalled Cabal ver) - _ -> pure () -- check isn't required in isolated installs + Just isoDir -> + liftE $ isolatedInstallSanityCheck isoDir -- download (or use cached version) dl <- liftE $ downloadCached dlinfo Nothing @@ -498,6 +500,7 @@ installCabalBin :: ( MonadMask m #if !defined(TAR) , ArchiveResult #endif + , IsolatedDirNotEmpty ] m ()