If an old alias, according to the tab, of a formula being upgraded (e.g.
python) has the same name as the main opt link of some other formula
(e.g. python@2), don't remove the main opt link of that other formula.
Specifically,
brew install python@2
brew upgrade python
should not accidentally delete /usr/local/opt/python@2 even though
python@2 used to be an alias of python.
Exclude executables in #empty_installation? to avoid 'Empty
Installation' error when only executable which name is the
same as one of metafiles is installed.
Fixes an issue introduced in #1192 where there would be a failure if the
alias link didn't exist on removal (which would be the case for anything
with an alias installed before #1192 was merged).
In #1497 I switched from Keg#to_formula for comparing kegs to formulae
to comparing the name and tap in the keg's tab to the name and tap of
the formula.
However, this fails to match if the name and tap of the formula have
changed since the keg was installed, so it's clearly better to use
Keg#to_formula where possible, and fall back to the information in the
tab when #to_formula can't be used.
Return `opt_prefix` if it exists and `prefix` is not called from within
the same formula's `install` or `post_install` methods. Otherwise, fall
back to the existing functionality.
This avoids the need to use `opt_prefix` etc. everywhere and generally
means we don't expose an implementation detail (i.e. the full Cellar
path) to dependents that have a habit of hard-coding it.
This is a proper fix to the problem addressed by #1510.
The problem arises when f_kegs is nil, which can happen if the name and
tap used to install a keg don't match the name and tap currently
associated with its formula (i.e. if it's been renamed or moved).
See https://github.com/Homebrew/brew/pull/1750#discussion_r94243825 for
discussion.
Removes Tab#reliable_runtime_dependencies? in favour of returning nil
from Tab#runtime_dependencies if the list is unreliable.
Because Homebrew 1.1.6 hasn't been tagged yet, tabs created in tests
aren't created with a homebrew_version that marks the
runtime_dependencies in the Tab as reliable, so there are some tests
that fail. To work around this, I've had to add a line to some tests
that explicitly overrides the homebrew_version in the Tab. This is
really ugly though, so they should be removed as soon as possible after
1.1.6 is released.
Because of an accidental use of `=` instead of `==`, the source formula
check would be skipped when determining if a keg depended on another one
(so only the versions would be compared).
Fixed that comparison, and updated the corresponding test.
Glad I caught that!