diff --git a/ghcup-0.0.7.yaml b/ghcup-0.0.7.yaml index b976db0..7be3333 100644 --- a/ghcup-0.0.7.yaml +++ b/ghcup-0.0.7.yaml @@ -153,7 +153,7 @@ toolRequirements: unknown_versioning: distroPKGs: [] notes: On Windows, msys2 should already have been set up during the installation, - so most users should just press ENTER. + so most users should just proceed. If you are installing manually, make sure to have a working mingw64 toolchain and shell. ghcupDownloads: diff --git a/ghcup-0.0.7.yaml.sig b/ghcup-0.0.7.yaml.sig index f72f457..f1e8ffe 100644 Binary files a/ghcup-0.0.7.yaml.sig and b/ghcup-0.0.7.yaml.sig differ diff --git a/ghcup-gen/Generate.hs b/ghcup-gen/Generate.hs index 1e842c2..fd7a908 100644 --- a/ghcup-gen/Generate.hs +++ b/ghcup-gen/Generate.hs @@ -11,6 +11,7 @@ module Generate where import GHCup import GHCup.Download +import GHCup.Requirements import GHCup.Errors import GHCup.Types import GHCup.Types.Optics @@ -144,13 +145,14 @@ generateTable output = do handle <- case output of StdOut -> pure stdout FileOutput fp -> liftIO $ openFile fp WriteMode - + forM_ [GHC,Cabal,HLS,Stack] $ \tool -> do case tool of GHC -> liftIO $ hPutStrLn handle $ "
Show all supported GHC versions" Cabal -> liftIO $ hPutStrLn handle $ "
Show all supported cabal-install versions" HLS -> liftIO $ hPutStrLn handle $ "
Show all supported HLS versions" Stack -> liftIO $ hPutStrLn handle $ "
Show all supported Stack versions" + _ -> fail "no" liftIO $ hPutStrLn handle $ "" liftIO $ hPutStrLn handle $ "" liftIO $ hPutStrLn handle $ "" @@ -175,3 +177,53 @@ generateTable output = do printTag (Base pvp'') = "base-" ++ T.unpack (prettyPVP pvp'') printTag (UnknownTag t ) = t printTag Old = "" + + +generateSystemInfo :: ( MonadFail m + , MonadMask m + , Monad m + , MonadReader env m + , HasSettings env + , HasDirs env + , HasLog env + , MonadThrow m + , MonadIO m + , HasPlatformReq env + , HasGHCupInfo env + , MonadUnliftIO m + ) + => Output + -> m ExitCode +generateSystemInfo output = do + handle <- case output of + StdOut -> pure stdout + FileOutput fp -> liftIO $ openFile fp WriteMode + + forM_ [ Linux Debian + , Linux Ubuntu + , Linux Fedora + , Linux CentOS + , Linux Alpine + , Linux UnknownLinux + , Darwin + , FreeBSD + , Windows + ] $ \plat -> do + GHCupInfo { .. } <- getGHCupInfo + (Just req) <- pure $ getCommonRequirements (PlatformResult plat Nothing) _toolRequirements + liftIO $ hPutStrLn handle $ "### " <> (prettyPlat plat) <> "\n" + liftIO $ hPutStrLn handle $ (T.unpack $ pretty' req) <> "\n" + pure ExitSuccess + where + pretty' Requirements {..} = + let d = if not . null $ _distroPKGs + then "The following distro packages are required: " <> "`" <> T.intercalate " " _distroPKGs <> "`" + else "" + n = if not . T.null $ _notes then _notes else "" + in if | T.null d -> n + | T.null n -> d + | otherwise -> d <> "\n" <> n + + prettyPlat (Linux UnknownLinux) = "Linux (generic)" + prettyPlat p = show p + diff --git a/ghcup-gen/Main.hs b/ghcup-gen/Main.hs index d0d34af..3b22a43 100644 --- a/ghcup-gen/Main.hs +++ b/ghcup-gen/Main.hs @@ -65,6 +65,7 @@ data Command = ValidateYAML ValidateYAMLOpts | ValidateTarballs ValidateYAMLOpts TarballFilter | GenerateHlsGhc ValidateYAMLOpts Format Output | GenerateToolTable ValidateYAMLOpts Output + | GenerateSystemDepsInfo ValidateYAMLOpts Output fileOutput :: Parser Output @@ -152,11 +153,17 @@ com = subparser (progDesc "Generate a list of HLS-GHC support") ) <> command - "generate-table" + "generate-tool-table" (info ((GenerateToolTable <$> validateYAMLOpts <*> outputP) <**> helper) (progDesc "Generate a markdown table of available tool versions") ) + <> command + "generate-system-deps-info" + (info + ((GenerateSystemDepsInfo <$> validateYAMLOpts <*> outputP) <**> helper) + (progDesc "Generate a markdown info for system dependencies") + ) ) @@ -202,6 +209,7 @@ main = do ValidateTarballs vopts tarballFilter -> withValidateYamlOpts vopts (validateTarballs tarballFilter) GenerateHlsGhc vopts format output -> withValidateYamlOpts vopts (generateHLSGhc format output) GenerateToolTable vopts output -> withValidateYamlOpts vopts (generateTable output) + GenerateSystemDepsInfo vopts output -> withValidateYamlOpts vopts (generateSystemInfo output) pure () where
" <> show tool <> " VersionTags