Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@miketheman
Copy link
Contributor

@miketheman miketheman commented Oct 24, 2020

Homebrew has begun emitting a deprecation warning when checking for
requirements on osx as of Homebrew/brew#8851

Example output when installing a Ruby:

rvm install 2.7.2
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.15/x86_64/ruby-2.7.2.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Warning: Calling `brew list` to only list formulae is deprecated! Use `brew list --formula` instead.
... (repeated ~12 times on my system)
Warning: Calling `brew list` to only list formulae is deprecated! Use `brew list --formula` instead.
Certificates bundle '/usr/local/etc/[email protected]/cert.pem' is already up to date.
Requirements installation successful.
...

This does not impact the execution, and the command completes
successfully, however it's extra noise for the end user.

The --formula flag was added back in August in Homebrew/brew#8229
and brew will auto-update in most scenarios - but users who have set the
environment variable to not auto-update brew may fail this command with:

Error: ambiguous option: --formula

I do not have any insight when brew may handle the deprecation warning
and remove the existing behavior.

Fixes #5007

Homebrew has begun emitting a deprecation warning when checking for
requirements on osx as of Homebrew/brew#8851

Example output when installing a Ruby:

```
rvm install 2.7.2
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.15/x86_64/ruby-2.7.2.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Warning: Calling `brew list` to only list formulae is deprecated! Use `brew list --formula` instead.
... (repeated ~12 times on my system)
Warning: Calling `brew list` to only list formulae is deprecated! Use `brew list --formula` instead.
Certificates bundle '/usr/local/etc/[email protected]/cert.pem' is already up to date.
Requirements installation successful.
...
```

This does not impact the execution, and the command completes
successfully, however it's extra noise for the end user.

The `--formula` flag was added back in August in Homebrew/brew#8229
and brew will auto-update in most scenarios - but users who have set the
environment variable to not auto-update brew may fail this command with:

    Error: ambiguous option: --formula

I do not have any insight when brew may handle the deprecation warning
and remove the existing behavior.

Signed-off-by: Mike Fiedler <[email protected]>
Signed-off-by: Mike Fiedler <[email protected]>
@miketheman
Copy link
Contributor Author

I've added an entry to the CHANGELOG.md - but am uncertain how to interpret the other messages from the Mergable bot - so would appreciate any pointers you may have.

@havenwood havenwood added this to the rvm-1.29.11 milestone Oct 29, 2020
@havenwood
Copy link
Member

havenwood commented Oct 29, 2020

I've added an entry to the CHANGELOG.md - but am uncertain how to interpret the other messages from the Mergable bot - so would appreciate any pointers you may have.

I added a Label and Milestone for Mergeable.

Any idea how old the --formula flag is? Will this be backward compatible to still work with very old versions of Homebrew? If so, LGTM.

Thanks for the PR!

@miketheman
Copy link
Contributor Author

Any idea how old the --formula flag is? Will this be backward compatible to still work with very old versions of Homebrew?

Thanks - I called that out in the PR description:

The --formula flag was added back in August in Homebrew/brew#8229 ...

@havenwood havenwood requested a review from pkuczynski October 29, 2020 17:14
@felixbuenemann
Copy link
Contributor

The brew commit that added the deprecation warning is Homebrew/brew@c8809ce.

I don't think it makes sense, to document something as the default behavior and then throw a deprecation warning if you actually do depend on that default, which I've mentioned to @Akylzhan in a comment to the commit.

Added to that this breaks backwards compatibility, which makes the change even worse.

felixbuenemann referenced this pull request in Homebrew/brew Nov 5, 2020
cmd/list.rb: --formula, --cask as default TTY:

cmd/list.rb: proper deprecated message on non TTY outputs

update manpage

update zsh completion

updated manpages/brew.1

update tests

return list_casks

list_spec.rb: not output to stderr
@pkuczynski
Copy link
Member

I've added an entry to the CHANGELOG.md - but am uncertain how to interpret the other messages from the Mergable bot - so would appreciate any pointers you may have.

Mergeable fixed

@pkuczynski
Copy link
Member

Any idea how old the --formula flag is? Will this be backward compatible to still work with very old versions of Homebrew?

Thanks - I called that out in the PR description:

The --formula flag was added back in August in Homebrew/brew#8229 ...

Maybe we should check brew --version and only add the flag for older homebrew versions? Can you add this please?

In the event the user has a version of homebrew older than 2.5.7, when
the `--formula` flag was introduced, allow the command to continue.

Signed-off-by: Mike Fiedler <[email protected]>
@miketheman
Copy link
Contributor Author

Maybe we should check brew --version and only add the flag for older homebrew versions? Can you add this please?

I took a look at this, and added a detection mechanism. I'm not certain of the idioms used in the codebase, but this seemed to match similar cases of version comparison.

\typeset brew_lib_prefix
brew list -1 | __rvm_grep "^${1}$" >/dev/null &&
# Test for older versions of Homebrew before adding the `--formula` flag.
brew_version=$( brew --version | tee | head -n 1 | sed 's/[^0-9.]*\([0-9.]*\).*/\1/' )
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tee was necessary to prevent a broken pipe, since the brew command will return one line before proceeding to check other versions of casks. If there's a preferred way of doing this, happy to adapt.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know the PR is merged, but if you can use AWK it gets cleaner:

 brew --version | awk 'NR==1 { print $2 }'

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you wanna fire up PR with this change?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing! I wasn't sure if it was a change worth enough to open a PR, but I'll make one now :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not hurt for sure :) Thanks!

pkuczynski
pkuczynski previously approved these changes Nov 24, 2020
Copy link
Member

@pkuczynski pkuczynski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@pkuczynski pkuczynski changed the title Update brew list command Update brew list command to remove deprecation warning Nov 24, 2020
@pkuczynski pkuczynski merged commit b64f1c2 into rvm:master Nov 24, 2020
@miketheman miketheman deleted the miketheman/update-brew-list-command branch November 24, 2020 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Warning: Calling brew list to only list formulae is deprecated! Use brew list --formula instead.

5 participants