Upgrading packages installed in a cabal sandbox
Asked Answered
D

1

9

I'm having some trouble understanding how to upgrade packages inside a cabal sandbox. I'd like to upgrade esqueleto-1.3.4.5 to esqueleto-1.3.5 and changed my myapp.cabal to depend on esqueleto >= 1.3.5 && < 1.4.

$ cabal --version cabal-install version 1.18.0.2 using version 1.18.1.2 of the Cabal library $ cabal install --upgrade-dependencies Resolving dependencies... cabal: Could not resolve dependencies: trying: esqueleto-1.3.4.5/installed-ac7... (user goal) next goal: myapp (user goal) rejecting: myapp-0.0.0 (conflict: esqueleto==1.3.4.5/installed-ac7..., myapp => esqueleto>=1.3.5 && <1.4)

The error looks to me as if cabal is trying to resolve dependencies using the installed version of esqueleto, esqueleto-1.3.4.5/installed-ac7... Could someone explain how this works?

My intuition was that I should use --upgrade-dependencies to do this but I also tried --only-dependencies and --reinstall.

Dukey answered 5/3, 2014 at 18:23 Comment(2)
cabal sandbox delete, cabal sandbox init, cabal install --only-dependencies is how I normally do that sort of thing. With a relatively small set of dependencies it doesn't take very long to re-run the whole thing. Alternatively you could just delete the old equeleto folder from your .cabal-sandbox/<platform>-package-db/ folder (I may be imprecise on that folder path, can't remember off the top of my head)Salted
Thanks bhecklilr - seems to work ok for me, although the yesod platform takes a lot of time to compile, deleting the package folder might be a better idea. Please post your comment as an answer, I'll upvote it.Dukey
S
6

The easiest way I've found is to just nuke your sandbox and start over

$ cabal sandbox delete
$ cabal sandbox init
$ cabal install --only-dependencies

You can alternatively delete the specific package from the .cabal-sandbox/<platform>/ and .cabal-sandbox/<platform>-packages.conf/ folders, but that requires a bit more "surgery". Unless your dependencies are just massive and you need to do this frequently, the nuclear option isn't too annoying.

Salted answered 5/3, 2014 at 20:2 Comment(1)
Something else that occurred to me is that I think I forgot to run cabal configure first. It seems to me like it must surely be possible to upgrade dependencies without rebuilding everything from scratch or deleting the package manually. I'm traveling atm, but I'll check if that works in a day or two. ThanksDukey

© 2022 - 2024 — McMap. All rights reserved.