From 1107171f83ba4e6d32385613ca71f7614fc3a234 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sun, 27 Jan 2013 18:58:50 +0000 Subject: [PATCH] Cleanup old bottle syntax. --- Library/Homebrew/bottles.rb | 8 +------ Library/Homebrew/download_strategy.rb | 10 +------- Library/Homebrew/extend/pathname.rb | 3 --- Library/Homebrew/test/test_formula.rb | 32 -------------------------- Library/Homebrew/test/test_versions.rb | 8 ------- Library/Homebrew/test/testball.rb | 28 ---------------------- 6 files changed, 2 insertions(+), 87 deletions(-) diff --git a/Library/Homebrew/bottles.rb b/Library/Homebrew/bottles.rb index cc239bffc9..2be2e12d7b 100644 --- a/Library/Homebrew/bottles.rb +++ b/Library/Homebrew/bottles.rb @@ -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 diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index e4b4a51811..7f76d6f528 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -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 diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb index ae64df0c15..49aa52c048 100644 --- a/Library/Homebrew/extend/pathname.rb +++ b/Library/Homebrew/extend/pathname.rb @@ -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) diff --git a/Library/Homebrew/test/test_formula.rb b/Library/Homebrew/test/test_formula.rb index 456c81937f..a2c6940ff7 100644 --- a/Library/Homebrew/test/test_formula.rb +++ b/Library/Homebrew/test/test_formula.rb @@ -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 diff --git a/Library/Homebrew/test/test_versions.rb b/Library/Homebrew/test/test_versions.rb index b3c709fd5d..663e7c78d3 100644 --- a/Library/Homebrew/test/test_versions.rb +++ b/Library/Homebrew/test/test_versions.rb @@ -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 diff --git a/Library/Homebrew/test/testball.rb b/Library/Homebrew/test/testball.rb index f7438b21d2..4ea4027e8b 100644 --- a/Library/Homebrew/test/testball.rb +++ b/Library/Homebrew/test/testball.rb @@ -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'