Skip to content

Commit

Permalink
Deprecate the --upgrade-cabal flag (fixes #4070)
Browse files Browse the repository at this point in the history
  • Loading branch information
snoyberg committed Jun 26, 2018
1 parent b9bc6a6 commit edc6304
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
6 changes: 6 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
4 changes: 0 additions & 4 deletions doc/GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion src/Stack/Setup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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-" <>
Expand Down
2 changes: 1 addition & 1 deletion src/Stack/SetupCmd.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit edc6304

Please sign in to comment.