Support bottles for non-Lion OSX versions.
This commit is contained in:
parent
22f908d520
commit
4a306f32f4
@ -3,7 +3,7 @@ require 'tab'
|
||||
|
||||
module Homebrew extend self
|
||||
def formula_bottle_name f
|
||||
"#{f.name}-#{f.version}-bottle.tar.gz"
|
||||
"#{f.name}-#{f.version}.#{MacOS.cat}.bottle.tar.gz"
|
||||
end
|
||||
|
||||
def bottle_formula f
|
||||
|
||||
@ -191,7 +191,7 @@ end
|
||||
class CurlBottleDownloadStrategy < CurlDownloadStrategy
|
||||
def initialize url, name, version, specs
|
||||
super
|
||||
@tarball_path = HOMEBREW_CACHE/"#{name}-#{version}.bottle#{ext}"
|
||||
@tarball_path = HOMEBREW_CACHE/"#{name}-#{version}.#{MacOS.cat}.bottle#{ext}"
|
||||
end
|
||||
def stage
|
||||
ohai "Pouring #{File.basename(@tarball_path)}"
|
||||
|
||||
@ -100,7 +100,9 @@ class Pathname
|
||||
|
||||
# extended to support common double extensions
|
||||
def extname
|
||||
return $1 if to_s =~ /(\.bottle\.tar\.gz)$/
|
||||
return $1 if to_s =~ /(\.[a-z]+\.bottle\.tar\.gz)$/
|
||||
# old brew bottle style
|
||||
return $1 if to_s =~ /(-bottle\.tar\.gz)$/
|
||||
/(\.(tar|cpio)\.(gz|bz2|xz|Z))$/.match to_s
|
||||
return $1 if $1
|
||||
return File.extname(to_s)
|
||||
@ -205,19 +207,14 @@ class Pathname
|
||||
/_((\d+\.)+\d+[abc]?)[.]orig$/.match stem
|
||||
return $1 if $1
|
||||
|
||||
# brew bottle style e.g. qt-4.7.3-bottle.tar.gz
|
||||
/-((\d+\.)*\d+(-\d)*)-bottle$/.match stem
|
||||
return $1 if $1
|
||||
|
||||
# eg. otp_src_R13B (this is erlang's style)
|
||||
# eg. astyle_1.23_macosx.tar.gz
|
||||
stem.scan(/_([^_]+)/) do |match|
|
||||
return match.first if /\d/.match $1
|
||||
end
|
||||
|
||||
# erlang bottle style, booya
|
||||
# e.g. erlang-R14B03-bottle.tar.gz
|
||||
/-([^-]+)-bottle$/.match stem
|
||||
# old erlang bottle style e.g. erlang-R14B03-bottle.tar.gz
|
||||
/-([^-]+)/.match stem
|
||||
return $1 if $1
|
||||
|
||||
nil
|
||||
|
||||
@ -64,6 +64,13 @@ class Formula
|
||||
return false
|
||||
end
|
||||
|
||||
def bottle_for_current_osx_version?
|
||||
return true if /#{MacOS.cat}\.bottle\.tar\.gz$/.match(bottle_url)
|
||||
# old brew bottle style
|
||||
return true if MacOS.lion? && /-bottle\.tar\.gz$/.match(bottle_url)
|
||||
return false
|
||||
end
|
||||
|
||||
def bottle_up_to_date?
|
||||
!bottle_url.nil? && Pathname.new(bottle_url).version == version
|
||||
end
|
||||
|
||||
@ -15,7 +15,7 @@ class FormulaInstaller
|
||||
@f = ff
|
||||
@show_header = true
|
||||
@ignore_deps = ARGV.include? '--ignore-dependencies' || ARGV.interactive?
|
||||
@install_bottle = !ARGV.build_from_source? && ff.bottle_up_to_date?
|
||||
@install_bottle = !ARGV.build_from_source? && ff.bottle_up_to_date? && ff.bottle_for_current_osx_version?
|
||||
|
||||
check_install_sanity
|
||||
end
|
||||
|
||||
@ -165,10 +165,25 @@ class VersionTests < Test::Unit::TestCase
|
||||
end
|
||||
|
||||
def test_bottle_style
|
||||
check 'https://downloads.sourceforge.net/project/machomebrew/Bottles/qt-4.7.3-bottle.tar.gz',
|
||||
check 'https://downloads.sf.net/project/machomebrew/Bottles/qt-4.8.0.lion.bottle.tar.gz',
|
||||
'4.8.0'
|
||||
end
|
||||
|
||||
def test_erlang_bottle_style
|
||||
check 'https://downloads.sf.net/project/machomebrew/Bottles/erlang-R15B.lion.bottle.tar.gz',
|
||||
'R15B'
|
||||
end
|
||||
|
||||
def test_old_bottle_style
|
||||
check 'https://downloads.sf.net/project/machomebrew/Bottles/qt-4.7.3-bottle.tar.gz',
|
||||
'4.7.3'
|
||||
end
|
||||
|
||||
def test_old_erlang_bottle_style
|
||||
check 'https://downloads.sf.net/project/machomebrew/Bottles/erlang-R15B-bottle.tar.gz',
|
||||
'R15B'
|
||||
end
|
||||
|
||||
def test_imagemagick_bottle_style
|
||||
check 'http://downloads.sf.net/project/machomebrew/Bottles/imagemagick-6.7.1-1-bottle.tar.gz',
|
||||
'6.7.1-1'
|
||||
|
||||
@ -264,6 +264,20 @@ module MacOS extend self
|
||||
MACOS_VERSION
|
||||
end
|
||||
|
||||
def cat
|
||||
if mountain_lion?
|
||||
:mountainlion
|
||||
elsif lion?
|
||||
:lion
|
||||
elsif snow_leopard?
|
||||
:snowleopard
|
||||
elsif leopard?
|
||||
:leopard
|
||||
else
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
def dev_tools_path
|
||||
@dev_tools_path ||= if File.file? "/usr/bin/cc" and File.file? "/usr/bin/make"
|
||||
# probably a safe enough assumption
|
||||
@ -491,7 +505,7 @@ module MacOS extend self
|
||||
end
|
||||
|
||||
def bottles_supported?
|
||||
lion? and HOMEBREW_PREFIX.to_s == '/usr/local' and HOMEBREW_CELLAR.to_s == '/usr/local/Cellar'
|
||||
HOMEBREW_PREFIX.to_s == '/usr/local' and HOMEBREW_CELLAR.to_s == '/usr/local/Cellar'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user