Merge pull request #15058 from apainintheneck/fix-readall-no-simulate
readall: fix no simulate
This commit is contained in:
commit
12e7787eb6
@ -1,10 +0,0 @@
|
|||||||
# typed: true
|
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
module Readall
|
|
||||||
class << self
|
|
||||||
def valid_casks?(_casks, bottle_tag: nil)
|
|
||||||
true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
37
Library/Homebrew/extend/os/mac/readall.rb
Normal file
37
Library/Homebrew/extend/os/mac/readall.rb
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
# typed: true
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Readall
|
||||||
|
class << self
|
||||||
|
def valid_casks?(casks, os_name: nil, arch: Hardware::CPU.type)
|
||||||
|
return true if os_name == :linux
|
||||||
|
|
||||||
|
current_macos_version = if os_name.is_a?(Symbol)
|
||||||
|
MacOS::Version.from_symbol(os_name)
|
||||||
|
else
|
||||||
|
MacOS.version
|
||||||
|
end
|
||||||
|
|
||||||
|
success = T.let(true, T::Boolean)
|
||||||
|
casks.each do |file|
|
||||||
|
cask = Cask::CaskLoader.load(file)
|
||||||
|
|
||||||
|
# Fine to have missing URLs for unsupported macOS
|
||||||
|
macos_req = cask.depends_on.macos
|
||||||
|
next if macos_req&.version && Array(macos_req.version).none? do |macos_version|
|
||||||
|
current_macos_version.public_send(macos_req.comparator, macos_version)
|
||||||
|
end
|
||||||
|
|
||||||
|
raise "Missing URL" if cask.url.nil?
|
||||||
|
rescue Interrupt
|
||||||
|
raise
|
||||||
|
rescue Exception => e # rubocop:disable Lint/RescueException
|
||||||
|
os_and_arch = "macOS #{current_macos_version} on #{arch}"
|
||||||
|
onoe "Invalid cask (#{os_and_arch}): #{file}"
|
||||||
|
$stderr.puts e
|
||||||
|
success = false
|
||||||
|
end
|
||||||
|
success
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@ -1,4 +1,4 @@
|
|||||||
# typed: strict
|
# typed: strict
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "extend/os/linux/readall" if OS.linux?
|
require "extend/os/mac/readall" if OS.mac?
|
||||||
|
|||||||
@ -62,28 +62,8 @@ module Readall
|
|||||||
success
|
success
|
||||||
end
|
end
|
||||||
|
|
||||||
def valid_casks?(casks, bottle_tag: nil)
|
def valid_casks?(_casks, os_name: nil, arch: nil)
|
||||||
return true if bottle_tag.present? && bottle_tag.system == :linux
|
true
|
||||||
|
|
||||||
success = T.let(true, T::Boolean)
|
|
||||||
casks.each do |file|
|
|
||||||
cask = Cask::CaskLoader.load(file)
|
|
||||||
|
|
||||||
# Fine to have missing URLs for unsupported macOS
|
|
||||||
macos_req = cask.depends_on.macos
|
|
||||||
next if macos_req&.version && Array(macos_req.version).none? do |macos_version|
|
|
||||||
bottle_tag.to_macos_version.public_send(macos_req.comparator, macos_version)
|
|
||||||
end
|
|
||||||
|
|
||||||
raise "Missing URL" if cask.url.nil?
|
|
||||||
rescue Interrupt
|
|
||||||
raise
|
|
||||||
rescue Exception => e # rubocop:disable Lint/RescueException
|
|
||||||
onoe "Invalid cask (#{bottle_tag}): #{file}"
|
|
||||||
$stderr.puts e
|
|
||||||
success = false
|
|
||||||
end
|
|
||||||
success
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def valid_tap?(tap, options = {})
|
def valid_tap?(tap, options = {})
|
||||||
@ -108,7 +88,7 @@ module Readall
|
|||||||
Homebrew::SimulateSystem.os = os_name
|
Homebrew::SimulateSystem.os = os_name
|
||||||
|
|
||||||
success = false unless valid_formulae?(tap.formula_files, bottle_tag: bottle_tag)
|
success = false unless valid_formulae?(tap.formula_files, bottle_tag: bottle_tag)
|
||||||
success = false unless valid_casks?(tap.cask_files, bottle_tag: bottle_tag)
|
success = false unless valid_casks?(tap.cask_files, os_name: os_name, arch: arch)
|
||||||
ensure
|
ensure
|
||||||
Homebrew::SimulateSystem.clear
|
Homebrew::SimulateSystem.clear
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user