Use `start_with?` to make sure the symlink actually points into one of
the Homebrew directories (depending on given arguments). Previously,
only a substring match was used, which would also remove a symlink to a
hypothetical `/opt/unrelated/usr/local/opt/Unrelated.app`. Even if
unlikely to occur, altering stuff unrelated to Homebrew is bad.
Furthermore, make sure to always use a trailing slash with directories.
Otherwise, e.g., `brew unlinkapps qt` will unlink .app bundles of both
`qt` and `qt5` if both are installed and `brew linkapps qt qt5` was
issued before. (Please ignore that `qt` and `qt5` offer a conflicting
set of .app bundles. This will have to be addressed elsewhere.)
ClosesHomebrew/homebrew#45174.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
dylib install_names are presently rewritten relative to HOMEBREW_PREFIX,
except for keg-only formulas, which are rewritten relative to
opt_prefix.
If we make a formula keg_only, all of its dependents need to be bumped,
since it will no longer exist in HOMEBREW_PREFIX and all of the links
will be written incorrectly.
If we always use opt_prefix, we avoid that dilemma, and make installed
packages more robust if a dependency is `brew unlink`ed.
ClosesHomebrew/homebrew#43518.
Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
The yellow background made the text unreadable for light-on-dark color
schemes. Fix by making the highlighted text just bold.
FixesHomebrew/homebrew#45028.
ClosesHomebrew/homebrew#45030.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Moves the "Checking out" output to where checkouts actually happen, to avoid spurious checkout announcements.
ClosesHomebrew/homebrew#45019.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Improve output in the (rare) cases where a tap offers both commands and
formulae or neither. Also adjust code to stay below the 80 column limit.
ClosesHomebrew/homebrew#44995.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
For consistency with `brew command` and the logic in `brew.sh` (both use
`which` to find/validate an external command), we need to filter files
that are not executable.
Otherwise `brew commands` and thus bash completion will offer commands
that will produce an error when attempting to use them.
ClosesHomebrew/homebrew#44999.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
* Move listing all formula names in the top to speed up shell script.
* Simplify logic.
* Only search PR and check bad regex for tty?, which will benefit to
shell script.
ClosesHomebrew/homebrew#44985.
Signed-off-by: Xu Cheng <xucheng@me.com>
There are audit rules which check cellar. Therefore, we need
`ARGV.resolved_formula` to get proper spec and prefix.
ClosesHomebrew/homebrew#44781.
Signed-off-by: Xu Cheng <xucheng@me.com>
The flow is as follow:
* If tap is nil(DIY install), search using name.
* If tap is found, search using full name.
* If tap is found and full name searching failed, search using name.
This usually means the formula may be migrated to different tap.
ClosesHomebrew/homebrew#44771.
Signed-off-by: Xu Cheng <xucheng@me.com>