From 4815267eacc57033b0cb3c19607bcc4a63891cc2 Mon Sep 17 00:00:00 2001 From: Simon Jakobi Date: Mon, 29 Aug 2016 17:37:50 +0200 Subject: [PATCH] Address option compatibility issues around system-ghc * Add notes to ghc-variant and setup --reinstall help texts * Add a check to catch uses of ghc-variant in combination with no-system-ghc --- doc/yaml_configuration.md | 2 ++ src/Stack/Config.hs | 7 +++++-- src/Stack/Options.hs | 2 +- src/Stack/SetupCmd.hs | 2 +- src/Stack/Types/Config.hs | 8 ++++++++ 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/doc/yaml_configuration.md b/doc/yaml_configuration.md index 5bc153a41c..b5a673d123 100644 --- a/doc/yaml_configuration.md +++ b/doc/yaml_configuration.md @@ -437,6 +437,8 @@ Specify a variant binary distribution of GHC to use. Known values: [setup-info](#setup-info) so `stack setup` knows where to download it, or pass the `stack setup --ghc-bindist` argument on the command-line +This option is incompatible with `system-ghc: true`. + ### setup-info (Since 0.1.5) diff --git a/src/Stack/Config.hs b/src/Stack/Config.hs index 0287c12040..b731627b53 100644 --- a/src/Stack/Config.hs +++ b/src/Stack/Config.hs @@ -226,9 +226,12 @@ configFromConfigMonoid configStackRoot configUserConfigPath mresolver mproject C configMonoidPackageIndices configGHCVariant0 = getFirst configMonoidGHCVariant - configSystemGHC = fromFirst False configMonoidSystemGHC - configInstallGHC = fromFirst False configMonoidInstallGHC + + when (isJust configGHCVariant0 && configSystemGHC) $ + throwM ManualGHCVariantSettingsAreIncompatibleWithSystemGHC + + let configInstallGHC = fromFirst False configMonoidInstallGHC configSkipGHCCheck = fromFirst False configMonoidSkipGHCCheck configSkipMsys = fromFirst False configMonoidSkipMsys diff --git a/src/Stack/Options.hs b/src/Stack/Options.hs index 90923bdbf6..424de72ffa 100644 --- a/src/Stack/Options.hs +++ b/src/Stack/Options.hs @@ -861,7 +861,7 @@ ghcVariantParser hide = readGHCVariant (long "ghc-variant" <> metavar "VARIANT" <> help - "Specialized GHC variant, e.g. integersimple" <> + "Specialized GHC variant, e.g. integersimple (incompatible with --system-ghc)" <> hideMods hide ) where diff --git a/src/Stack/SetupCmd.hs b/src/Stack/SetupCmd.hs index 34d9190399..ddfc04156a 100644 --- a/src/Stack/SetupCmd.hs +++ b/src/Stack/SetupCmd.hs @@ -46,7 +46,7 @@ setupParser = SetupCmdOpts "The default is to install the version implied by the resolver."))) <*> OA.boolFlags False "reinstall" - "reinstalling GHC, even if available" + "reinstalling GHC, even if available (incompatible with --system-ghc)" OA.idm <*> OA.boolFlags False "upgrade-cabal" diff --git a/src/Stack/Types/Config.hs b/src/Stack/Types/Config.hs index 115e5c6c8c..139aac9320 100644 --- a/src/Stack/Types/Config.hs +++ b/src/Stack/Types/Config.hs @@ -1043,6 +1043,7 @@ data ConfigException | BadStackRoot (Path Abs Dir) | Won'tCreateStackRootInDirectoryOwnedByDifferentUser (Path Abs Dir) (Path Abs Dir) -- ^ @$STACK_ROOT@, parent dir | UserDoesn'tOwnDirectory (Path Abs Dir) + | ManualGHCVariantSettingsAreIncompatibleWithSystemGHC deriving Typeable instance Show ConfigException where show (ParseConfigFileException configFile exception) = concat @@ -1138,6 +1139,13 @@ instance Show ConfigException where , T.unpack configMonoidAllowDifferentUserName , "' to disable this precaution." ] + show ManualGHCVariantSettingsAreIncompatibleWithSystemGHC = T.unpack $ T.concat + [ "stack can only control the " + , configMonoidGHCVariantName + , " of its own GHC installations. Please use '--no-" + , configMonoidSystemGHCName + , "'." + ] instance Exception ConfigException showOptions :: WhichSolverCmd -> String