[Haskell-cafe] uninstalling libraries
qdunkan at gmail.com
Mon Nov 13 03:53:40 UTC 2017
For a very long time, I've used a local script to uninstall libraries.
Initially it was very simple: use ghc-pkg field to find and remove
library-dirs, import-dirs, and haddock-html, and call ghc-pkg
It served well for a long time, but eventually I got tired of copy
paste games and extended it to be able to recursively delete
dependents too. Unfortunately now it's no longer so simple. The main
problem is that the only way I know to find dependents is to ghc-pkg
unregister, and see what the error message complains about. That's
obviously pretty bad, since by that time you've already unregistered,
so it's too late to back out. The non-atomic nature of unregister+rm
has always caused problems anyway, since if unregister succeeds, but
the remove fails, we are stuck with a partial install. Recursive
delete is too error prone, so I reverted that.
And then I discovered that hmatrix helpfully includes /opt/local/lib
and /usr/local/lib in its library-dirs, so clearly just deleting
whatever the package tells me is not very safe. All this has led me
to believe uninstalling packages is not so simple, and maybe there
should be an actual real way to do it, not everyone hacking up their
own dangerous shell scripts.
So... is there? Should there be one? Is there interest in one? How
do other people uninstall libraries? Is there a better interface to
the pkg db than ghc-pkg? Is there a better way to find dependents
than ghc-pkg unregister?
More information about the Haskell-Cafe