os/mac/utils/bottles: handle Linux bottles.
These are an invalid argument on macOS but still need to be handled.
This commit is contained in:
parent
89277adbcc
commit
b0198d097e
@ -1,3 +1,4 @@
|
|||||||
|
require "compat/extend/os/mac/utils/bottles"
|
||||||
require "compat/requirements/x11_requirement"
|
require "compat/requirements/x11_requirement"
|
||||||
require "compat/requirements/xcode_requirement"
|
require "compat/requirements/xcode_requirement"
|
||||||
require "compat/cask"
|
require "compat/cask"
|
||||||
|
|||||||
19
Library/Homebrew/compat/extend/os/mac/utils/bottles.rb
Normal file
19
Library/Homebrew/compat/extend/os/mac/utils/bottles.rb
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
module Utils
|
||||||
|
class Bottles
|
||||||
|
class Collector
|
||||||
|
module Compat
|
||||||
|
private
|
||||||
|
|
||||||
|
def tag_without_or_later(tag)
|
||||||
|
return super unless tag.to_s.end_with?("_or_later")
|
||||||
|
|
||||||
|
odeprecated "`or_later` bottles",
|
||||||
|
"bottles without `or_later` (or_later is implied now)"
|
||||||
|
tag.to_s[/(\w+)_or_later$/, 1].to_sym
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
prepend Compat
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@ -42,6 +42,10 @@ module Utils
|
|||||||
altivec_tag if key?(altivec_tag)
|
altivec_tag if key?(altivec_tag)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def tag_without_or_later(tag)
|
||||||
|
tag
|
||||||
|
end
|
||||||
|
|
||||||
# Find a bottle built for a previous version of macOS.
|
# Find a bottle built for a previous version of macOS.
|
||||||
def find_older_compatible_tag(tag)
|
def find_older_compatible_tag(tag)
|
||||||
begin
|
begin
|
||||||
@ -51,13 +55,12 @@ module Utils
|
|||||||
end
|
end
|
||||||
|
|
||||||
keys.find do |key|
|
keys.find do |key|
|
||||||
# TODO: move to compat?
|
key_tag_version = tag_without_or_later(key)
|
||||||
key_tag_version = if key.to_s.end_with?("_or_later")
|
begin
|
||||||
key.to_s[/(\w+)_or_later$/, 1].to_sym
|
|
||||||
else
|
|
||||||
key
|
|
||||||
end
|
|
||||||
MacOS::Version.from_symbol(key_tag_version) <= tag_version
|
MacOS::Version.from_symbol(key_tag_version) <= tag_version
|
||||||
|
rescue ArgumentError
|
||||||
|
false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user