Cleanup old bottle syntax.

This commit is contained in:
Mike McQuaid 2013-01-27 18:58:50 +00:00
parent 92a5c765a9
commit 1107171f83
6 changed files with 2 additions and 87 deletions

View File

@ -36,12 +36,10 @@ end
def bottle_file_outdated? f, file
filename = file.basename.to_s
return nil unless f and f.bottle and f.bottle.url \
and (filename.match(bottle_regex) or filename.match(old_bottle_regex))
and filename.match(bottle_regex)
bottle_ext = filename.match(bottle_native_regex).captures.first rescue nil
bottle_ext ||= filename.match(old_bottle_regex).captures.first rescue nil
bottle_url_ext = f.bottle.url.match(bottle_native_regex).captures.first rescue nil
bottle_url_ext ||= f.bottle.url.match(old_bottle_regex).captures.first rescue nil
bottle_ext && bottle_url_ext && bottle_ext != bottle_url_ext
end
@ -68,10 +66,6 @@ def bottle_regex
Pathname::BOTTLE_EXTNAME_RX
end
def old_bottle_regex
Pathname::OLD_BOTTLE_EXTNAME_RX
end
def bottle_base_url
"https://downloads.sf.net/project/machomebrew/Bottles/"
end

View File

@ -200,14 +200,6 @@ class CurlBottleDownloadStrategy < CurlDownloadStrategy
def initialize name, package
super
@tarball_path = HOMEBREW_CACHE/"#{name}-#{package.version}#{ext}"
unless @tarball_path.exist?
# Stop people redownloading bottles just because I (Mike) was stupid.
old_bottle_path = HOMEBREW_CACHE/"#{name}-#{package.version}-bottle.tar.gz"
old_bottle_path = HOMEBREW_CACHE/"#{name}-#{package.version}.#{MacOS.cat}.bottle-bottle.tar.gz" unless old_bottle_path.exist?
old_bottle_path = HOMEBREW_CACHE/"#{name}-#{package.version}-7.#{MacOS.cat}.bottle.tar.gz" unless old_bottle_path.exist? or name != "imagemagick"
FileUtils.mv old_bottle_path, @tarball_path if old_bottle_path.exist?
end
end
end
@ -622,7 +614,7 @@ class DownloadStrategyDetector
when %r[^http://www.apache.org/dyn/closer.cgi] then CurlApacheMirrorDownloadStrategy
# Common URL patterns
when %r[^https?://svn\.] then SubversionDownloadStrategy
when bottle_native_regex, bottle_regex, old_bottle_regex
when bottle_native_regex, bottle_regex
CurlBottleDownloadStrategy
# Otherwise just try to download
else CurlDownloadStrategy

View File

@ -6,7 +6,6 @@ class Pathname
include MachO
BOTTLE_EXTNAME_RX = /(\.[a-z]+\.bottle\.(\d+\.)?tar\.gz)$/
OLD_BOTTLE_EXTNAME_RX = /((\.[a-z]+)?[\.-]bottle\.tar\.gz)$/
def install *sources
results = []
@ -126,8 +125,6 @@ class Pathname
def extname
BOTTLE_EXTNAME_RX.match to_s
return $1 if $1
OLD_BOTTLE_EXTNAME_RX.match to_s
return $1 if $1
/(\.(tar|cpio)\.(gz|bz2|xz|Z))$/.match to_s
return $1 if $1
return File.extname(to_s)

View File

@ -163,38 +163,6 @@ class FormulaTests < Test::Unit::TestCase
assert !f.devel.version.detected_from_url?
end
def test_old_bottle_specs
f = OldBottleSpecTestBall.new
case MacOS.cat
when :lion
assert_instance_of Bottle, f.bottle
assert_equal CurlBottleDownloadStrategy, f.bottle.download_strategy
assert_nil f.bottle.specs
assert f.bottle.mirrors.empty?
assert_equal 'file:///foo.com/testball-0.1-bottle.tar.gz', f.bottle.url
assert_instance_of Checksum, f.bottle.checksum
assert_equal :sha1, f.bottle.checksum.hash_type
assert !f.bottle.checksum.empty?
assert_equal 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeef', f.bottle.sha1.hexdigest
assert_nil f.bottle.md5
assert_nil f.bottle.sha256
assert f.bottle.version.detected_from_url?
assert_equal 0, f.bottle.revision
assert_version_equal '0.1', f.bottle.version
else
assert_nil f.bottle
end
end
def test_ancient_bottle_specs
f = AncientBottleSpecTestBall.new
assert_nil f.bottle
end
def test_head_only_specs
f = HeadOnlySpecTestBall.new

View File

@ -219,14 +219,6 @@ class VersionParsingTests < Test::Unit::TestCase
assert_version_detected 'R15B03-1', 'https://downloads.sf.net/project/machomebrew/Bottles/erlang-R15B03-1.mountainlion.bottle.tar.gz'
end
def test_old_bottle_style
assert_version_detected '4.7.3', 'https://downloads.sf.net/project/machomebrew/Bottles/qt-4.7.3-bottle.tar.gz'
end
def test_old_erlang_bottle_style
assert_version_detected 'R15B', 'https://downloads.sf.net/project/machomebrew/Bottles/erlang-R15B-bottle.tar.gz'
end
def test_imagemagick_style
assert_version_detected '6.7.5-7', 'http://downloads.sf.net/project/machomebrew/mirror/ImageMagick-6.7.5-7.tar.bz2'
end

View File

@ -140,34 +140,6 @@ class ExplicitVersionSpecTestBall < Formula
end
end
class OldBottleSpecTestBall < Formula
homepage 'http://example.com'
url 'file:///foo.com/testball-0.1.tbz'
sha1 '482e737739d946b7c8cbaf127d9ee9c148b999f5'
bottle do
url 'file:///foo.com/testball-0.1-bottle.tar.gz'
sha1 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeef'
end
def initialize name=nil
super "oldbottlespectestball"
end
end
class AncientBottleSpecTestBall < Formula
homepage 'http://example.com'
url 'file:///foo.com/testball-0.1.tbz'
sha1 '482e737739d946b7c8cbaf127d9ee9c148b999f5'
bottle 'file:///foo.com/testball-0.1-bottle.tar.gz'
bottle_sha1 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeef'
def initialize name=nil
super "ancientbottlespectestball"
end
end
class HeadOnlySpecTestBall < Formula
homepage 'http://example.com'
head 'https://github.com/mxcl/homebrew.git'