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

bottles: make or_later the default. #5100

Merged
merged 1 commit into from
Oct 15, 2018
Merged
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
33 changes: 11 additions & 22 deletions Library/Homebrew/extend/os/mac/utils/bottles.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ class Collector
alias generic_find_matching_tag find_matching_tag

def find_matching_tag(tag)
generic_find_matching_tag(tag) || find_altivec_tag(tag) || find_or_later_tag(tag)
generic_find_matching_tag(tag) ||
find_altivec_tag(tag) ||
find_older_compatible_tag(tag)
end

# This allows generic Altivec PPC bottles to be supported in some
Expand All @@ -40,37 +42,24 @@ def find_altivec_tag(tag)
altivec_tag if key?(altivec_tag)
end

# Allows a bottle tag to specify a specific OS or later,
# so the same bottle can target multiple OSs.
def find_or_later_tag(tag)
# Find a bottle built for a previous version of macOS.
def find_older_compatible_tag(tag)
begin
tag_version = MacOS::Version.from_symbol(tag)
rescue ArgumentError
return
end

keys.find do |key|
if key.to_s.end_with?("_or_later")
later_tag = key.to_s[/(\w+)_or_later$/, 1].to_sym
MacOS::Version.from_symbol(later_tag) <= tag_version
elsif ARGV.force_bottle?
true
# Allow prerelease versions to act as if all bottles are `_or_later`
# so that they don't need to wait for us to bottle everything for the
# new release.
elsif install_older_prerelease_bottles?
true
# 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
end
MacOS::Version.from_symbol(key_tag_version) <= tag_version
end
end

def install_older_prerelease_bottles?
return false unless OS::Mac.prerelease?
return true if ENV["HOMEBREW_INSTALL_OLDER_PRERELEASE_BOTTLES"]
return false if ENV["HOMEBREW_NO_INSTALL_OLDER_PRERELEASE_BOTTLES"]

!ARGV.homebrew_developer?
end
end
end
end