packages feed

ghcup 0.2.6.2 → 0.2.7.0

raw patch · API changes only · 44 files changed · show whitespace changes · browse ghcup-0.2.7.0

+5159/−2604 lines, 44 filesdep +ansi-terminaldep ~brickdep ~megaparsec

Dependencies added: ansi-terminal

Dependency ranges changed: brick, megaparsec

API changes (from Hackage documentation)

No API comparison: Hackage has no documentation for ghcup-0.2.7.0.

Files

CHANGELOG.md view
@@ -1,10 +1,33 @@ # Version history for ghcup +## 0.2.7.0 -- 2026-12-04++### Bugfixes++* Fix installing custom HLS bindists wrt [#1387](https://codeberg.org/haskell/ghcup-hs/issues/1387)+* Fix errors not showing in CI logs wrt [#1376](https://codeberg.org/haskell/ghcup-hs/issues/1376)+* Fix too aggressive failure modes in `ghcup run` wrt [#1394](https://codeberg.org/haskell/ghcup-hs/issues/1394)+* Fix version detection from cli wrt [#1377](https://codeberg.org/haskell/ghcup-hs/issues/1377)+*  Fix 'ghcup whereis' wrt [#1411](https://codeberg.org/haskell/ghcup-hs/issues/1411)+* fix various info/log/error messages++### Security++* Require libarchive >= 3.0.6.0 wrt HSEC-2026-0014++### Improvements++* Add support for .zstd and single-file archives wrt [#1401](https://codeberg.org/haskell/ghcup-hs/issues/1401)+  - this is required for the upcoming buck2 support+* TUI: add scrollbar wrt [#1380](https://codeberg.org/haskell/ghcup-hs/pulls/1380)+* TUI: Make inner and outer lists wrappable wrt [#1379](https://codeberg.org/haskell/ghcup-hs/pulls/1379)+ ## 0.2.6.2 -- 2026-06-16  * Fix X.Y symlinks wrt [#1365](https://github.com/haskell/ghcup-hs/issues/1365)-* Provide a way to filter by target when invoking `ghcup list` [#1362](https://github.com/haskell/ghcup-hs/issues/1362)+  - you may want to run `ghcup fixup symlinks` if you are affected * Introduce `ghcup fixup` [#1369](https://github.com/haskell/ghcup-hs/issues/1369)+* Provide a way to filter by target when invoking `ghcup list` [#1362](https://github.com/haskell/ghcup-hs/issues/1362)  ## 0.2.6.1 -- 2026-06-13 
README.md view
@@ -12,8 +12,8 @@  ## Looking for something else? -* [the metadata YAML files](https://github.com/haskell/ghcup-metadata)-* [homepage and documentation](https://github.com/haskell/ghcup-www)-* [docker images](https://github.com/haskell/ghcup-docker)+* [the metadata YAML files](https://codeberg.org/haskell/ghcup-metadata)+* [homepage and documentation](https://codeberg.org/haskell/ghcup-www)+* [docker images](https://codeberg.org/haskell//ghcup-docker) * [github action](https://github.com/haskell/ghcup-setup) 
app/ghcup/Main.hs view
@@ -57,6 +57,7 @@ import System.Environment import System.Exit import System.FilePath                 ( (</>) )+import System.Console.ANSI             ( hSupportsANSI ) import System.IO                       hiding ( appendFile ) import System.IO.Unsafe                ( unsafeInterleaveIO ) import Text.PrettyPrint.HughesPJClass  ( prettyShow )@@ -100,7 +101,7 @@          pager = case maybe (fromMaybe (Types.pager defaultSettings) uPager) (`PagerConfig` Nothing) optPager of                    PagerConfig b Nothing -> PagerConfig b pagerCmd                    x                     -> x-         guessVersion = fromMaybe (fromMaybe (Types.guessVersion defaultSettings) uGuessVersion) optGuessVersion+         guessVersion = optGuessVersion <|> (uGuessVersion <|> Types.guessVersion defaultSettings)          buildWrapper = uBuildWrapper      in (Settings {..}, keyBindings) #if defined(INTERNAL_DOWNLOADER)@@ -212,9 +213,11 @@            -- logger interpreter           logfile <- runReaderT initGHCupFileLogging dirs+          ansi <- liftIO $ hSupportsANSI stderr           let loggerConfig = LoggerConfig                 { lcPrintDebugLvl = Just ((\(Verbosity i) -> i) . verbose $ settings)                 , consoleOutter = T.hPutStr stderr+                , consoleAnsi = ansi                 , fileOutter =                     case optCommand of                       Nuke -> \_ -> pure ()@@ -226,7 +229,7 @@                      Nothing -> (flip runReaderT loggerConfig . runE @'[NoCompatiblePlatform, NoCompatibleArch, DistroNotFound] . liftE $ platformRequest) >>= \case                                     VRight r -> pure r                                     VLeft e -> do-                                      runReaderT (logError $ T.pack $ prettyHFError e) loggerConfig+                                      runReaderT (logHFError e) loggerConfig                                       exitWith (ExitFailure 2)           let leanAppstate = LeanAppState settings dirs keybindings pfreq loggerConfig           let runLogger = flip runReaderT leanAppstate@@ -247,7 +250,7 @@                           VRight r -> pure r                           VLeft  e -> do                             runLogger-                              (logError $ T.pack $ prettyHFError e)+                              (logHFError e)                             exitWith (ExitFailure 2)                 let s' = AppState settings dirs keybindings ghcupInfo pfreq loggerConfig @@ -294,7 +297,7 @@                   VRight _ -> pure ()                   VLeft e -> do                     runLogger-                      (logError $ T.pack $ prettyHFError e)+                      (logHFError e)                     exitWith (ExitFailure 30)                  pure (s', updateCheckAction)
bench/BenchSetup.hs view
@@ -73,6 +73,7 @@         , consoleOutter  = mempty         , fileOutter    = mempty         , fancyColors = False+        , consoleAnsi = False         }   let pfreq = PlatformRequest A_64 Darwin Nothing   let settings = defaultSettings { urlSource = infos }
ghcup.cabal view
@@ -1,6 +1,6 @@ cabal-version:      2.4 name:               ghcup-version:            0.2.6.2+version:            0.2.7.0 license:            LGPL-3.0-only license-file:       LICENSE copyright:          Julian Ospald 2026@@ -138,6 +138,7 @@   build-depends:     , aeson                   >=1.4     , aeson-pretty           ^>=0.8.8+    , ansi-terminal          >=0.6.2     , async                  ^>=2.2.3     , attoparsec             ^>= 0.14     , base                    >=4.12 && <5@@ -148,7 +149,7 @@     , filepath                >=1.4.101.0     , indexed-traversable    ^>=0.1.4     , variant                ^>=1.0-    , megaparsec              >=8.0.0 && <9.8+    , megaparsec >=8.0.0 && <9.9     , mtl                    ^>=2.2 || ^>=2.3     , optics                 ^>=0.4     , optparse-applicative    >=0.15.1.0 && <0.20@@ -407,7 +408,7 @@   build-depends:     , ghcup     , ghcup-optparse-    , brick >=2.1 && <2.13+    , brick >=2.13 && < 2.14     , vty           ^>=6.0 || ^>=6.1 || ^>=6.2 || ^>=6.3 || ^>=6.4    if !flag(tui)@@ -479,7 +480,7 @@     , hspec                      >=2.7.10  && <2.12     , hspec-golden              ^>=0.2.2.0     , hspec-golden-aeson        ^>=0.9-    , megaparsec                 >=8.0.0    && <9.8+    , megaparsec >=8.0.0 && <9.9     , pretty                    ^>=1.1.3.6     , QuickCheck                ^>=2.14.1 || ^>=2.15     , quickcheck-arbitrary-adt  ^>=0.3.1.0
lib-opt/GHCup/OptParse/ChangeLog.hs view
@@ -135,7 +135,7 @@       VRight _ -> do         pure ExitSuccess       VLeft e -> do-        runLogger $ logError $ T.pack $ prettyHFError e+        runLogger $ logHFError e         pure $ ExitFailure 11  where   run action' = do
lib-opt/GHCup/OptParse/Common.hs view
@@ -293,6 +293,7 @@         , consoleOutter  = mempty         , fileOutter     = mempty         , fancyColors    = False+        , consoleAnsi    = False         }    mpFreq <- flip runReaderT loggerConfig . runE $ platformRequest@@ -322,6 +323,7 @@         , consoleOutter  = mempty         , fileOutter     = mempty         , fancyColors    = False+        , consoleAnsi    = False         }   mpFreq <- flip runReaderT loggerConfig . runE $ platformRequest   let settings = defaultSettings { noNetwork = True }
lib-opt/GHCup/OptParse/Compile.hs view
@@ -607,14 +607,16 @@                 pure ExitSuccess               VLeft err@(V (BuildFailed tmpdir _)) -> do                 case keepDirs settings of-                  Never -> runLogger $ logError $ T.pack $ prettyHFError err-                  _ -> runLogger (logError $ T.pack (prettyHFError err) <> "\n" <>+                  Never -> runLogger $ logHFError err+                  _ -> do+                    runLogger (logHFError err)+                    runLogger $ logError $                         "Check the logs at " <> T.pack (fromGHCupPath 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 9               VLeft e -> do-                runLogger $ logError $ T.pack $ prettyHFError e+                runLogger $ logHFError e                 pure $ ExitFailure 9     (CompileGHC GHCCompileOptions {..}) ->       runCompileGHC s' (do@@ -677,18 +679,20 @@                 pure $ ExitFailure 3               VLeft err@(V (BuildFailed tmpdir _)) -> do                 case keepDirs settings of-                  Never -> runLogger $ logError $ T.pack $ prettyHFError err-                  _ -> runLogger (logError $ T.pack (prettyHFError err) <> "\n" <>+                  Never -> runLogger $ logHFError err+                  _ -> do+                    runLogger $ logHFError err+                    runLogger $ logError $                         "Check the logs at " <> T.pack (fromGHCupPath 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 9               VLeft e -> do-                runLogger $ logError $ T.pack $ prettyHFError e+                runLogger $ logHFError e                 pure $ ExitFailure 9  where   runLogger = flip runReaderT leanAppstate-  guessMode = if guessVersion settings then GLaxWithInstalled else GStrict+  guessMode = if fromMaybe True (guessVersion settings) then GLaxWithInstalled else GStrict   runCompileGHC appstate' =     flip runReaderT appstate'                   . runResourceT
lib-opt/GHCup/OptParse/Config.hs view
@@ -256,7 +256,7 @@         runLogger $ logError $ "Error decoding config: " <> T.pack e         pure $ ExitFailure 65       VLeft e -> do-        runLogger (logError $ T.pack $ prettyHFError e)+        runLogger (logHFError e)         pure $ ExitFailure 65   (ResetConfig resetCommand) -> do     r <- runE @'[ParseError] $ do@@ -279,7 +279,7 @@     case r of       VRight _ -> pure ExitSuccess       VLeft e -> do-        runLogger (logError $ T.pack $ prettyHFError e)+        runLogger (logHFError e)         pure $ ExitFailure 65    AddReleaseChannel force new -> do@@ -295,7 +295,7 @@       VRight _ -> do         pure ExitSuccess       VLeft e -> do-        runLogger $ logError $ T.pack $ prettyHFError e+        runLogger $ logHFError e         pure $ ExitFailure 15   where
lib-opt/GHCup/OptParse/DebugInfo.hs view
@@ -128,7 +128,7 @@             liftIO up             pure ExitSuccess           (VLeft e, _) -> do-            runLogger $ logError $ T.pack $ prettyHFError e+            runLogger $ logHFError e             pure $ ExitFailure 8  where   runLogger = flip runReaderT leanAppstate
lib-opt/GHCup/OptParse/Fixup.hs view
@@ -29,7 +29,6 @@ import Options.Applicative.Pretty.Shim ( text ) import Control.Exception.Safe (MonadMask) -import qualified Data.Text                     as T   @@ -112,7 +111,7 @@               liftIO up               pure ExitSuccess             (VLeft e, _) -> do-              runLogger $ logError $ T.pack $ prettyHFError e+              runLogger $ logHFError e               pure $ ExitFailure 27  where   runLogger = flip runReaderT leanAppstate
lib-opt/GHCup/OptParse/GC.hs view
@@ -28,7 +28,6 @@ import           Prelude                 hiding ( appendFile ) import           System.Exit -import qualified Data.Text                     as T import Control.Exception.Safe (MonadMask)  @@ -133,7 +132,7 @@               liftIO up               pure ExitSuccess             (VLeft e, _) -> do-              runLogger $ logError $ T.pack $ prettyHFError e+              runLogger $ logHFError e               pure $ ExitFailure 27  where   run action' = do
lib-opt/GHCup/OptParse/Generate.hs view
@@ -163,7 +163,7 @@             VRight _ -> do               pure ExitSuccess             VLeft e -> do-              runLogger $ logError $ T.pack $ prettyHFError e+              runLogger $ logHFError e               pure $ ExitFailure 27  where   getInput ::
lib-opt/GHCup/OptParse/HealthCheck.hs view
@@ -13,7 +13,6 @@ import GHCup.OptParse.Common  import GHCup.Command.HealthCheck-import GHCup.Errors import GHCup.Input.Parsers     ( toolParser ) import GHCup.Prelude.Logger@@ -34,7 +33,6 @@ import Text.PrettyPrint.HughesPJClass (prettyShow) import Control.Exception.Safe (MonadMask) -import qualified Data.Text                     as T   @@ -145,7 +143,7 @@               liftIO up               pure ExitSuccess             (VLeft e, _) -> do-              runLogger $ logError $ T.pack $ prettyHFError e+              runLogger $ logHFError e               pure $ ExitFailure 27  where   runLogger = flip runReaderT leanAppstate
lib-opt/GHCup/OptParse/Install.hs view
@@ -354,7 +354,7 @@   (InstallStack iopts)     -> installOther (toInstallOptionsNew stack iopts)   (InstallOtherTool iopts) -> installOther iopts  where-  guessMode = if guessVersion settings then GLax else GStrict+  guessMode = if fromMaybe True (guessVersion settings) then GLax else GStrict    toInstallOptionsNew instTool InstallOptions{..} = InstallOptionsNew{..} @@ -397,7 +397,7 @@                      installBindist                        instTool                        Nothing-                       (DownloadInfo ((decUTF8Safe . serializeURIRef') uri) regexDir "" Nothing Nothing Nothing (toInstallationInputSpec <$> defaultToolInstallSpec instTool pfreq tver))+                       (DownloadInfo ((decUTF8Safe . serializeURIRef') uri) regexDir "" Nothing Nothing Nothing (defaultToolInstallInputSpec instTool pfreq tver))                        (TargetVersionRev tver (fromRight 0 rev))                        (maybe GHCupInternal IsolateDir isolateDir)                        forceInstall@@ -427,15 +427,15 @@                VLeft err@(V (BuildFailed tmpdir _)) -> do                 case keepDirs settings of-                  Never -> runLogger (logError $ T.pack $ prettyHFError err)-                  _ -> runLogger (logError $ T.pack (prettyHFError err) <> "\n" <>-                    "Check the logs at " <> T.pack (fromGHCupPath logsDir) <> " and the build directory " <> T.pack tmpdir <> " for more clues." <> "\n" <>-                    "Make sure to clean up " <> T.pack tmpdir <> " afterwards.")+                  Never -> runLogger (logHFError err)+                  _ -> do+                    runLogger (logHFError err)+                    runLogger $ logError $ T.pack $ "Check the logs at " <> fromGHCupPath logsDir <> " and the build directory " <> tmpdir <> " for more clues.\n" <> "Make sure to clean up " <> tmpdir <> " afterwards."                 pure $ ExitFailure 3                VLeft e -> do                 runLogger $ do-                  logError $ T.pack $ prettyHFError e+                  logHFError e                   logError $ "Also check the logs in " <> T.pack (fromGHCupPath logsDir)                 pure $ ExitFailure 3    where
lib-opt/GHCup/OptParse/List.hs view
@@ -38,7 +38,9 @@ import           Options.Applicative     hiding ( style ) import           Prelude                 hiding ( appendFile ) import           System.Exit+import           System.Console.ANSI            ( hSupportsANSI ) import           System.Console.Pretty   hiding ( color )+import           System.IO                      ( stdout ) import           Text.PrettyPrint.HughesPJClass (prettyShow)  import qualified Data.Text                     as T@@ -178,9 +180,10 @@   -> ToolListResult   -> m () printListResult no_color show_revisions (PagerConfig pList pCmd) raw lr = do+  ansi <- liftIO $ hSupportsANSI stdout    let-    color | raw || no_color = (\_ x -> x)+    color | raw || no_color || not ansi = (\_ x -> x)           | otherwise       = Pretty.color    let@@ -290,7 +293,7 @@       liftIO up       pure ExitSuccess     (VLeft e, _) -> do-      runLogger $ logError $ T.pack $ prettyHFError e+      runLogger $ logHFError e       pure $ ExitFailure 44  where   runLogger = flip runReaderT leanAppstate
lib-opt/GHCup/OptParse/Nuke.hs view
@@ -33,7 +33,6 @@ import           Prelude                 hiding ( appendFile ) import           System.Exit -import qualified Data.Text                     as T   @@ -86,7 +85,7 @@                       pure ExitSuccess                  VLeft e -> do-                  runLogger $ logError $ T.pack $ prettyHFError e+                  runLogger $ logHFError e                   pure $ ExitFailure 15  where   run action' = do
lib-opt/GHCup/OptParse/Prefetch.hs view
@@ -243,11 +243,11 @@                   liftIO up                   pure ExitSuccess                 (VLeft e, _) -> do-                  runLogger $ logError $ T.pack $ prettyHFError e+                  runLogger $ logHFError e                   pure $ ExitFailure 15   where-  guessMode = if guessVersion settings then GLaxWithInstalled else GStrict+  guessMode = if fromMaybe True (guessVersion settings) then GLaxWithInstalled else GStrict    run action' = do     (appstate', up) <- liftIO getAppState'
lib-opt/GHCup/OptParse/Rm.hs view
@@ -207,7 +207,7 @@               liftIO up               pure ExitSuccess             (VLeft e, _) -> do-              runLogger $ logError $ T.pack $ prettyHFError e+              runLogger $ logHFError e               pure $ ExitFailure 7    postRmLog tv tool vm = runLogger $ do
lib-opt/GHCup/OptParse/Run.hs view
@@ -24,8 +24,8 @@ import GHCup.System.Directory import GHCup.Types import GHCup.Types.Optics-#ifdef IS_WINDOWS import Data.Maybe                    ( fromMaybe )+#ifdef IS_WINDOWS import GHCup.Prelude.Process import GHCup.Prelude.Process.Windows ( execNoMinGW, resolveExecutable ) #endif@@ -272,16 +272,16 @@                case r' of                  VRight _ -> pure ExitSuccess                  VLeft e -> do-                   runLogger $ logError $ T.pack $ prettyHFError e+                   runLogger $ logHFError e                    pure $ ExitFailure 28 #endif          VLeft e -> do-           runLogger $ logError $ T.pack $ prettyHFError e+           runLogger $ logHFError e            pure $ ExitFailure 27    where -   guessMode = if guessVersion settings then GLaxWithInstalled else GStrict+   guessMode = if fromMaybe True (guessVersion settings) then GLaxWithInstalled else GStrict     resolveToolchainFull :: ( MonadIOish m )                         => Excepts
lib-opt/GHCup/OptParse/Set.hs view
@@ -247,7 +247,7 @@   (SetOther sopts) -> setOther sopts   where-  guessMode = if guessVersion settings then GLaxWithInstalled else GStrict+  guessMode = if fromMaybe True (guessVersion settings) then GLaxWithInstalled else GStrict   runLogger = flip runReaderT leanAppstate   run action' = do     (appstate', up) <- liftIO getAppState'@@ -275,7 +275,7 @@               liftIO up               pure ExitSuccess             (VLeft e, _) -> do-              runLogger $ logError $ T.pack $ prettyHFError e+              runLogger $ logHFError e               pure $ ExitFailure 5  
lib-opt/GHCup/OptParse/Test.hs view
@@ -158,7 +158,7 @@ test testCommand settings (getAppState', leanAppstate) = case testCommand of   (TestGHC iopts) -> go iopts  where-  guessMode = if guessVersion settings then GLaxWithInstalled else GStrict+  guessMode = if fromMaybe True (guessVersion settings) then GLaxWithInstalled else GStrict   runLogger = flip runReaderT leanAppstate    go :: TestOptions -> IO ExitCode@@ -190,7 +190,7 @@                 pure ExitSuccess               VLeft e -> do                 runLogger $ do-                  logError $ T.pack $ prettyHFError e+                  logHFError e                   logError $ "Also check the logs in " <> T.pack (fromGHCupPath logsDir)                 pure $ ExitFailure 3 
lib-opt/GHCup/OptParse/ToolRequirements.hs view
@@ -24,7 +24,6 @@ import           Prelude                 hiding ( appendFile ) import           System.Exit -import qualified Data.Text                     as T import qualified Data.Text.IO                  as T import Control.Exception.Safe (MonadMask) import GHCup.Types.Optics@@ -117,7 +116,7 @@     >>= \case           VRight _ -> pure ExitSuccess           VLeft  e -> do-            runLogger $ logError $ T.pack $ prettyHFError e+            runLogger $ logHFError e             pure $ ExitFailure 12  where   run action' = do
lib-opt/GHCup/OptParse/UnSet.hs view
@@ -209,7 +209,7 @@                 runLogger $ logInfo $ T.pack (prettyShow sTool) <> " successfully unset"                 pure ExitSuccess               VLeft  e -> do-                runLogger $ logError $ T.pack $ prettyHFError e+                runLogger $ logHFError e                 pure $ ExitFailure 14  
lib-opt/GHCup/OptParse/Upgrade.hs view
@@ -13,8 +13,7 @@  import GHCup.Command.Upgrade import GHCup.Errors-import GHCup.Prelude.File-import GHCup.Prelude.Logger+import GHCup.Prelude import GHCup.Query.Metadata import GHCup.Types import GHCup.Types.Optics@@ -37,13 +36,11 @@ import System.Exit import System.FilePath -import qualified Data.Text as T     -     ---------------     --[ Options ]--     ---------------@@ -99,6 +96,7 @@                        , DownloadFailed                        , ToolShadowed                        , URIParseError+                       , NoInstallInfo                        ]  @@ -129,7 +127,7 @@    run (do     GHCupInfo { _ghcupDownloads = dls } <- lift getGHCupInfo-    Just tver <- pure $ getLatest dls ghcup+    tver <- getLatest dls ghcup ?? NoInstallLatestInfo ghcup     let latestVer = _tvVersion tver     let vm = getVersionMetadata tver ghcup dls     forM_ (_vmPreInstall =<< vm) $ \msg -> do@@ -152,7 +150,7 @@         runLogger $ logWarn "No GHCup update available"         pure ExitSuccess       (VLeft e, _) -> do-        runLogger $ logError $ T.pack $ prettyHFError e+        runLogger $ logHFError e         pure $ ExitFailure 11  where   runLogger = flip runReaderT leanAppstate
lib-opt/GHCup/OptParse/Whereis.hs view
@@ -36,7 +36,6 @@ import System.FilePath  import           Control.Exception.Safe ( MonadMask )-import qualified Data.Text              as T import           GHCup.Query.GHCupDirs import           GHCup.System.Directory import           GHCup.Types.Optics@@ -258,15 +257,31 @@       -> m ExitCode whereis whereisCommand whereisOptions settings (getAppState', leanAppstate) = do   Dirs{ .. }  <- runReaderT getDirs leanAppstate-  case (whereisCommand, whereisOptions) of-    (WhereisTool (Tool "ghcup") _, WhereisOptions{..}) -> do+  case (whereisCommand, whereisOptions, guessVersion settings) of+    (WhereisTool (Tool "ghcup") _, WhereisOptions{..}, _) -> do       loc <- liftIO (getExecutablePath >>= canon )       if directory       then liftIO $ putStr $ takeDirectory loc       else liftIO $ putStr loc       pure ExitSuccess -    (WhereisTool tool (Just (GHCVersion (TargetVersionReq v _))), WhereisOptions{..}) ->+    (WhereisTool tool whereVer, WhereisOptions{..}, Just True) -> do+      runWhereIs (do+        (TargetVersionReq v _) <- liftE $ resolveVersion whereVer GLaxInstalled tool+        loc <- liftE $ whereIsTool tool v+        if directory+        then takeDirectory <$> canon loc+        else canon loc+        )+        >>= \case+              VRight r -> do+                liftIO $ putStr r+                pure ExitSuccess+              VLeft e -> do+                runLogger $ logHFError e+                pure $ ExitFailure 30++    (WhereisTool tool (Just (GHCVersion (TargetVersionReq v _))), WhereisOptions{..}, _) ->       runLeanWhereIs (do         loc <- liftE $ whereIsTool tool v         if directory@@ -278,9 +293,10 @@                 liftIO $ putStr r                 pure ExitSuccess               VLeft e -> do-                runLogger $ logError $ T.pack $ prettyHFError e+                runLogger $ logHFError e                 pure $ ExitFailure 30-    (WhereisTool tool (Just (ToolVersion (VersionReq v _))), WhereisOptions{..}) ->++    (WhereisTool tool (Just (ToolVersion (VersionReq v _))), WhereisOptions{..}, _) ->       runLeanWhereIs (do         loc <- liftE $ whereIsTool tool (mkTVer v)         if directory@@ -292,10 +308,10 @@                 liftIO $ putStr r                 pure ExitSuccess               VLeft e -> do-                runLogger $ logError $ T.pack $ prettyHFError e+                runLogger $ logHFError e                 pure $ ExitFailure 30 -    (WhereisTool tool whereVer, WhereisOptions{..}) -> do+    (WhereisTool tool whereVer, WhereisOptions{..}, _) -> do       runWhereIs (do         (TargetVersionReq v _) <- liftE $ resolveVersion whereVer guessMode tool         loc <- liftE $ whereIsTool tool v@@ -308,26 +324,26 @@                 liftIO $ putStr r                 pure ExitSuccess               VLeft e -> do-                runLogger $ logError $ T.pack $ prettyHFError e+                runLogger $ logHFError e                 pure $ ExitFailure 30 -    (WhereisBaseDir, _) -> do+    (WhereisBaseDir, _, _) -> do       liftIO $ putStr =<< canon (fromGHCupPath baseDir)       pure ExitSuccess -    (WhereisBinDir, _) -> do+    (WhereisBinDir, _, _) -> do       liftIO $ putStr =<< canon binDir       pure ExitSuccess -    (WhereisCacheDir, _) -> do+    (WhereisCacheDir, _, _) -> do       liftIO $ putStr =<< canon (fromGHCupPath cacheDir)       pure ExitSuccess -    (WhereisLogsDir, _) -> do+    (WhereisLogsDir, _, _) -> do       liftIO $ putStr =<< canon (fromGHCupPath logsDir)       pure ExitSuccess -    (WhereisConfDir, _) -> do+    (WhereisConfDir, _, _) -> do       liftIO $ putStr =<< canon (fromGHCupPath confDir)       pure ExitSuccess  where@@ -338,7 +354,7 @@     cfp <- liftIO $ canonicalizePath fp     pure $ map (\c -> if isPathSeparator c then '/' else c) cfp -  guessMode = if guessVersion settings then GLaxWithInstalled else GStrict+  guessMode = if fromMaybe True (guessVersion settings) then GLaxInstalled else GStrict   runLeanWhereIs =       -- Don't use runLeanAppState here, which is disabled on windows.       -- This is the only command on all platforms that doesn't need full appstate.
lib-tui/GHCup/Brick/Actions.hs view
@@ -122,9 +122,16 @@               -> Maybe BrickInternalState               -> BrickInternalState constructList appD settings =-  replaceLR (filterVisible (Common._showAllVersions settings))+  fmap (fmap (fmap wrap)) .+  wrap+    . replaceLR (filterVisible (Common._showAllVersions settings))                 (_lr appD)+  where+    wrap :: BrickList a -> BrickList a+    wrap = L.setScrollWrap True +type BrickList = L.GenericList Common.Name V.Vector+ -- | Focus on the tool section and the predicate which matches. If no result matches, focus on index 0 selectBy :: Tool -> (ListResult -> Bool) -> BrickInternalState -> BrickInternalState selectBy tool predicate internal_state =@@ -687,6 +694,7 @@                                   , consoleOutter = \_ -> pure ()                                   , fileOutter    = \_ -> pure ()                                   , fancyColors   = True+                                  , consoleAnsi   = True                                   }   newIORef $ AppState defaultSettings                       dirs
lib-tui/GHCup/Brick/Attributes.hs view
@@ -24,7 +24,8 @@ defaultAttributes no_color = Brick.attrMap   Vty.defAttr   [ (L.listSelectedFocusedAttr , Vty.defAttr `withBackColor` Vty.blue)-  , (L.listSelectedAttr        , Vty.defAttr)+  , (L.listSelectedAttr        , Vty.defAttr `withBackColor` grey+                                             `withForeColor` Vty.white)   , (notInstalledAttr          , Vty.defAttr `withForeColor` Vty.red)   , (setAttr                   , Vty.defAttr `withForeColor` Vty.green)   , (installedAttr             , Vty.defAttr `withForeColor` Vty.green)@@ -49,6 +50,7 @@     withBackColor | no_color  = \attr _ -> attr `Vty.withStyle` Vty.reverseVideo                   | otherwise = Vty.withBackColor     withStyle                 = Vty.withStyle+    grey = Vty.RGBColor 10 10 10   notInstalledAttr, setAttr, installedAttr, recommendedAttr, hlsPoweredAttr :: Brick.AttrName
lib-tui/GHCup/Brick/Widgets/Navigation.hs view
@@ -30,7 +30,7 @@       EventM,       Widget(..),       (<+>),-      (<=>))+      (<=>), VScrollBarOrientation (OnRight)) import qualified Brick import           Brick.Widgets.Border ( hBorder, borderWithLabel, vBorder) import           Brick.Widgets.Border.Style ( unicode )@@ -46,6 +46,7 @@ import Control.Monad.State.Class (get, modify) import qualified Graphics.Vty           as Vty import GHCup.Brick.Common (BrickSettings (..))+import Brick.Widgets.Core (withVScrollBars)  type BrickList = L.GenericList Common.Name V.Vector @@ -84,7 +85,7 @@ -- | How to draw the navigation widget draw :: Bool -> AttrMap -> BrickSettings -> BrickInternalState -> Widget Common.Name draw versionFocus dimAttrs BrickSettings{..} bis-  = Brick.padBottom Max+  = withVScrollBars OnRight $ Brick.padBottom Max       ( Brick.joinBorders $ Brick.withBorderStyle unicode         $ borderWithLabel (Brick.str "GHCup")           (center (Brick.vLimit 1 header <=> hBorder <=> renderList'))
lib/GHCup/Command/Install.hs view
@@ -40,6 +40,7 @@  import qualified Data.Conduit.Combinators as C import qualified Data.Text                as T+import System.Exit (die)   @@ -93,7 +94,22 @@        (InstallationSpecResolved, FilePath) installTool tool treq installDir forceInstall extraArgs installTargets = do   GHCupInfo { _ghcupDownloads = dls } <- getGHCupInfo-  (rev, dlinfo) <- liftE $ getDownloadInfoE' tool treq+  (rev, dlinfo) <- runE @'[NoDownload] (getDownloadInfoE' tool treq) >>= \case+    VRight r -> pure r+    VLeft (V ndl@NoDownload{}) -> do+      -- In case we can't fetch the download info, we could still+      -- check whether any revision of said tool version is installed+      -- and turn the error into 'AlreadyInstalled' instead. This allows+      -- the caller to possibly ignore the error, since "already installed"+      -- has different semantics. See https://codeberg.org/haskell/ghcup-hs/issues/1394+      let tver = treq ^. tvqTargetVer+      installed <- lift $ isInstalled tool tver+      if isJust installed+      then throwE $ AlreadyInstalled tool tver+      else throwE ndl+    _ -> do+      liftIO $ die "Unexpected error!"+   installBindist     tool     (preview (_GHCupDownloads % ix tool % toolDetails % _Just) dls)@@ -178,7 +194,7 @@    case installDir of     IsolateDir isoDir -> do             -- isolated install-      lift $ logInfo $ "isolated installing Cabal to " <> T.pack isoDir+      lift $ logInfo $ T.pack $ "isolated installing " <> prettyShow tool <> " to " <> isoDir       installSpec <- liftE $ installPackedBindist tool toolDesc dl dlinfo (IsolateDirResolved isoDir) trev forceInstall extraArgs installTargets       pure (installSpec, isoDir) 
lib/GHCup/Errors.hs view
@@ -167,10 +167,10 @@     ]  -prettyHFError :: (Pretty e, HFErrorProject e) => e -> String-prettyHFError e =+prettyHFError' :: (Pretty e, HFErrorProject e) => Bool -> e -> String+prettyHFError' ansi e =   let errorCode = "GHCup-" <> padIntAndShow (eNum e)-  in ("[" <> linkEscapeCode errorCode  (hfErrorLink errorCode) <> "] ") <> prettyShow e+  in ("[" <> (if ansi then linkEscapeCode errorCode  (hfErrorLink errorCode) else errorCode) <> "] ") <> prettyShow e  where   hfErrorLink errorCode = "https://errors.haskell.org/messages/" <> errorCode   padIntAndShow i@@ -180,6 +180,12 @@     | i < 10000 = "0"    <> show i     | otherwise =           show i +prettyHFError :: (Pretty e, HFErrorProject e) => e -> String+prettyHFError = prettyHFError' False++prettyHFErrorLink :: (Pretty e, HFErrorProject e) => e -> String+prettyHFErrorLink = prettyHFError' True+ class HFErrorProject a where   eNum :: a -> Int   eNum _ = eBase (Proxy :: Proxy a)@@ -197,10 +203,12 @@     ------------------------  data NoInstallInfo = NoInstallInfo Tool TargetVersion+                   | NoInstallLatestInfo Tool   deriving (Show)  instance Pretty NoInstallInfo where   pPrint (NoInstallInfo tool tver) = text "Could not find install info for" <+> pPrint tool <+> text "version" <+> pPrint tver+  pPrint (NoInstallLatestInfo tool) = text "Could not find install info for the latest version of" <+> pPrint tool  instance HFErrorProject NoInstallInfo where   eBase _ = 380
lib/GHCup/Input/Parsers.hs view
@@ -445,7 +445,7 @@                     && LatestPrerelease `notElem` tags                     && tag `elem` tags             )-            dls ghc Nothing ?? TagNotFound tag hls+            dls ghc Nothing ?? TagNotFound tag ghc resolveVersion' (SetToolTag (GHCCompat ghcs)) _ t   | t == hls = do       GHCupInfo { _ghcupDownloads = dls } <- lift getGHCupInfo@@ -504,18 +504,25 @@   case pvp $ prettyVer (_tvVersion v) of -- need to be strict here     Left _ -> pure v     Right pvpIn-      | (guessMode /= GStrict) && hasn't (_GHCupDownloads % ix tool % toolVersionsL % ix v) dls -> do-          ghcs <- if guessMode == GLaxWithInstalled then getInstalledTools else pure []+      | guessMode == GStrict -> pure v+      | guessMode == GLaxWithInstalled && hasn't (_GHCupDownloads % ix tool % toolVersionsL % ix v) dls -> do+          ghcs <- getInstalledTools           if v `notElem` ghcs           then getLatestToolFor tool (_tvTarget v) pvpIn dls >>= \case-                 Just (pvp_, _vm, mt) -> do-                   v' <- pvpToVersion pvp_ ""-                   when (v' /= _tvVersion v) $ logWarn ("Assuming you meant version " <> prettyVer v')-                   pure $ TargetVersion mt v'+                 Just (pvp_, mt) -> decipherPVP pvp_ mt                  Nothing -> pure v           else pure v+      | guessMode == GLaxInstalled && hasn't (_GHCupDownloads % ix tool % toolVersionsL % ix v) dls -> do+          ghcs <- getInstalledTools+          getLatestToolFor' (_tvTarget v) pvpIn ghcs >>= \case+            Just (pvp_, mt) -> decipherPVP pvp_ mt+            Nothing -> pure v     _ -> pure v  where+  decipherPVP pvp_ mt = do+    v' <- pvpToVersion pvp_ ""+    when (v' /= _tvVersion v) $ logWarn ("Assuming you meant version " <> prettyVer v')+    pure $ TargetVersion mt v'   getInstalledTools = fmap _tvrTargetVer <$> getInstalledVersions' tool  
lib/GHCup/Prelude/Logger/Internal.hs view
@@ -15,6 +15,7 @@ -} module GHCup.Prelude.Logger.Internal where +import GHCup.Errors (prettyHFErrorLink, prettyHFError, HFErrorProject ) import GHCup.Types import GHCup.Types.Optics @@ -27,6 +28,7 @@ import System.Console.Pretty  import qualified Data.Text as T+import qualified Text.PrettyPrint.HughesPJClass as PJ  logInfo :: ( MonadReader env m            , LabelOptic' "loggerConfig" A_Lens env LoggerConfig@@ -68,7 +70,19 @@          -> m () logError = logInternal Error +logHFError :: ( MonadReader env m+             , LabelOptic' "loggerConfig" A_Lens env LoggerConfig+             , MonadIO m+             , PJ.Pretty e+             , HFErrorProject e+             )+          => e+          -> m ()+logHFError e = do+  LoggerConfig {..} <- gets @"loggerConfig"+  logInternal Error (T.pack $ if consoleAnsi then prettyHFErrorLink e else prettyHFError e) + logInternal :: ( MonadReader env m                , LabelOptic' "loggerConfig" A_Lens env LoggerConfig                , MonadIO m@@ -78,7 +92,7 @@ logInternal logLevel msg = do   LoggerConfig {..} <- gets @"loggerConfig"   let color' c = if fancyColors then color c else id-  let style' = case logLevel of+  let style' = if not consoleAnsi then id else case logLevel of         Debug _ -> style Bold . color' Blue         Info    -> style Bold . color' Green         Warn    -> style Bold . color' Yellow
lib/GHCup/Prelude/Process/Posix.hs view
@@ -37,7 +37,8 @@ import           Data.Word8 import           GHC.IO.Exception import           System.FilePath-import           System.IO                        ( stderr )+import           System.Console.ANSI              ( hSupportsANSI )+import           System.IO                        ( stdout, stderr ) import           System.IO.Error                  hiding ( catchIOError ) import           System.Posix.Directory import           System.Posix.IO@@ -114,10 +115,17 @@         $ forkIO         $ EX.handle (\(_ :: IOException) -> pure ())         $ EX.finally-            (case verbose of+            (do+               ansi <- hSupportsANSI stderr+               case verbose of                  Verbosity i-                | i > 0 -> tee fd stdoutRead-                | otherwise -> printToRegion fd stdoutRead 6 pState no_color+                   | i == 0+                   , ansi+                   -> printToRegion fd stdoutRead 6 pState no_color+                   | i == 0+                   -> readTilEOF (\bs' -> void $ SPIB.fdWrite fd (bs' <> "\n")) stdoutRead+                   | otherwise+                   -> tee fd stdoutRead             )             (putMVar done ()) @@ -150,7 +158,7 @@     lineAction :: ByteString -> IO ()     lineAction bs' = do       void $ SPIB.fdWrite fileFd (bs' <> "\n")-      void $ SPIB.fdWrite stdOutput (bs' <> "\n")+      void $ SPIB.fdWrite stdError (bs' <> "\n")    -- Reads fdIn and logs the output in a continuous scrolling area   -- of 'size' terminal lines. Also writes to a log file.
lib/GHCup/Prelude/Process/Windows.hs view
@@ -169,6 +169,7 @@            -> Maybe [(String, String)] -- ^ optional environment            -> m (Either ProcessError ()) execLogged exe args chdir lfile env' = do+  Settings {..} <- getSettings   Dirs {..} <- getDirs   logDebug $ T.pack $ "Running " <> exe <> " with arguments " <> show args   let stdoutLogfile = fromGHCupPath logsDir </> lfile <> ".stdout.log"@@ -187,16 +188,16 @@     $ \_ mout merr ph ->         case (mout, merr) of           (Just cStdout, Just cStderr) -> do-            withForkWait (tee stdoutLogfile cStdout) $ \waitOut ->-              withForkWait (tee stderrLogfile cStderr) $ \waitErr -> do+            withForkWait (tee verbose stdoutLogfile cStdout) $ \waitOut ->+              withForkWait (tee verbose stderrLogfile cStderr) $ \waitErr -> do                 waitOut                 waitErr             waitForProcess ph           _ -> fail "Could not acquire out/err handle"   where-  tee :: FilePath -> Handle -> IO ()-  tee logFile handle' = go+  tee :: Verbosity -> FilePath -> Handle -> IO ()+  tee (Verbosity vi) logFile handle' = go     where       go = do         some <- BS.hGetSome handle' 512@@ -204,6 +205,7 @@           then pure ()           else do             void $ BS.appendFile logFile some+            unless (vi == 0) $ do               -- subprocess stdout also goes to stderr for logging               void $ BS.hPut stderr some             go
lib/GHCup/Prelude/Version.hs view
@@ -79,8 +79,12 @@ -- False -- >>> matchPVPrefix [pver|8.10|] [pver|8.10.7|] -- True+-- >>> matchPVPrefix [pver|9.12.4.20260614|] [pver|9.12.4|]+-- False matchPVPrefix :: V.PVP -> V.PVP -> Bool-matchPVPrefix (toL -> prefix) (toL -> full) = and $ zipWith (==) prefix full+matchPVPrefix (toL -> prefix) (toL -> full)+  | length prefix > length full = False+  | otherwise = and $ zipWith (==) prefix full  toL :: V.PVP -> [Int] toL (V.PVP inner) = fmap fromIntegral $ NE.toList inner
lib/GHCup/Query/Metadata.hs view
@@ -207,17 +207,25 @@                  -> Maybe Text                  -> PVP                  -> GHCupDownloads-                 -> m (Maybe (PVP, VersionMetadata, Maybe Text))+                 -> m (Maybe (PVP, Maybe Text)) getLatestToolFor tool target pvpIn dls = do-  let ls :: [(TargetVersion, VersionMetadata)]-      ls = fromMaybe [] $ preview (_GHCupDownloads % ix tool % toolVersionsL % to Map.toDescList) dls-  let ps :: [(PVP, VersionMetadata, Maybe Text)]-      ps = catMaybes $ fmap (\(v, vm) -> do+  let ls :: [TargetVersion]+      ls = fromMaybe [] $ preview (_GHCupDownloads % ix tool % toolVersionsL % to (fmap fst . Map.toDescList)) dls+  getLatestToolFor' target pvpIn ls++getLatestToolFor' :: MonadThrow m+                  => Maybe Text+                  -> PVP+                  -> [TargetVersion]+                  -> m (Maybe (PVP, Maybe Text))+getLatestToolFor' target pvpIn ls = do+  let ps :: [(PVP, Maybe Text)]+      ps = catMaybes $ fmap (\v -> do              (pvp, unparsable) <- versionToPVP (_tvVersion v)              guard (T.null unparsable) -- TODO: hm-             pure (pvp, vm, _tvTarget v)+             pure (pvp, _tvTarget v)            ) ls-  pure . headMay . filter (\(v, _, t) -> matchPVPrefix pvpIn v && t == target) $ ps+  pure . headMay . filter (\(v, t) -> matchPVPrefix pvpIn v && t == target) $ ps       ------------@@ -357,7 +365,7 @@   case _dlInstallSpec dlinfo of     Just installInfo -> pure installInfo     Nothing-     | Just i <- toInstallationInputSpec <$> defaultToolInstallSpec tool pfreq tver+     | Just i <- defaultToolInstallInputSpec tool pfreq tver      -> pure i      | otherwise      -> throwE $ NoInstallInfo tool tver
lib/GHCup/Types.hs view
@@ -557,6 +557,59 @@     | _rPlatform pfreq == Windows = ".exe"     | otherwise = "" +defaultHLSInstallInputSpec :: PlatformRequest -> TargetVersion -> InstallationSpecInput+defaultHLSInstallInputSpec PlatformRequest{ _rPlatform = Windows } _tver =+  InstallationSpec {+    _isExeRules = [InstallFilePatternRule ["haskell-language-server-*"]]+  , _isDataRules = []+  , _isConfigure = Nothing+  , _isMake = Nothing+  , _isPreserveMtimes = False+  , _isExeSymLinked = [+    SymlinkPatternSpec {+      _slTargetPattern = ["haskell-language-server-wrapper*"]+    , _slTargetPatternIgnore = []+    , _slLinkName = "${TARGETFN}-${PKGVER}"+    , _slPVPMajorLinks = False+    , _slSetName = Just $ "${TARGETFN}"+    },+    SymlinkPatternSpec {+      _slTargetPattern = ["haskell-language-server-*"]+    , _slTargetPatternIgnore = ["haskell-language-server-wrapper*"]+    , _slLinkName = "${TARGETFN}~${PKGVER}"+    , _slPVPMajorLinks = False+    , _slSetName = Just $ "${TARGETFN}"+    }+  ]+  }+defaultHLSInstallInputSpec _pfreq _tver =+  InstallationSpec {+    _isExeRules = []+  , _isDataRules = []+  , _isConfigure = Nothing+  , _isMake = Just MakeSpec {+      _msMakeArgs   = ["install"]+    , _msMakeEnv    = Just $ EnvSpec [("DESTDIR", "${TMPDIR}"), ("PREFIX", "${PREFIX}")] PreferSpec+    }+  , _isPreserveMtimes = False+  , _isExeSymLinked = [+    SymlinkPatternSpec {+      _slTargetPattern = ["bin/haskell-language-server-wrapper*"]+    , _slTargetPatternIgnore = []+    , _slLinkName = "${TARGETFN}-${PKGVER}"+    , _slPVPMajorLinks = False+    , _slSetName = Just $ "${TARGETFN}"+    },+    SymlinkPatternSpec {+      _slTargetPattern = ["bin/haskell-language-server-*"]+    , _slTargetPatternIgnore = ["bin/haskell-language-server-wrapper*"]+    , _slLinkName = "${TARGETFN}~${PKGVER}"+    , _slPVPMajorLinks = False+    , _slSetName = Just $ "${TARGETFN}"+    }+  ]+  }+ defaultHLSInstallSpec :: PlatformRequest -> TargetVersion -> InstallationSpecResolved defaultHLSInstallSpec _pfreq _tver =   InstallationSpec {@@ -601,12 +654,12 @@   , _isPreserveMtimes = False   } -defaultToolInstallSpec :: Tool -> PlatformRequest -> TargetVersion -> Maybe InstallationSpecResolved-defaultToolInstallSpec (Tool "ghc") pfreq tver = Just $ defaultGHCInstallSpec pfreq tver-defaultToolInstallSpec (Tool "stack") pfreq tver = Just $ defaultStackInstallSpec pfreq tver-defaultToolInstallSpec (Tool "cabal") pfreq tver = Just $ defaultCabalInstallSpec pfreq tver-defaultToolInstallSpec (Tool "hls") pfreq tver = Just $ defaultHLSInstallSpec pfreq tver-defaultToolInstallSpec _ _ _ = Nothing+defaultToolInstallInputSpec :: Tool -> PlatformRequest -> TargetVersion -> Maybe InstallationSpecInput+defaultToolInstallInputSpec (Tool "ghc") pfreq tver = Just $ toInstallationInputSpec $ defaultGHCInstallSpec pfreq tver+defaultToolInstallInputSpec (Tool "stack") pfreq tver = Just $ toInstallationInputSpec $ defaultStackInstallSpec pfreq tver+defaultToolInstallInputSpec (Tool "cabal") pfreq tver = Just $ toInstallationInputSpec $ defaultCabalInstallSpec pfreq tver+defaultToolInstallInputSpec (Tool "hls") pfreq tver = Just $ defaultHLSInstallInputSpec pfreq tver+defaultToolInstallInputSpec _ _ _ = Nothing  -- | How to union two environments. Either -- we prefer the system environment in case@@ -709,7 +762,7 @@ toInputSpec :: SymlinkFileSpec -> SymlinkInputSpec toInputSpec SymlinkSpec{..} = SymlinkInputSpec{..} --- | Will be resolced to 'SymlinkSpec'.+-- | Will be resolved to 'SymlinkSpec'. data SymlinkInputSpec = SymlinkInputSpec   { _slTarget :: FilePath     -- ^ where the symlink will point to (this file exists already)@@ -891,7 +944,7 @@     , uMirrors = Just mirrors     , uDefGHCConfOptions = Just defGHCConfOptions     , uPager = Just pager-    , uGuessVersion = Just guessVersion+    , uGuessVersion = guessVersion     , uBuildWrapper = buildWrapper   } fromSettings Settings{..} (Just KeyBindings{..}) =@@ -925,7 +978,7 @@     , uMirrors = Just mirrors     , uDefGHCConfOptions = Just defGHCConfOptions     , uPager = Just pager-    , uGuessVersion = Just guessVersion+    , uGuessVersion = guessVersion     , uBuildWrapper = buildWrapper   } @@ -1030,7 +1083,7 @@   , mirrors :: DownloadMirrors   , defGHCConfOptions :: [String]   , pager :: PagerConfig-  , guessVersion :: Bool+  , guessVersion :: Maybe Bool   , buildWrapper :: Maybe ProcessSpec   }   deriving (GHC.Generic, Show)@@ -1061,7 +1114,7 @@ defaultMetaCache = 300 -- 5 minutes  defaultSettings :: Settings-defaultSettings = Settings False defaultMetaCache Lax False Never Curl (Verbosity 0) [NewGHCupURL] False GPGNone False Nothing (DM mempty) [] defaultPagerConfig True Nothing+defaultSettings = Settings False defaultMetaCache Lax False Never Curl (Verbosity 0) [NewGHCupURL] False GPGNone False Nothing (DM mempty) [] defaultPagerConfig Nothing Nothing  instance NFData Settings @@ -1204,8 +1257,9 @@ prettyVerRev :: VersionRev -> Text prettyVerRev VersionRev{..} = prettyVer _vrVersion <> "-r" <> T.pack (show _vrRev) --- | A GHC identified by the target platform triple--- and the version.+-- | A GHC identified by the optional target platform triple, and the version.+--+-- To know more, see https://codeberg.org/haskell/ghcup-hs/issues/1400#issuecomment-24828261 data TargetVersion = TargetVersion   { _tvTarget :: Maybe Text   , _tvVersion :: Version@@ -1214,8 +1268,10 @@  instance NFData TargetVersion --- | A GHC identified by the target platform triple--- and the version.+-- | A 'TargetVersion' together with a revision number, where a revision is+-- similar in spirit to the [homonymous concept on Hackage][1].+--+-- [1]: https://github.com/haskell-infra/hackage-trustees/blob/master/revisions-information.md data TargetVersionRev = TargetVersionRev   { _tvrTargetVer :: TargetVersion   , _tvrRev       :: Int@@ -1240,6 +1296,14 @@ unsafeToTargetVersionReq :: TargetVersion -> TargetVersionReq unsafeToTargetVersionReq tv = TargetVersionReq tv (Just 0) +-- | The user-sought counterpart of 'TargetVersionRev', where the revision is+-- wrapped in 'Maybe' to allow for the user to request no specific revision,+-- letting us chose it according to arbitrary but reasonable semantics that+-- depend on the command:+--+--   - for `install` we want to install the latest revision+--   - for `rm` we want to remove the revision that's currently installed+--   - … data TargetVersionReq = TargetVersionReq   { _tvqTargetVer :: TargetVersion   , _tvqRev       :: Maybe Int@@ -1334,6 +1398,8 @@     -- ^ whether to print debug in colorOutter   , consoleOutter :: T.Text -> IO ()     -- ^ how to write the console output+  , consoleAnsi :: Bool+    -- ^ Can we use ANSI escape sequences?   , fileOutter :: T.Text -> IO ()     -- ^ how to write the file output   , fancyColors :: Bool@@ -1341,7 +1407,7 @@   deriving (Show)  instance NFData LoggerConfig where-  rnf (LoggerConfig !lcPrintDebug !_ !_ !fancyColors) = rnf (lcPrintDebug, fancyColors)+  rnf (LoggerConfig !lcPrintDebug !_ !ansi !_ !fancyColors) = rnf (lcPrintDebug, ansi, fancyColors)  data ProcessError   = NonZeroExit Int FilePath [String]@@ -1432,6 +1498,7 @@   = GStrict -- ^ don't guess the proper tool version   | GLax -- ^ guess by using the metadata   | GLaxWithInstalled -- ^ guess by using metadata and installed versions+  | GLaxInstalled -- ^ guess by using only installed versions   deriving (Eq, Show)  data ShowRevisions = ShowUpdates
lib/GHCup/Types/JSON.hs view
@@ -128,6 +128,7 @@   , "edit"   , "env"   , "fmt"+  , "gild"   , "haddock-server"   , "hasklint"   , "helper"
lib/GHCup/Unpack.hs view
@@ -17,6 +17,7 @@ import           GHCup.Types.Tar ( ArchiveResult(..) ) import           GHCup.Errors import           GHCup.Prelude+import           GHCup.System.Directory import           GHCup.Types.Optics  import           Control.Monad.Catch (MonadThrow)@@ -34,6 +35,9 @@ import           Codec.Archive           hiding ( Directory                                                 , ArchiveResult -- imported from "GHCup.Unpack"                                                 )+import Codec.Archive.Internal.Unpack (unpackEntriesFp)+import Codec.Archive.Internal.Unpack.Lazy (bslToArchiveAbs)+import Codec.Archive.Foreign.Archive (archiveReadSupportFilterAll, archiveReadSupportFormatRaw, archiveReadSupportFormatAll) #endif  import qualified Codec.Compression.BZip        as BZip@@ -43,6 +47,7 @@ import qualified Data.Text                     as T  + -- | Unpack an archive to a given directory. unpackToDir :: (MonadReader env m, HasLog env, MonadIO m, MonadThrow m)             => FilePath       -- ^ destination dir@@ -64,6 +69,22 @@   let untar :: MonadIO m => BL.ByteString -> Excepts '[ArchiveResult] m ()       untar = lEM . liftIO . runArchiveM . unpackToDirLazy dfp +      unzstdTar :: MonadIO m => BL.ByteString -> Excepts '[ArchiveResult] m ()+      unzstdTar bs = lEM . liftIO . runArchiveM $ do+        ptr <- flip bslToArchiveAbs bs $ \ptr' -> do+          _ <- archiveReadSupportFormatAll ptr'+          archiveReadSupportFilterAll ptr'+        unpackEntriesFp ptr dfp+        pure ()++      unzstd :: MonadIO m => BL.ByteString -> Excepts '[ArchiveResult] m ()+      unzstd bs = lEM . liftIO . runArchiveM $ do+        ptr <- flip bslToArchiveAbs bs $ \ptr' -> do+          _ <- archiveReadSupportFormatRaw ptr'+          archiveReadSupportFilterAll ptr'+        unpackEntriesFp ptr dfp+        pure ()+       rf :: MonadIO m => FilePath -> Excepts '[ArchiveResult] m BL.ByteString       rf = liftIO . BL.readFile #endif@@ -82,8 +103,31 @@ #if defined(TAR)     | ".zip" `isSuffixOf` fn -> withArchive av (unpackInto dfp) #else-    -- libarchive supports zip+    -- libarchive supports more stuff     | ".zip" `isSuffixOf` fn -> liftE (untar =<< rf av)+    | any (`isSuffixOf` fn) [".tzst", ".tar.zst"] -> liftE (unzstdTar =<< rf av)+    -- single-file non-archives get extracted by libarchive+    -- as 'data' without the executable bit+    | any (`isSuffixOf` fn) [".zst", ".xz", ".bz2"] -> do+      liftE (unzstd =<< rf av)+      let from = dfp </> "data"+          to = dfp </> dropExtension fn+      liftIO $ renameFile from to+      chmod_755 to+    -- except .gz, which can have a filename header (or not),+    -- so we check for the 'data' file first+    | any (`isSuffixOf` fn) [".gz"] -> do+      liftE (unzstd =<< rf av)+      let from = dfp </> "data"+          to = dfp </> dropExtension fn+      e <- liftIO $ doesFileExist from+      if e+      then do+        liftIO $ renameFile from to+        chmod_755 to+      else+        chmod_755 (dfp </> dropExtension fn)+ #endif     | otherwise -> throwE $ UnknownArchive fn 
scripts/bootstrap/bootstrap-haskell view
@@ -41,7 +41,7 @@  plat="$(uname -s)" arch=$(uname -m)-ghver="0.2.6.2"+ghver="0.2.7.0" : "${GHCUP_BASE_URL:=https://downloads.haskell.org/~ghcup}"  export GHCUP_SKIP_UPDATE_CHECK=yes@@ -830,7 +830,7 @@ 	case "${plat}" in    			MSYS*|MINGW*|CYGWIN*) 				if [ -n "${BOOTSTRAP_HASKELL_ADJUST_CABAL_CONFIG}" ] ; then-					return 1+					return 0 				fi  				if [ -z "${BOOTSTRAP_HASKELL_NONINTERACTIVE}" ] ; then
scripts/bootstrap/bootstrap-haskell.ps1 view
@@ -47,7 +47,7 @@     [switch]$DontWriteDesktopShortcuts,
     # Whether to disable adjusting bashrc (in msys2 env) with PATH
     [switch]$DontAdjustBashRc,
-    # The msys2 environment to use, see https://www.msys2.org/docs/environments/ (defaults to MINGW64, MINGW32 or CLANGARM64, depending on the architecture)
+    # The msys2 environment to use, see https://www.msys2.org/docs/environments/ (defaults to CLANG64 or MINGW32 depending on the architecture)
     [string]$Msys2Env
 )
 
@@ -202,7 +202,8 @@   if ($env:PROCESSOR_ARCHITECTURE -eq 'x86') {
 	  $Msys2Env = 'MINGW32'
   } elseif ($env:PROCESSOR_ARCHITECTURE -eq 'AMD64') {
-	  $Msys2Env = 'MINGW64'
+	  # https://codeberg.org/haskell/ghcup-hs/issues/1395
+	  $Msys2Env = 'CLANG64'
   }
 }
 
@@ -557,7 +558,7 @@     Remove-Item -Path "$archivePath" -ErrorAction Continue
 
     Print-Msg -msg 'Processing MSYS2 bash for first time use...'
-    Exec "$Bash" '-lc' 'exit'
+    Start-Process cmd.exe -ArgumentList '/c', "`"$Bash`" -x -lc exit" -Wait
 
     Exec "$env:windir\system32\taskkill.exe" /F /FI "MODULES eq msys-2.0.dll"
 
@@ -704,10 +705,35 @@ # export GHCUP_MSYS2_ENV
 $null = [Environment]::SetEnvironmentVariable("GHCUP_MSYS2_ENV", $Msys2Env, [System.EnvironmentVariableTarget]::User)
 
-if ((Get-Process -ID $PID).ProcessName.StartsWith("bootstrap-haskell") -Or $InBash) {
-  Exec "$Bash" '-lc' ('{4} {6} {7} {8} {9} {10} {12} {13} [ -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* ]]  && {11} {0} | bash || cat $(cygpath -m ''{0}'') | bash' -f $BootstrapUrl, $MsysDir, $GhcupBasePrefix, $GhcupDir, $SilentExport, $CabalDirFull, $StackInstallExport, $HLSInstallExport, $AdjustCabalConfigExport, $MinimalExport, $BootstrapDownloader, $DownloadScript, $AdjustBashRcExport, $Msys2EnvExport)
+$env:MSYSTEM = "$Msys2Env"
+$env:CHERE_INVOKING = "1"
+$script = (@'
+set -eux
+[ -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
+{4}
+export CABAL_DIR="{5}"
+{6}
+{7}
+{8}
+{9}
+{10}
+{11}
+{12}
+trap 'echo Press any key to exit && read -n 1 && exit' 2
+if [[ "{0}" = https* ]] ; then
+	{13} {0} | bash
+else
+	cat $(cygpath -m "{0}") | bash
+fi
+'@ -f $BootstrapUrl, $MsysDir, $GhcupBasePrefix, $GhcupDir, $SilentExport, $CabalDirFull, $StackInstallExport, $HLSInstallExport, $AdjustCabalConfigExport, $MinimalExport, $BootstrapDownloader, $AdjustBashRcExport, $Msys2EnvExport, $DownloadScript)
+$b64 = [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($script))
+
+if ((Get-Process -ID $PID).ProcessName.StartsWith("bootstrap-haskell") -Or $InBash -Or -Not $Interactive) {
+  Exec "$Bash" '--login' '-e' '-c' ('bash <(echo {0} | base64 -d)' -f $b64)
 } else {
-  Exec "$Msys2Shell" $ShellType '-mintty'  '-shell' 'bash' '-c' ('{4} {6} {7} {8} {9} {10} {12} {13} [ -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* ]]  && {11} {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, $BootstrapDownloader, $DownloadScript, $AdjustBashRcExport, $Msys2EnvExport)
+  Exec "$Msys2Shell" $ShellType '-mintty' '-shell' 'bash' '-c' ('bash <(echo {0} | base64 -d) && echo ''Press any key to exit'' && read -n 1' -f $b64)
 }
 
 
test/ghcup-test/GHCup/ArbitraryTypes.hs view
@@ -117,7 +117,7 @@   shrink    = genericShrink  instance Arbitrary Day where-  arbitrary = ModifiedJulianDay . fromIntegral <$> (chooseAny :: Gen Int)+  arbitrary = ModifiedJulianDay <$> choose (-100000, 100000)  instance Arbitrary (URIRef Absolute) where   arbitrary =
test/ghcup-test/golden/unix/GHCupInfo.json view

7210 lines of diff, too many to show among the others: show this file