aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorMike McQuaid2012-04-17 12:51:31 -0500
committerMike McQuaid2012-04-24 18:08:14 +1000
commit40370e05bdd00b2ee5526a78e39eed7e61ae00ae (patch)
tree743348a1d4755ff6364d3b96acdaecf89921a921 /Library/Homebrew
parent2c46c4e0c2c109ae2aac3cd9a245d88eeba03cb3 (diff)
downloadbrew-40370e05bdd00b2ee5526a78e39eed7e61ae00ae.tar.bz2
Change versioned bottle syntax and fix issues.
Fixed Homebrew/homebrew#11562.
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/bottles.rb22
-rw-r--r--Library/Homebrew/download_strategy.rb2
-rw-r--r--Library/Homebrew/extend/pathname.rb1
-rw-r--r--Library/Homebrew/test/test_versions.rb19
4 files changed, 31 insertions, 13 deletions
diff --git a/Library/Homebrew/bottles.rb b/Library/Homebrew/bottles.rb
index 739f601c5..0cd1f7bf2 100644
--- a/Library/Homebrew/bottles.rb
+++ b/Library/Homebrew/bottles.rb
@@ -5,8 +5,7 @@ def bottle_filename f, bottle_version=nil
name = f.name.downcase
version = f.version || f.standard.detect_version
bottle_version = bottle_version || f.bottle_version
- bottle_version_tag = bottle_version > 0 ? "-#{bottle_version}" : ""
- "#{name}-#{version}#{bottle_version_tag}#{bottle_native_suffix}"
+ "#{name}-#{version}#{bottle_native_suffix(bottle_version)}"
end
def bottles_supported?
@@ -15,7 +14,7 @@ end
def install_bottle? f
return true if ARGV.include? '--install-bottle'
- !ARGV.build_from_source? && bottle_current?(f)
+ not ARGV.build_from_source? && bottle_current?(f)
end
def built_bottle? f
@@ -23,6 +22,8 @@ def built_bottle? f
end
def bottle_current? f
+ puts Pathname.new(f.bottle_url).version
+ puts f.version
f.bottle_url && f.bottle_sha1 && Pathname.new(f.bottle_url).version == f.version
end
@@ -31,24 +32,25 @@ def bottle_new_version f
f.bottle_version + 1
end
-def bottle_native_suffix
- ".#{MacOS.cat}#{bottle_suffix}"
+def bottle_native_suffix version=nil
+ ".#{MacOS.cat}#{bottle_suffix(version)}"
end
-def bottle_suffix
- ".bottle.tar.gz"
+def bottle_suffix version=nil
+ version = version.to_i > 0 ? ".#{version}" : ""
+ ".bottle#{version}.tar.gz"
end
def bottle_native_regex
- /((-\d+)?\.#{MacOS.cat}\.bottle\.tar\.gz)$/
+ /(\.#{MacOS.cat}\.bottle\.((\d+)?\.tar\.gz))$/
end
def bottle_regex
- /((-\d+)?\.[a-z]+\.bottle\.tar\.gz)$/
+ /(\.[a-z]+\.bottle\.(\d+\.)?tar\.gz)$/
end
def old_bottle_regex
- /(-bottle\.tar\.gz)$/
+ /((\.[a-z]+)?[\.-]bottle\.tar\.gz)$/
end
def bottle_base_url
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb
index 4c510db99..3a68a2541 100644
--- a/Library/Homebrew/download_strategy.rb
+++ b/Library/Homebrew/download_strategy.rb
@@ -194,8 +194,10 @@ class CurlBottleDownloadStrategy < CurlDownloadStrategy
@tarball_path = HOMEBREW_CACHE/"#{name}-#{version}#{ext}"
unless @tarball_path.exist?
+ # Stop people redownloading bottles just because I (Mike) was stupid.
old_bottle_path = HOMEBREW_CACHE/"#{name}-#{version}-bottle.tar.gz"
old_bottle_path = HOMEBREW_CACHE/"#{name}-#{version}.#{MacOS.cat}.bottle-bottle.tar.gz" unless old_bottle_path.exist?
+ old_bottle_path = HOMEBREW_CACHE/"#{name}-#{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
diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb
index 454afb074..d705bc2f9 100644
--- a/Library/Homebrew/extend/pathname.rb
+++ b/Library/Homebrew/extend/pathname.rb
@@ -119,7 +119,6 @@ class Pathname
# extended to support common double extensions
def extname
return $1 if to_s =~ bottle_regex
- # old brew bottle style
return $1 if to_s =~ old_bottle_regex
/(\.(tar|cpio)\.(gz|bz2|xz|Z))$/.match to_s
return $1 if $1
diff --git a/Library/Homebrew/test/test_versions.rb b/Library/Homebrew/test/test_versions.rb
index 44058b70a..4c9b70045 100644
--- a/Library/Homebrew/test/test_versions.rb
+++ b/Library/Homebrew/test/test_versions.rb
@@ -169,6 +169,11 @@ class VersionTests < Test::Unit::TestCase
'4.8.0'
end
+ def test_versioned_bottle_style
+ check 'https://downloads.sf.net/project/machomebrew/Bottles/qt-4.8.1.lion.bottle.1.tar.gz',
+ '4.8.1'
+ end
+
def test_erlang_bottle_style
check 'https://downloads.sf.net/project/machomebrew/Bottles/erlang-R15B.lion.bottle.tar.gz',
'R15B'
@@ -184,9 +189,19 @@ class VersionTests < Test::Unit::TestCase
'R15B'
end
+ def test_imagemagick_style
+ check 'http://downloads.sf.net/project/machomebrew/mirror/ImageMagick-6.7.5-7.tar.bz2',
+ '6.7.5-7'
+ 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'
+ check 'https://downloads.sf.net/project/machomebrew/Bottles/imagemagick-6.7.5-7.lion.bottle.tar.gz',
+ '6.7.5-7'
+ end
+
+ def test_imagemagick_versioned_bottle_style
+ check 'https://downloads.sf.net/project/machomebrew/Bottles/imagemagick-6.7.5-7.lion.bottle.1.tar.gz',
+ '6.7.5-7'
end
def test_dash_version_dash_style