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

os/mac/utils/bottles: handle Linux bottles. #5173

Merged
merged 1 commit into from
Oct 24, 2018
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
1 change: 1 addition & 0 deletions Library/Homebrew/compat.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require "compat/extend/os/mac/utils/bottles"
require "compat/requirements/x11_requirement"
require "compat/requirements/xcode_requirement"
require "compat/cask"
Expand Down
19 changes: 19 additions & 0 deletions Library/Homebrew/compat/extend/os/mac/utils/bottles.rb
Original file line number Diff line number Diff line change
@@ -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
15 changes: 9 additions & 6 deletions Library/Homebrew/extend/os/mac/utils/bottles.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ def find_altivec_tag(tag)
altivec_tag if key?(altivec_tag)
end

def tag_without_or_later(tag)
tag
end

# Find a bottle built for a previous version of macOS.
def find_older_compatible_tag(tag)
begin
Expand All @@ -51,13 +55,12 @@ def find_older_compatible_tag(tag)
end

keys.find do |key|
# TODO: move to compat?
key_tag_version = if key.to_s.end_with?("_or_later")
key.to_s[/(\w+)_or_later$/, 1].to_sym
else
key
key_tag_version = tag_without_or_later(key)
begin
MacOS::Version.from_symbol(key_tag_version) <= tag_version
rescue ArgumentError
false
end
MacOS::Version.from_symbol(key_tag_version) <= tag_version
end
end
end
Expand Down