cask/installer: support HOMEBREW_ALLOWED_TAPS
This commit is contained in:
parent
6663516e79
commit
34e2c4ee97
@ -574,15 +574,7 @@ on_request: true)
|
|||||||
|
|
||||||
sig { void }
|
sig { void }
|
||||||
def forbidden_tap_check
|
def forbidden_tap_check
|
||||||
forbidden_taps = Homebrew::EnvConfig.forbidden_taps
|
return if Homebrew::EnvConfig.forbidden_taps.blank? && Homebrew::EnvConfig.allowed_taps.blank?
|
||||||
return if forbidden_taps.blank?
|
|
||||||
|
|
||||||
forbidden_taps_set = Set.new(forbidden_taps.split.filter_map do |tap|
|
|
||||||
Tap.fetch(tap)
|
|
||||||
rescue Tap::InvalidNameError
|
|
||||||
opoo "Invalid tap name in `HOMEBREW_FORBIDDEN_TAPS`: #{tap}"
|
|
||||||
nil
|
|
||||||
end)
|
|
||||||
|
|
||||||
owner = Homebrew::EnvConfig.forbidden_owner
|
owner = Homebrew::EnvConfig.forbidden_owner
|
||||||
owner_contact = if (contact = Homebrew::EnvConfig.forbidden_owner_contact.presence)
|
owner_contact = if (contact = Homebrew::EnvConfig.forbidden_owner_contact.presence)
|
||||||
@ -592,25 +584,25 @@ on_request: true)
|
|||||||
unless skip_cask_deps?
|
unless skip_cask_deps?
|
||||||
cask_and_formula_dependencies.each do |cask_or_formula|
|
cask_and_formula_dependencies.each do |cask_or_formula|
|
||||||
dep_tap = cask_or_formula.tap
|
dep_tap = cask_or_formula.tap
|
||||||
next if dep_tap.blank?
|
next if dep_tap.blank? || dep_tap.allowed_by_env?
|
||||||
next unless forbidden_taps_set.include?(dep_tap)
|
|
||||||
|
|
||||||
dep_full_name = cask_or_formula.full_name
|
dep_full_name = cask_or_formula.full_name
|
||||||
raise CaskCannotBeInstalledError.new(@cask, <<~EOS
|
raise CaskCannotBeInstalledError.new(@cask, <<~EOS
|
||||||
The installation of #{@cask} has a dependency #{dep_full_name}
|
The installation of #{@cask} has a dependency #{dep_full_name}
|
||||||
but the #{dep_tap} tap was forbidden by #{owner} in `HOMEBREW_FORBIDDEN_TAPS`.#{owner_contact}
|
but #{owner} has either not allowed the #{dep_tap} in `HOMEBREW_ALLOWED_TAPS` or
|
||||||
|
has forbidden the #{dep_tap} in `HOMEBREW_FORBIDDEN_TAPS`.#{owner_contact}
|
||||||
EOS
|
EOS
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
cask_tap = @cask.tap
|
cask_tap = @cask.tap
|
||||||
return if cask_tap.blank?
|
return if cask_tap.blank? || cask_tap.allowed_by_env?
|
||||||
return unless forbidden_taps_set.include?(cask_tap)
|
|
||||||
|
|
||||||
raise CaskCannotBeInstalledError.new(@cask, <<~EOS
|
raise CaskCannotBeInstalledError.new(@cask, <<~EOS
|
||||||
The installation of #{@cask.full_name} has the tap #{cask_tap}
|
The installation of #{@cask.full_name} has the tap #{cask_tap}
|
||||||
which was forbidden by #{owner} in `HOMEBREW_FORBIDDEN_TAPS`.#{owner_contact}
|
which is either not allowed by #{owner} in `HOMEBREW_ALLOWED_TAPS` or
|
||||||
|
is forbidden by #{owner} in `HOMEBREW_FORBIDDEN_TAPS`.#{owner_contact}
|
||||||
EOS
|
EOS
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user