Decouple bottle tags from MacOS.cat
This commit is contained in:
parent
159b9d8e2d
commit
79a769215f
@ -54,7 +54,7 @@ def bottle_new_revision f
|
||||
end
|
||||
|
||||
def bottle_native_suffix revision=nil
|
||||
".#{MacOS.cat}#{bottle_suffix(revision)}"
|
||||
".#{bottle_tag}#{bottle_suffix(revision)}"
|
||||
end
|
||||
|
||||
def bottle_suffix revision=nil
|
||||
@ -63,7 +63,7 @@ def bottle_suffix revision=nil
|
||||
end
|
||||
|
||||
def bottle_native_regex
|
||||
/(\.#{MacOS.cat}\.bottle\.(\d+\.)?tar\.gz)$/o
|
||||
/(\.#{bottle_tag}\.bottle\.(\d+\.)?tar\.gz)$/o
|
||||
end
|
||||
|
||||
def bottle_regex
|
||||
@ -78,3 +78,14 @@ end
|
||||
def bottle_url f
|
||||
"#{bottle_root_url(f)}/#{bottle_filename(f)}"
|
||||
end
|
||||
|
||||
def bottle_tag
|
||||
case MacOS.version
|
||||
when 10.8, 10.7, 10.5
|
||||
MacOS.cat
|
||||
when 10.6
|
||||
Hardware.is_64_bit? ? :snow_leopard : :snow_leopard_32
|
||||
else
|
||||
Hardware::CPU.type == :ppc ? Hardware::CPU.family : MacOS.cat
|
||||
end
|
||||
end
|
||||
|
||||
@ -66,7 +66,7 @@ module Homebrew extend self
|
||||
puts " prefix #{prefix}" if prefix
|
||||
puts " cellar #{cellar}" if cellar
|
||||
puts " revision #{bottle_revision}" if bottle_revision > 0
|
||||
puts " sha1 '#{sha1}' => :#{MacOS.cat}"
|
||||
puts " sha1 '#{sha1}' => :#{bottle_tag}"
|
||||
puts "end"
|
||||
end
|
||||
end
|
||||
|
||||
@ -98,8 +98,8 @@ class Bottle < SoftwareSpec
|
||||
@#{cksum}[value] = Checksum.new(:#{cksum}, key)
|
||||
end
|
||||
|
||||
if @#{cksum}.has_key? MacOS.cat
|
||||
@checksum = @#{cksum}[MacOS.cat]
|
||||
if @#{cksum}.has_key? bottle_tag
|
||||
@checksum = @#{cksum}[bottle_tag]
|
||||
end
|
||||
end
|
||||
EOS
|
||||
|
||||
@ -10,21 +10,12 @@ module MacOS extend self
|
||||
end
|
||||
|
||||
def cat
|
||||
@cat ||= uncached_cat
|
||||
end
|
||||
|
||||
def uncached_cat
|
||||
case MacOS.version
|
||||
when 10.8
|
||||
:mountain_lion
|
||||
when 10.7
|
||||
:lion
|
||||
when 10.6
|
||||
Hardware.is_64_bit? ? :snow_leopard : :snow_leopard_32
|
||||
when 10.5
|
||||
:leopard
|
||||
else
|
||||
Hardware::CPU.family if Hardware::CPU.type == :ppc
|
||||
when 10.8 then :mountain_lion
|
||||
when 10.7 then :lion
|
||||
when 10.6 then :snow_leopard
|
||||
when 10.5 then :leopard
|
||||
when 10.4 then :tiger
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
44
Library/Homebrew/test/test_bottle_tag.rb
Normal file
44
Library/Homebrew/test/test_bottle_tag.rb
Normal file
@ -0,0 +1,44 @@
|
||||
require 'testing_env'
|
||||
require 'bottles'
|
||||
|
||||
class BottleTagTests < Test::Unit::TestCase
|
||||
def test_cat_tiger_ppc
|
||||
MacOS.stubs(:version).returns(MacOS::Version.new(10.4))
|
||||
Hardware::CPU.stubs(:type).returns(:ppc)
|
||||
Hardware::CPU.stubs(:family).returns(:foo)
|
||||
assert_equal :foo, bottle_tag
|
||||
end
|
||||
|
||||
def test_cat_tiger_intel
|
||||
MacOS.stubs(:version).returns(MacOS::Version.new(10.4))
|
||||
Hardware::CPU.stubs(:type).returns(:intel)
|
||||
assert_equal :tiger, bottle_tag
|
||||
end
|
||||
|
||||
def test_cat_leopard
|
||||
MacOS.stubs(:version).returns(MacOS::Version.new(10.5))
|
||||
assert_equal :leopard, bottle_tag
|
||||
end
|
||||
|
||||
def test_cat_snow_leopard_32
|
||||
MacOS.stubs(:version).returns(MacOS::Version.new(10.6))
|
||||
Hardware.stubs(:is_64_bit?).returns(false)
|
||||
assert_equal :snow_leopard_32, bottle_tag
|
||||
end
|
||||
|
||||
def test_cat_snow_leopard_64
|
||||
MacOS.stubs(:version).returns(MacOS::Version.new(10.6))
|
||||
Hardware.stubs(:is_64_bit?).returns(true)
|
||||
assert_equal :snow_leopard, bottle_tag
|
||||
end
|
||||
|
||||
def test_cat_lion
|
||||
MacOS.stubs(:version).returns(MacOS::Version.new(10.7))
|
||||
assert_equal :lion, bottle_tag
|
||||
end
|
||||
|
||||
def test_cat_mountain_lion
|
||||
MacOS.stubs(:version).returns(MacOS::Version.new(10.8))
|
||||
assert_equal :mountain_lion, bottle_tag
|
||||
end
|
||||
end
|
||||
@ -39,38 +39,4 @@ class MacOSVersionTests < Test::Unit::TestCase
|
||||
assert_operator @v, :===, Version.new(10.7)
|
||||
assert_operator @v, :<, Version.new(10.8)
|
||||
end
|
||||
|
||||
def test_cat_tiger
|
||||
MacOS.stubs(:version).returns(MacOS::Version.new(10.4))
|
||||
Hardware::CPU.stubs(:type).returns(:ppc)
|
||||
Hardware::CPU.stubs(:family).returns(:foo)
|
||||
assert_equal :foo, MacOS.uncached_cat
|
||||
end
|
||||
|
||||
def test_cat_leopard
|
||||
MacOS.stubs(:version).returns(MacOS::Version.new(10.5))
|
||||
assert_equal :leopard, MacOS.uncached_cat
|
||||
end
|
||||
|
||||
def test_cat_snow_leopard_32
|
||||
MacOS.stubs(:version).returns(MacOS::Version.new(10.6))
|
||||
Hardware.stubs(:is_64_bit?).returns(false)
|
||||
assert_equal :snow_leopard_32, MacOS.uncached_cat
|
||||
end
|
||||
|
||||
def test_cat_snow_leopard_64
|
||||
MacOS.stubs(:version).returns(MacOS::Version.new(10.6))
|
||||
Hardware.stubs(:is_64_bit?).returns(true)
|
||||
assert_equal :snow_leopard, MacOS.uncached_cat
|
||||
end
|
||||
|
||||
def test_cat_lion
|
||||
MacOS.stubs(:version).returns(MacOS::Version.new(10.7))
|
||||
assert_equal :lion, MacOS.uncached_cat
|
||||
end
|
||||
|
||||
def test_cat_mountain_lion
|
||||
MacOS.stubs(:version).returns(MacOS::Version.new(10.8))
|
||||
assert_equal :mountain_lion, MacOS.uncached_cat
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user