Miscellaneous bottle code cleanup.
This commit is contained in:
parent
82d1310800
commit
67f78074f9
@ -1,4 +1,5 @@
|
|||||||
require 'tab'
|
require 'tab'
|
||||||
|
require 'macos'
|
||||||
require 'extend/ARGV'
|
require 'extend/ARGV'
|
||||||
|
|
||||||
def bottle_filename f, bottle_version=nil
|
def bottle_filename f, bottle_version=nil
|
||||||
@ -11,7 +12,7 @@ end
|
|||||||
def install_bottle? f
|
def install_bottle? f
|
||||||
return true if ARGV.include? '--install-bottle'
|
return true if ARGV.include? '--install-bottle'
|
||||||
not ARGV.build_from_source? \
|
not ARGV.build_from_source? \
|
||||||
and ARGV.bottles_supported? \
|
and MacOS.bottles_supported? \
|
||||||
and ARGV.used_options(f).empty? \
|
and ARGV.used_options(f).empty? \
|
||||||
and bottle_current?(f)
|
and bottle_current?(f)
|
||||||
end
|
end
|
||||||
@ -25,12 +26,15 @@ def built_as_bottle? f
|
|||||||
end
|
end
|
||||||
|
|
||||||
def bottle_current? f
|
def bottle_current? f
|
||||||
f.bottle and f.bottle.url && !f.bottle.checksum.empty? && f.bottle.version == f.stable.version
|
f.bottle and f.bottle.url \
|
||||||
|
and (not f.bottle.checksum.empty?) \
|
||||||
|
and (f.bottle.version == f.stable.version)
|
||||||
end
|
end
|
||||||
|
|
||||||
def bottle_file_outdated? f, file
|
def bottle_file_outdated? f, file
|
||||||
filename = file.basename.to_s
|
filename = file.basename.to_s
|
||||||
return nil unless (filename.match(bottle_regex) or filename.match(old_bottle_regex)) and f.bottle and f.bottle.url
|
return nil unless f.bottle and f.bottle.url \
|
||||||
|
and (filename.match(bottle_regex) or filename.match(old_bottle_regex))
|
||||||
|
|
||||||
bottle_ext = filename.match(bottle_native_regex).captures.first rescue nil
|
bottle_ext = filename.match(bottle_native_regex).captures.first rescue nil
|
||||||
bottle_ext ||= filename.match(old_bottle_regex).captures.first rescue nil
|
bottle_ext ||= filename.match(old_bottle_regex).captures.first rescue nil
|
||||||
|
|||||||
@ -51,7 +51,7 @@ module Homebrew extend self
|
|||||||
|
|
||||||
specs = []
|
specs = []
|
||||||
stable = "stable #{f.stable.version}" if f.stable
|
stable = "stable #{f.stable.version}" if f.stable
|
||||||
stable += " (bottled)" if f.bottle and bottles_supported?
|
stable += " (bottled)" if f.bottle and MacOS.bottles_supported?
|
||||||
specs << stable if stable
|
specs << stable if stable
|
||||||
specs << "devel #{f.devel.version}" if f.devel
|
specs << "devel #{f.devel.version}" if f.devel
|
||||||
specs << "HEAD" if f.head
|
specs << "HEAD" if f.head
|
||||||
|
|||||||
@ -124,16 +124,8 @@ module HomebrewArgvExtension
|
|||||||
include? '--32-bit'
|
include? '--32-bit'
|
||||||
end
|
end
|
||||||
|
|
||||||
def bottles_supported?
|
|
||||||
# Snow Leopard was the only version of OS X that supported
|
|
||||||
# both 64-bit and 32-bit processors and kernels.
|
|
||||||
(Hardware.is_64_bit? or not MacOS.snow_leopard?) \
|
|
||||||
and HOMEBREW_PREFIX.to_s == '/usr/local' \
|
|
||||||
and HOMEBREW_CELLAR.to_s == '/usr/local/Cellar' \
|
|
||||||
end
|
|
||||||
|
|
||||||
def build_bottle?
|
def build_bottle?
|
||||||
include? '--build-bottle' and bottles_supported?
|
include? '--build-bottle' and MacOS.bottles_supported?
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_from_source?
|
def build_from_source?
|
||||||
|
|||||||
@ -215,6 +215,13 @@ module MacOS extend self
|
|||||||
def pkgutil_info id
|
def pkgutil_info id
|
||||||
`pkgutil --pkg-info #{id} 2>/dev/null`.strip
|
`pkgutil --pkg-info #{id} 2>/dev/null`.strip
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def bottles_supported?
|
||||||
|
# We support bottles on all versions of OS X except 32-bit Snow Leopard.
|
||||||
|
(Hardware.is_64_bit? or not MacOS.snow_leopard?) \
|
||||||
|
and HOMEBREW_PREFIX.to_s == '/usr/local' \
|
||||||
|
and HOMEBREW_CELLAR.to_s == '/usr/local/Cellar' \
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
require 'macos/xcode'
|
require 'macos/xcode'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user