diff --git a/ChangeLog.md b/ChangeLog.md index ec8b2dff9c..3569350b4d 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -14,6 +14,12 @@ Behavior changes: * `stack build` will now announce when sublibraries of a package are being build, in the same way executables, tests, benchmarks and libraries are announced +* The `--upgrade-cabal` option to `stack setup` has been + deprecated. This feature no longer works with GHC 8.2 and + later. Furthermore, the reason for this flag originally being + implemented was drastically lessened once Stack started using the + snapshot's `Cabal` library for custom setups. See: + [#4070](https://github.com/commercialhaskell/stack/issues/4070). Other enhancements: diff --git a/doc/GUIDE.md b/doc/GUIDE.md index 36781d58d8..48c88aa875 100644 --- a/doc/GUIDE.md +++ b/doc/GUIDE.md @@ -1787,10 +1787,6 @@ users. Here's a quick rundown: * `stack upgrade` will build a new version of stack from source. * `--git` is a convenient way to get the most recent version from master for those testing and living on the bleeding edge. -* `stack setup --upgrade-cabal` can install a newer version of the Cabal - library, used for performing actual builds. You shouldn't generally do this, - since new Cabal versions may introduce incompatibilities with package sets, - but it can be useful if you're trying to test a specific bugfix. * `stack ls snapshots` will list all the local snapshots by default. You can also view the remote snapshots using `stack ls snapshots remote`. It also supports option for viewing only lts diff --git a/src/Stack/Setup.hs b/src/Stack/Setup.hs index 5ac40f61b7..5055fcd04b 100644 --- a/src/Stack/Setup.hs +++ b/src/Stack/Setup.hs @@ -684,7 +684,8 @@ upgradeCabal :: (HasConfig env, HasGHCVariant env) -> UpgradeTo -> RIO env () upgradeCabal wc upgradeTo = do - logInfo "Manipulating the global Cabal is only for debugging purposes" + logWarn "Using deprecated --upgrade-cabal feature, this is not recommended" + logWarn "Manipulating the global Cabal is only for debugging purposes" let name = $(mkPackageName "Cabal") rmap <- resolvePackages Nothing mempty (Set.singleton name) installed <- getCabalPkgVer wc @@ -717,6 +718,10 @@ doCabalInstall :: (HasConfig env, HasGHCVariant env) -> Version -> RIO env () doCabalInstall wc installed wantedVersion = do + when (wantedVersion >= $(mkVersion "2.2")) $ do + logWarn "--upgrade-cabal will almost certainly fail for Cabal 2.2 or later" + logWarn "See: https://github.com/commercialhaskell/stack/issues/4070" + logWarn "Valiantly attempting to build it anyway, but I know this is doomed" withSystemTempDir "stack-cabal-upgrade" $ \tmpdir -> do logInfo $ "Installing Cabal-" <> diff --git a/src/Stack/SetupCmd.hs b/src/Stack/SetupCmd.hs index 0f1e036ce1..5b25fb7494 100644 --- a/src/Stack/SetupCmd.hs +++ b/src/Stack/SetupCmd.hs @@ -63,7 +63,7 @@ cabalUpgradeParser = Specific <$> version' <|> latestParser <> OA.help "Install a specific version of Cabal" ) latestParser = OA.flag' Latest ( OA.long "upgrade-cabal" - <> OA.help "Install latest version of Cabal globally" ) + <> OA.help "DEPRECATED Install latest version of Cabal globally" ) setupParser :: OA.Parser SetupCmdOpts setupParser = SetupCmdOpts