Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to reinstall a package? #1476

Open
FranklinChen opened this issue Dec 7, 2015 · 7 comments
Open

How to reinstall a package? #1476

FranklinChen opened this issue Dec 7, 2015 · 7 comments

Comments

@FranklinChen
Copy link

Here's a problem I seem to have run into with Stack: I don't know how to reinstall a package! I can't find documentation on how to do that. Before Stack, cabal --reinstall was simple.

The reason I want to reinstall is packages that depend on a C library that I've updated, such that I should rebuild.

@mgsloan
Copy link
Contributor

mgsloan commented Dec 7, 2015

I actually never used the cabal --reinstall flag (only --force-reinstall a lot, heh..). It only reinstalls the target package, right? So, for local packages you should be able to do this either by touching some files or stack clean.

It's a bit trickier for snapshot dependencies. stack exec -- ghc-pkg unregister --force PKG before building should do the trick.

I'm undecided on whether to add support for --reinstall, as this is hopefully a rather specialized case for people to handle. On the other hand, stack exec -- ghc-pkg unregister --force PKG is a bit of a magical incantation and having a --reinstall flag would be consistent with cabal (reuse people's knowledge of it).

@mcfilib
Copy link

mcfilib commented Dec 17, 2015

I ran into this issue today. I have a package that depends on a dynamic library that has since changed and would like to reinstall the package.

@mgsloan mgsloan modified the milestones: P2: Should, P3: Optional Dec 17, 2015
@mgsloan
Copy link
Contributor

mgsloan commented Dec 17, 2015

I suppose if we've got 2 people in 10 days facing the same issue, that's common enough to warrant a P2: Should.

So, stack build --reinstall mtl seems like a reasonable thing to have. Note that it would only reinstall target packages. Dependencies would only be built as necessary, and so usually won't be reinstalled.

@mgsloan
Copy link
Contributor

mgsloan commented Jan 31, 2016

Could also deprecate --force-dirty in favor of --reinstall. There would likely be a difference in logic, though. I'm imagining that --reinstall would only apply to targets, whereas --force-dirty causes all local packages to be considered dirty.

@Xandaros
Copy link

Xandaros commented Oct 3, 2017

I had my PC crash when I was compiling, causing some .hi files to be corrupted and I had to reinstall the package. It would indeed be very nice to have an option to do so, even if the applications aren't all that common. Hunting down how to reinstall/uninstall package is certainly not ideal.

@sebeaumont
Copy link

Also if flags change for a package even in stack.yaml stack doesn't detect that necessitating a manual rebuild by first removing the package...

@qrilka
Copy link
Contributor

qrilka commented Oct 15, 2019

@sebeaumont it would be great if you could show some minimal reproduction of this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants