diff options
| author | Mike McQuaid | 2012-12-04 12:06:02 +0000 |
|---|---|---|
| committer | Mike McQuaid | 2012-12-04 12:06:02 +0000 |
| commit | 4b0e663c2c36db0870688e99fc8a28a758968021 (patch) | |
| tree | 7cb9f88d2432306c3d510be9b3d88a05d2357beb /Library | |
| parent | 5d7940228ed11ccb7641c3d6d5b66e7dc2e5ef34 (diff) | |
| download | brew-4b0e663c2c36db0870688e99fc8a28a758968021.tar.bz2 | |
Improve bottle error messages.
On installation or creation of a bottle error out of the current
machine does not support bottles.
References Homebrew/homebrew#16291.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/bottles.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/extend/ARGV.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/macos.rb | 21 |
3 files changed, 19 insertions, 6 deletions
diff --git a/Library/Homebrew/bottles.rb b/Library/Homebrew/bottles.rb index ae8422e25..49d0f7539 100644 --- a/Library/Homebrew/bottles.rb +++ b/Library/Homebrew/bottles.rb @@ -10,7 +10,7 @@ def bottle_filename f, bottle_version=nil end def install_bottle? f - return true if ARGV.include? '--install-bottle' + return true if ARGV.include? '--install-bottle' and MacOS.bottles_supported?(true) return true if f.downloader and defined? f.downloader.local_bottle_path \ and f.downloader.local_bottle_path not ARGV.build_from_source? \ diff --git a/Library/Homebrew/extend/ARGV.rb b/Library/Homebrew/extend/ARGV.rb index a871559da..eb995bf28 100644 --- a/Library/Homebrew/extend/ARGV.rb +++ b/Library/Homebrew/extend/ARGV.rb @@ -130,7 +130,7 @@ module HomebrewArgvExtension end def build_bottle? - include? '--build-bottle' and MacOS.bottles_supported? + include? '--build-bottle' and MacOS.bottles_supported?(true) end def build_from_source? diff --git a/Library/Homebrew/macos.rb b/Library/Homebrew/macos.rb index c662b953c..8cc8de2d2 100644 --- a/Library/Homebrew/macos.rb +++ b/Library/Homebrew/macos.rb @@ -228,11 +228,24 @@ module MacOS extend self `/usr/sbin/pkgutil --pkg-info "#{id}" 2>/dev/null`.strip end - def bottles_supported? + def bottles_supported? raise_if_failed=false # We support bottles on all versions of OS X except 32-bit Snow Leopard. - (Hardware.is_64_bit? or not MacOS.version >= :snow_leopard) \ - and HOMEBREW_PREFIX.to_s == '/usr/local' \ - and HOMEBREW_CELLAR.to_s == '/usr/local/Cellar' \ + unless Hardware.is_64_bit? or MacOS.version >= :snow_leopard + return false unless raise_if_failed + raise "Bottles are not supported on 32-bit Snow Leopard." + end + + unless HOMEBREW_PREFIX.to_s == '/usr/local' + return false unless raise_if_failed + raise "Bottles are only supported with a /usr/local prefix." + end + + unless HOMEBREW_CELLAR.to_s == '/usr/local/Cellar' + return false unless raise_if_failed + raise "Bottles are only supported with a /usr/local/Cellar cellar." + end + + true end end |
