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

Prevent brew casks from finding formulae at tap root #14164

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Library/Homebrew/cmd/casks.sh
Expand Up @@ -8,5 +8,5 @@
source "${HOMEBREW_LIBRARY}/Homebrew/items.sh"

homebrew-casks() {
homebrew-items 'Formula' 's|/Casks/|/|' '^homebrew/cask'
homebrew-items '*/Casks/*\.rb' '' 's|/Casks/|/|' '^homebrew/cask'
}
2 changes: 1 addition & 1 deletion Library/Homebrew/cmd/formulae.sh
Expand Up @@ -8,5 +8,5 @@
source "${HOMEBREW_LIBRARY}/Homebrew/items.sh"

homebrew-formulae() {
homebrew-items 'Casks' 's|/Formula/|/|' '^homebrew/core'
homebrew-items '*\.rb' 'Casks' 's|/Formula/|/|' '^homebrew/core'
}
11 changes: 6 additions & 5 deletions Library/Homebrew/items.sh
@@ -1,9 +1,10 @@
homebrew-items() {
local items
local sed_extended_regex_flag
local find_filter="$1"
local sed_filter="$2"
local grep_filter="$3"
local find_include_filter="$1"
local find_exclude_filter="$2"
local sed_filter="$3"
local grep_filter="$4"

# HOMEBREW_MACOS is set by brew.sh
# shellcheck disable=SC2154
Expand All @@ -19,14 +20,14 @@ homebrew-items() {
items="$(
find "${HOMEBREW_REPOSITORY}/Library/Taps" \
-type d \( \
-name "${find_filter}" -o \
-name "${find_exclude_filter}" -o \
-name cmd -o \
-name .github -o \
-name lib -o \
-name spec -o \
-name vendor \
\) \
-prune -false -o -name '*\.rb' |
-prune -false -o -path "${find_include_filter}" |
sed "${sed_extended_regex_flag}" \
-e 's/\.rb//g' \
-e 's_.*/Taps/(.*)/(home|linux)brew-_\1/_' \
Expand Down