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

brew upgrade requires reinstalling plugins #797

Closed
jdsutherland opened this issue Sep 8, 2020 · 13 comments
Closed

brew upgrade requires reinstalling plugins #797

jdsutherland opened this issue Sep 8, 2020 · 13 comments

Comments

@jdsutherland
Copy link

jdsutherland commented Sep 8, 2020

I should preface this by saying I'm fairly new to asdf. I just ran brew upgrade which included an update for asdf. I wasn't expecting this to wipe asdf and require reinstalling plugins.

  1. Is this the expected behavior?
  2. If so, should there be a more visible warning? (Unexpectedly having to reinstall languages and packages isn't a great experience).
  3. Is there any support for a persistent upgrade (that doesn't require manually copying)?
@jthegedus
Copy link
Contributor

jthegedus commented Sep 9, 2020

Hi @jdsutherland the Homebrew package is not created or maintained by any of the @asdf-vm/core team, it was created by someone in the community.

First off, given our small number of dependencies, we highly recommend installing via Git. It is the method we directly support and perform non-destructive updates.

That said, the brew upgrade experience you describe is far from ideal. Answering your questions:

  1. no
  2. we cannot control this and have had issues getting warnings in the Homebrew installation process in the past
  3. yes

I suspect that the brew installation removes the old installation dir and then installs the new in the same place. By default, all plugins, shims and installs land in the same place that asdf is installed. You can configure the install location of plugins and installations with the ASDF_DATA_DIR as documented here - https://asdf-vm.com/#/core-configuration?id=environment-variables Changing this from where Homebrew installs asdf would resolve this issue

I'm unsure how Homebrew installation will read these env vars though and if the Homebrew Formula needs to change.

@jdsutherland
Copy link
Author

jdsutherland commented Sep 9, 2020

I suspect that the brew installation removes the old installation dir and then installs the new in the same place.

You're correct.

Thanks for the response. I don't know enough about Homebrew to add much but given the current behavior, I think it might be better if the asdf formula didn't exist. Going forward, I will install with git as recommended.

@jthegedus
Copy link
Contributor

We might need to update the docs if setting ASDF_DATA_DIR is required for Homebrew usage. Thanks for bringing to our attention. I've added this scenario to #785

@joschi
Copy link
Contributor

joschi commented Sep 9, 2020

I also installed asdf with Homebrew but haven't seen the described behavior.

All my installed asdf plugins are retained over upgrades via Homebrew.
I didn't set ASDF_DATA_DIR on my system.

# env | grep ASDF
ASDF_DIR=/usr/local/opt/asdf
# brew config
HOMEBREW_VERSION: 2.5.0-22-gb94f9dc
ORIGIN: https://github.com/Homebrew/brew.git
HEAD: b94f9dccd71f43397eb028eecccd147375e9fd00
Last commit: 9 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: e7853d8f7f9b6216aa36657be438bb14d589e87f
Core tap last commit: 20 minutes ago
Core tap branch: master
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_EDITOR: /usr/bin/vim
HOMEBREW_GITHUB_API_TOKEN: set
HOMEBREW_MAKE_JOBS: 8
Homebrew Ruby: 2.6.3 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3_2/bin/ruby
CPU: octa-core 64-bit haswell
Clang: 11.0 build 1103
Git: 2.28.0 => /usr/local/bin/git
Curl: 7.64.1 => /usr/bin/curl
Java: 11.0.8, 1.8.0_265, 1.8.0_201
macOS: 10.15.6-x86_64
CLT: 11.0.33.17
Xcode: 11.7
# asdf info
OS:
Darwin joschi-mbp15.lan 19.6.0 Darwin Kernel Version 19.6.0: Thu Jun 18 20:49:00 PDT 2020; root:xnu-6153.141.1~1/RELEASE_X86_64 x86_64 i386 MacBookPro11,3 Darwin

SHELL:
GNU bash, version 5.0.18(1)-release (x86_64-apple-darwin19.5.0)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

ASDF VERSION:
v0.8.0

ASDF ENVIRONMENT VARIABLES:
ASDF_DIR=/usr/local/opt/asdf

ASDF INSTALLED PLUGINS:
java                         https://github.com/halcyon/asdf-java.git
jbang                        https://github.com/joschi/asdf-jbang.git

@jthegedus
Copy link
Contributor

jthegedus commented Sep 9, 2020

A few questions then:

@joschi

  • did you perform an entire brew upgrade or just brew upgrade asdf? Perhaps Homebrew treats these differently 🤔
  • with ASDF_DIR set to /usr/local/opt/asdf, does this mean ASDF_DATA_DIR is still set to the default ~/.asdf or does it then default to /usr/local/opt/asdf?

@jdsutherland
Given you have the latest version of asdf now, can you run asdf info and share that here? Unless of course you have moved over to the git installation method?

@joschi
Copy link
Contributor

joschi commented Sep 9, 2020

did you perform an entire brew upgrade or just brew upgrade asdf? Perhaps Homebrew treats these differently 🤔

Regular brew upgrade via topgrade.

with ASDF_DIR set to /usr/local/opt/asdf, does this mean ASDF_DATA_DIR is still set to the default ~/.asdf or does it then default to /usr/local/opt/asdf?

ASDF_DATA_DIR is still ~/.asdf (or rather unset, thus defaulting to $HOME/.asdf: https://github.com/asdf-vm/asdf/blob/v0.8.0/lib/utils.bash#L39-L49).

@jdsutherland
Copy link
Author

OS:
Darwin j.local 19.6.0 Darwin Kernel Version 19.6.0: Thu Jun 18 20:49:00 PDT 2020; root:xnu-6153.141.1~1/RELEASE_X86_64 x86_64

SHELL:
zsh 5.7.1 (x86_64-apple-darwin19.0)

ASDF VERSION:
v0.8.0

ASDF ENVIRONMENT VARIABLES:
ASDF_DIR=/usr/local/opt/asdf
ASDF_DATA_DIR=/usr/local/opt/asdf/

ASDF INSTALLED PLUGINS:
elixir                       https://github.com/asdf-vm/asdf-elixir.git
nodejs                       https://github.com/asdf-vm/asdf-nodejs.git
ruby                         https://github.com/asdf-vm/asdf-ruby.git

I can also say I know of one other person who has had the same issue I've had. Here's part of a commit message from their dotfiles:

* Whenever I do `brew upgrade asdf`, I have to re-install every Ruby
  version that was installed with an older version of asdf, or manually
  copy over the `ruby-2.6.6` etc directories to the new asdf directory
  (asdf-1.2, asdf-1.3, etc), which is incredibly annoying.

@joschi
Copy link
Contributor

joschi commented Sep 9, 2020

@jdsutherland Are you overriding ASDF_DATA_DIR in your shell configuration?

The asdf formula in Homebrew doesn't do this (https://github.com/Homebrew/homebrew-core/blob/b53bd72c5ea1c32306f456132b23a5ecfa51fcdf/Formula/asdf.rb) and asdf info is only printing what's in your environment (https://github.com/asdf-vm/asdf/blob/v0.8.0/lib/commands/command-info.bash).

@jdsutherland
Copy link
Author

jdsutherland commented Sep 9, 2020

I don't recall exactly but I had some issue when initially moving to asdf and found thoughtbot/dotfiles#577 (comment) via google, which I copied into my .zshrc:

export ASDF_DATA_DIR=`brew --prefix asdf`/
source $ASDF_DATA_DIR/asdf.sh

I suspect this is the problem?

@jthegedus
Copy link
Contributor

@jdsutherland I would suggest scrapping your .zshrc and following the documentation steps at https://asdf-vm.com - that should help you get setup for your system properly

@jdsutherland
Copy link
Author

@jthegedus I've done so and all was well until I recently restarted my machine and now asdf shows no plugins being installed.

❯ asdf info
OS:
Darwin j.local 19.6.0 Darwin Kernel Version 19.6.0: Thu Jun 18 20:49:00 PDT 2020; root:xnu-6153.141.1~1/RELEASE_X86_64 x86_64

SHELL:
zsh 5.7.1 (x86_64-apple-darwin19.0)

ASDF VERSION:
v0.8.0

ASDF ENVIRONMENT VARIABLES:
ASDF_DIR=/usr/local/opt/asdf

Oohes nooes ~! No plugins installed
ASDF INSTALLED PLUGINS:
❯ env | grep ASDF
ASDF_DIR=/usr/local/opt/asdf

❯ ls -la $ASDF_DIR
lrwxr-xr-x  1 j  admin  27 Sep  9 10:43 /usr/local/opt/asdf@ -> ../Cellar/asdf/HEAD-c6145d0

Files remain intact:


❯ ls $ASDF_DIR/installs
elixir/ nodejs/ ruby/

❯ du -sh $ASDF_DIR/
785M    /usr/local/opt/asdf/

Any idea?

@joschi
Copy link
Contributor

joschi commented Sep 18, 2020

@jdsutherland Your installs are under /usr/local/opt/asdf/, the previously set $ASDF_DATA_DIR.

You can copy or move the respective directories to the default asdf-vm data directory at $HOME/.asdf:

# mkdir ~/.asdf
# mv /usr/local/opt/asdf/{downloads,installs,plugins,repository,shims} ~/.asdf

@jthegedus
Copy link
Contributor

I'll remove this as an issue in #785 as this was an individual setup causing the issue. Thanks for helping @joschi

@jdsutherland I'm going to close this, feel free to reopen if this isn't completely solved for you

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

No branches or pull requests

4 participants
@joschi @jdsutherland @jthegedus and others