Don't use underscores in (new) bottle filenames.
Closes Homebrew/homebrew#14270
This commit is contained in:
parent
1107171f83
commit
b58077b3e8
@ -5,7 +5,7 @@ require 'mach'
|
||||
class Pathname
|
||||
include MachO
|
||||
|
||||
BOTTLE_EXTNAME_RX = /(\.[a-z]+\.bottle\.(\d+\.)?tar\.gz)$/
|
||||
BOTTLE_EXTNAME_RX = /(\.[a-z_]+\.bottle\.(\d+\.)?tar\.gz)$/
|
||||
|
||||
def install *sources
|
||||
results = []
|
||||
|
||||
@ -40,6 +40,9 @@ class Formula
|
||||
# then a bottle is not available for the current platform.
|
||||
if @bottle and not (@bottle.checksum.nil? or @bottle.checksum.empty?)
|
||||
@bottle.url ||= bottle_base_url + bottle_filename(self)
|
||||
if @bottle.cat_without_underscores
|
||||
@bottle.url.gsub!(MacOS.cat.to_s, MacOS.cat_without_underscores.to_s)
|
||||
end
|
||||
else
|
||||
@bottle = nil
|
||||
end
|
||||
|
||||
@ -81,10 +81,13 @@ end
|
||||
class Bottle < SoftwareSpec
|
||||
attr_writer :url
|
||||
attr_reader :revision
|
||||
# TODO: Can be removed when all bottles migrated to underscored cat symbols.
|
||||
attr_reader :cat_without_underscores
|
||||
|
||||
def initialize url=nil, version=nil
|
||||
super
|
||||
@revision = 0
|
||||
@cat_without_underscores = false
|
||||
end
|
||||
|
||||
# Checksum methods in the DSL's bottle block optionally take
|
||||
@ -103,7 +106,12 @@ class Bottle < SoftwareSpec
|
||||
@#{cksum}[value] = Checksum.new(:#{cksum}, key)
|
||||
end
|
||||
|
||||
@checksum = @#{cksum}[MacOS.cat] if @#{cksum}.has_key? MacOS.cat
|
||||
if @#{cksum}.has_key? MacOS.cat
|
||||
@checksum = @#{cksum}[MacOS.cat]
|
||||
elsif @#{cksum}.has_key? MacOS.cat_without_underscores
|
||||
@checksum = @#{cksum}[MacOS.cat_without_underscores]
|
||||
@cat_without_underscores = true
|
||||
end
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
@ -8,14 +8,21 @@ module MacOS extend self
|
||||
end
|
||||
|
||||
def cat
|
||||
if version == :mountain_lion then :mountainlion
|
||||
if version == :mountain_lion then :mountain_lion
|
||||
elsif version == :lion then :lion
|
||||
elsif version == :snow_leopard then :snowleopard
|
||||
elsif version == :snow_leopard then :snow_leopard
|
||||
elsif version == :leopard then :leopard
|
||||
else nil
|
||||
end
|
||||
end
|
||||
|
||||
# TODO: Can be removed when all bottles migrated to underscored cat symbols.
|
||||
def cat_without_underscores
|
||||
possibly_underscored_cat = cat
|
||||
return nil unless possibly_underscored_cat
|
||||
cat.to_s.gsub('_', '').to_sym
|
||||
end
|
||||
|
||||
def locate tool
|
||||
# Don't call tools (cc, make, strip, etc.) directly!
|
||||
# Give the name of the binary you look for as a string to this method
|
||||
|
||||
@ -19,7 +19,7 @@ class BottleTests < Test::Unit::TestCase
|
||||
f = SnowLeopardBottleSpecTestBall.new
|
||||
|
||||
assert_equal case MacOS.cat
|
||||
when :snowleopard then f.bottle
|
||||
when :snow_leopard then f.bottle
|
||||
else f.stable
|
||||
end, f.active_spec
|
||||
|
||||
|
||||
@ -103,9 +103,9 @@ class FormulaTests < Test::Unit::TestCase
|
||||
assert_equal :sha1, f.bottle.checksum.hash_type
|
||||
assert_equal :sha256, f.devel.checksum.hash_type
|
||||
assert_equal case MacOS.cat
|
||||
when :snowleopard then 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeef'
|
||||
when :snow_leopard then 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeef'
|
||||
when :lion then 'baadf00dbaadf00dbaadf00dbaadf00dbaadf00d'
|
||||
when :mountainlion then '8badf00d8badf00d8badf00d8badf00d8badf00d'
|
||||
when :mountain_lion then '8badf00d8badf00d8badf00d8badf00d8badf00d'
|
||||
end, f.bottle.checksum.hexdigest
|
||||
assert_match /[0-9a-fA-F]{40}/, f.stable.checksum.hexdigest
|
||||
assert_match /[0-9a-fA-F]{64}/, f.devel.checksum.hexdigest
|
||||
@ -241,9 +241,9 @@ class FormulaTests < Test::Unit::TestCase
|
||||
|
||||
assert_equal 1, f.bottle.revision
|
||||
assert_equal case MacOS.cat
|
||||
when :snowleopard then 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeef'
|
||||
when :snow_leopard then 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeef'
|
||||
when :lion then 'baadf00dbaadf00dbaadf00dbaadf00dbaadf00d'
|
||||
when :mountainlion then '8badf00d8badf00d8badf00d8badf00d8badf00d'
|
||||
when :mountain_lion then '8badf00d8badf00d8badf00d8badf00d8badf00d'
|
||||
end, f.bottle.checksum.hexdigest
|
||||
end
|
||||
|
||||
|
||||
@ -212,7 +212,7 @@ class VersionParsingTests < Test::Unit::TestCase
|
||||
end
|
||||
|
||||
def test_another_erlang_bottle_style
|
||||
assert_version_detected 'R15B01', 'https://downloads.sf.net/project/machomebrew/Bottles/erlang-R15B01.mountainlion.bottle.tar.gz'
|
||||
assert_version_detected 'R15B01', 'https://downloads.sf.net/project/machomebrew/Bottles/erlang-R15B01.mountain_lion.bottle.tar.gz'
|
||||
end
|
||||
|
||||
def test_yet_another_erlang_bottle_style
|
||||
|
||||
@ -107,9 +107,9 @@ class SpecTestBall < Formula
|
||||
end
|
||||
|
||||
bottle do
|
||||
sha1 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeef' => :snowleopard
|
||||
sha1 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeef' => :snow_leopard
|
||||
sha1 'baadf00dbaadf00dbaadf00dbaadf00dbaadf00d' => :lion
|
||||
sha1 '8badf00d8badf00d8badf00d8badf00d8badf00d' => :mountainlion
|
||||
sha1 '8badf00d8badf00d8badf00d8badf00d8badf00d' => :mountain_lion
|
||||
end
|
||||
|
||||
def initialize name=nil
|
||||
@ -189,7 +189,7 @@ class SnowLeopardBottleSpecTestBall < Formula
|
||||
sha1 '482e737739d946b7c8cbaf127d9ee9c148b999f5'
|
||||
|
||||
bottle do
|
||||
sha1 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeef' => :snowleopard
|
||||
sha1 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeef' => :snow_leopard
|
||||
end
|
||||
|
||||
def initialize name=nil
|
||||
@ -217,9 +217,9 @@ class AllCatsBottleSpecTestBall < Formula
|
||||
sha1 '482e737739d946b7c8cbaf127d9ee9c148b999f5'
|
||||
|
||||
bottle do
|
||||
sha1 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeef' => :snowleopard
|
||||
sha1 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeef' => :snow_leopard
|
||||
sha1 'baadf00dbaadf00dbaadf00dbaadf00dbaadf00d' => :lion
|
||||
sha1 '8badf00d8badf00d8badf00d8badf00d8badf00d' => :mountainlion
|
||||
sha1 '8badf00d8badf00d8badf00d8badf00d8badf00d' => :mountain_lion
|
||||
end
|
||||
|
||||
def initialize name=nil
|
||||
@ -234,9 +234,9 @@ class RevisedBottleSpecTestBall < Formula
|
||||
|
||||
bottle do
|
||||
version 1
|
||||
sha1 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeef' => :snowleopard
|
||||
sha1 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeef' => :snow_leopard
|
||||
sha1 'baadf00dbaadf00dbaadf00dbaadf00dbaadf00d' => :lion
|
||||
sha1 '8badf00d8badf00d8badf00d8badf00d8badf00d' => :mountainlion
|
||||
sha1 '8badf00d8badf00d8badf00d8badf00d8badf00d' => :mountain_lion
|
||||
end
|
||||
|
||||
def initialize name=nil
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user