Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Change versioned bottle syntax and fix issues.

Fixed #11562.
  • Loading branch information...
commit 7dffb81047d8eeb1f8d03b33fcdbb6031db95525 1 parent d36b121
Mike McQuaid mikemcquaid authored committed
22 Library/Homebrew/bottles.rb
@@ -5,8 +5,7 @@ def bottle_filename f, bottle_version=nil
5 5 name = f.name.downcase
6 6 version = f.version || f.standard.detect_version
7 7 bottle_version = bottle_version || f.bottle_version
8   - bottle_version_tag = bottle_version > 0 ? "-#{bottle_version}" : ""
9   - "#{name}-#{version}#{bottle_version_tag}#{bottle_native_suffix}"
  8 + "#{name}-#{version}#{bottle_native_suffix(bottle_version)}"
10 9 end
11 10
12 11 def bottles_supported?
@@ -15,7 +14,7 @@ def bottles_supported?
15 14
16 15 def install_bottle? f
17 16 return true if ARGV.include? '--install-bottle'
18   - !ARGV.build_from_source? && bottle_current?(f)
  17 + not ARGV.build_from_source? && bottle_current?(f)
19 18 end
20 19
21 20 def built_bottle? f
@@ -23,6 +22,8 @@ def built_bottle? f
23 22 end
24 23
25 24 def bottle_current? f
  25 + puts Pathname.new(f.bottle_url).version
  26 + puts f.version
26 27 f.bottle_url && f.bottle_sha1 && Pathname.new(f.bottle_url).version == f.version
27 28 end
28 29
@@ -31,24 +32,25 @@ def bottle_new_version f
31 32 f.bottle_version + 1
32 33 end
33 34
34   -def bottle_native_suffix
35   - ".#{MacOS.cat}#{bottle_suffix}"
  35 +def bottle_native_suffix version=nil
  36 + ".#{MacOS.cat}#{bottle_suffix(version)}"
36 37 end
37 38
38   -def bottle_suffix
39   - ".bottle.tar.gz"
  39 +def bottle_suffix version=nil
  40 + version = version.to_i > 0 ? ".#{version}" : ""
  41 + ".bottle#{version}.tar.gz"
40 42 end
41 43
42 44 def bottle_native_regex
43   - /((-\d+)?\.#{MacOS.cat}\.bottle\.tar\.gz)$/
  45 + /(\.#{MacOS.cat}\.bottle\.((\d+)?\.tar\.gz))$/
44 46 end
45 47
46 48 def bottle_regex
47   - /((-\d+)?\.[a-z]+\.bottle\.tar\.gz)$/
  49 + /(\.[a-z]+\.bottle\.(\d+\.)?tar\.gz)$/
48 50 end
49 51
50 52 def old_bottle_regex
51   - /(-bottle\.tar\.gz)$/
  53 + /((\.[a-z]+)?[\.-]bottle\.tar\.gz)$/
52 54 end
53 55
54 56 def bottle_base_url
2  Library/Homebrew/download_strategy.rb
@@ -194,8 +194,10 @@ def initialize url, name, version, specs
194 194 @tarball_path = HOMEBREW_CACHE/"#{name}-#{version}#{ext}"
195 195
196 196 unless @tarball_path.exist?
  197 + # Stop people redownloading bottles just because I (Mike) was stupid.
197 198 old_bottle_path = HOMEBREW_CACHE/"#{name}-#{version}-bottle.tar.gz"
198 199 old_bottle_path = HOMEBREW_CACHE/"#{name}-#{version}.#{MacOS.cat}.bottle-bottle.tar.gz" unless old_bottle_path.exist?
  200 + old_bottle_path = HOMEBREW_CACHE/"#{name}-#{version}-7.#{MacOS.cat}.bottle.tar.gz" unless old_bottle_path.exist? or name != "imagemagick"
199 201 FileUtils.mv old_bottle_path, @tarball_path if old_bottle_path.exist?
200 202 end
201 203 end
1  Library/Homebrew/extend/pathname.rb
@@ -119,7 +119,6 @@ def cp dst
119 119 # extended to support common double extensions
120 120 def extname
121 121 return $1 if to_s =~ bottle_regex
122   - # old brew bottle style
123 122 return $1 if to_s =~ old_bottle_regex
124 123 /(\.(tar|cpio)\.(gz|bz2|xz|Z))$/.match to_s
125 124 return $1 if $1
19 Library/Homebrew/test/test_versions.rb
@@ -169,6 +169,11 @@ def test_bottle_style
169 169 '4.8.0'
170 170 end
171 171
  172 + def test_versioned_bottle_style
  173 + check 'https://downloads.sf.net/project/machomebrew/Bottles/qt-4.8.1.lion.bottle.1.tar.gz',
  174 + '4.8.1'
  175 + end
  176 +
172 177 def test_erlang_bottle_style
173 178 check 'https://downloads.sf.net/project/machomebrew/Bottles/erlang-R15B.lion.bottle.tar.gz',
174 179 'R15B'
@@ -184,9 +189,19 @@ def test_old_erlang_bottle_style
184 189 'R15B'
185 190 end
186 191
  192 + def test_imagemagick_style
  193 + check 'http://downloads.sf.net/project/machomebrew/mirror/ImageMagick-6.7.5-7.tar.bz2',
  194 + '6.7.5-7'
  195 + end
  196 +
187 197 def test_imagemagick_bottle_style
188   - check 'http://downloads.sf.net/project/machomebrew/Bottles/imagemagick-6.7.1-1-bottle.tar.gz',
189   - '6.7.1-1'
  198 + check 'https://downloads.sf.net/project/machomebrew/Bottles/imagemagick-6.7.5-7.lion.bottle.tar.gz',
  199 + '6.7.5-7'
  200 + end
  201 +
  202 + def test_imagemagick_versioned_bottle_style
  203 + check 'https://downloads.sf.net/project/machomebrew/Bottles/imagemagick-6.7.5-7.lion.bottle.1.tar.gz',
  204 + '6.7.5-7'
190 205 end
191 206
192 207 def test_dash_version_dash_style

0 comments on commit 7dffb81

Please sign in to comment.
Something went wrong with that request. Please try again.