Sometimes, especially during development and troubleshooting, it would be nice to be able to reinstall a version in a similar manner to Homebrew. In its primitive form, it could be just uninstall and install chain, but take further, it could be done transactionally, too, i.e. a failure to install won't remove the previous instance.
Good feature. I like the idea of transactional reinstalls.
Should this be a separate command or just a flag to the install command as discussed in
https://github.com/asdf-vm/asdf/issues/148?
I'm open to either approach, but transactional reinstalls are a must either way.
I'm closing #148 in favor of this issue.
I started looking into this, unfortunately it doesn't look like transactional properties can be achieved without some support from the plugins.
While many of them are simple (download + extract) and this could be done by installing into temp dir, then uninstalling the old one, then moving the temp location into place, there are plugins like clojure which injects the install dir location into some installed scripts (so moving it after installation will make them invalid).
Also a lot of plugins use upstream installers or ./configure && make && make install so it's hard to tell whether moving directories after install would be safe (most likely it would require passing additional options to the installer, like DESTDIR with autotools).
I wonder if we could work around this issue by doing something like this:
Would that work? And if so do you think we will run into any problems with this approach? Thanks for taking the time to look into this!
I had to reinstall erlang after installing a few dependencies to compile it again and I can say that at least asdf-erlang wouldn't work this way, as it keeps its own record of which version is installed, so moving the install directory doesn't work.
(Tried on Archlinux).
I saw there are some plugin-test, maybe it would be interesting to add some tests for this feature before shipping it, so those plugins have the time to adapt ?
@Aethelflaed I don't think the erlang plugin should be keeping a record of which versions of Erlang it installed. It uses kerl underneath, and kerl does typically keep records, but I think we altered it such that asdf-erlang doesn't rely on that behavior. If not we may need to change it. Generally plugins should not be keeping track of installed plugins on their own.
I'd like to do this without changing the plugins at all if possible. We may have to update a few plugins so they will work properly however.