Skip to content

Commit

Permalink
Merge pull request #17608 from Homebrew/audit_min_os-more-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeMcQuaid authored Jul 2, 2024
2 parents d0033c5 + 3f73f32 commit c524e5c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
13 changes: 5 additions & 8 deletions Library/Homebrew/cask/audit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -666,28 +666,25 @@ def audit_min_os

return if min_os.nil? || min_os <= HOMEBREW_MACOS_OLDEST_ALLOWED

cask_min_os = if cask.on_system_blocks_exist? && cask.on_system_block_min_os.present?
cask.on_system_block_min_os
else
cask.depends_on.macos&.minimum_version
end
cask_min_os = [cask.on_system_block_min_os, cask.depends_on.macos&.minimum_version].compact.max
odebug "Declared minimum OS version: #{cask_min_os&.to_sym}"
return if cask_min_os&.to_sym == min_os.to_sym
return if cask.on_system_blocks_exist? &&
OnSystem.arch_condition_met?(:arm) &&
cask_min_os < MacOSVersion.new("11")

min_os_definition = if cask_min_os.present?
if cask.on_system_blocks_exist? && cask.on_system_block_min_os.present?
"a block with a minimum OS version of #{cask.on_system_block_min_os.inspect}"
if cask.on_system_block_min_os.present? &&
cask.on_system_block_min_os > cask.depends_on.macos&.minimum_version
"a block with a minimum OS version of #{cask_min_os.to_sym.inspect}"
else
cask_min_os.to_sym.inspect
end
else
"no minimum OS version"
end
add_error "Upstream defined #{min_os.to_sym.inspect} as the minimum OS version " \
"and the cask declared #{min_os_definition}",
"but the cask declared #{min_os_definition}",
strict_only: true
end

Expand Down
4 changes: 2 additions & 2 deletions Library/Homebrew/extend/on_system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ def self.setup_macos_methods(base)
return unless OnSystem.os_condition_met? os_condition, or_condition

@on_system_block_min_os = if or_condition == :or_older
MacOSVersion.new(HOMEBREW_MACOS_OLDEST_ALLOWED).to_sym
@called_in_on_system_block ? @on_system_block_min_os : MacOSVersion.new(HOMEBREW_MACOS_OLDEST_ALLOWED)
else
os_condition
MacOSVersion.from_symbol(os_condition)
end
@called_in_on_system_block = true
result = block.call
Expand Down

0 comments on commit c524e5c

Please sign in to comment.