aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorMike McQuaid2012-08-25 13:08:24 -0700
committerMike McQuaid2012-08-25 13:08:46 -0700
commit67f78074f9fe0dc9b00bc499e8f66c069c2ab35c (patch)
treebea950e1da353ccff89db77fadc9107b0b31a73f /Library/Homebrew
parent82d1310800dc225e8c561fb07c76a1e85434fdd4 (diff)
downloadbrew-67f78074f9fe0dc9b00bc499e8f66c069c2ab35c.tar.bz2
Miscellaneous bottle code cleanup.
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/bottles.rb10
-rw-r--r--Library/Homebrew/cmd/info.rb2
-rw-r--r--Library/Homebrew/extend/ARGV.rb10
-rw-r--r--Library/Homebrew/macos.rb7
4 files changed, 16 insertions, 13 deletions
diff --git a/Library/Homebrew/bottles.rb b/Library/Homebrew/bottles.rb
index 7d725ccb7..2d5fa6aa0 100644
--- a/Library/Homebrew/bottles.rb
+++ b/Library/Homebrew/bottles.rb
@@ -1,4 +1,5 @@
require 'tab'
+require 'macos'
require 'extend/ARGV'
def bottle_filename f, bottle_version=nil
@@ -11,7 +12,7 @@ end
def install_bottle? f
return true if ARGV.include? '--install-bottle'
not ARGV.build_from_source? \
- and ARGV.bottles_supported? \
+ and MacOS.bottles_supported? \
and ARGV.used_options(f).empty? \
and bottle_current?(f)
end
@@ -25,12 +26,15 @@ def built_as_bottle? f
end
def bottle_current? f
- f.bottle and f.bottle.url && !f.bottle.checksum.empty? && f.bottle.version == f.stable.version
+ f.bottle and f.bottle.url \
+ and (not f.bottle.checksum.empty?) \
+ and (f.bottle.version == f.stable.version)
end
def bottle_file_outdated? f, file
filename = file.basename.to_s
- return nil unless (filename.match(bottle_regex) or filename.match(old_bottle_regex)) and f.bottle and f.bottle.url
+ return nil unless f.bottle and f.bottle.url \
+ and (filename.match(bottle_regex) or filename.match(old_bottle_regex))
bottle_ext = filename.match(bottle_native_regex).captures.first rescue nil
bottle_ext ||= filename.match(old_bottle_regex).captures.first rescue nil
diff --git a/Library/Homebrew/cmd/info.rb b/Library/Homebrew/cmd/info.rb
index b9de91dbd..c9040eac6 100644
--- a/Library/Homebrew/cmd/info.rb
+++ b/Library/Homebrew/cmd/info.rb
@@ -51,7 +51,7 @@ module Homebrew extend self
specs = []
stable = "stable #{f.stable.version}" if f.stable
- stable += " (bottled)" if f.bottle and bottles_supported?
+ stable += " (bottled)" if f.bottle and MacOS.bottles_supported?
specs << stable if stable
specs << "devel #{f.devel.version}" if f.devel
specs << "HEAD" if f.head
diff --git a/Library/Homebrew/extend/ARGV.rb b/Library/Homebrew/extend/ARGV.rb
index 4d8663394..694850df2 100644
--- a/Library/Homebrew/extend/ARGV.rb
+++ b/Library/Homebrew/extend/ARGV.rb
@@ -124,16 +124,8 @@ module HomebrewArgvExtension
include? '--32-bit'
end
- def bottles_supported?
- # Snow Leopard was the only version of OS X that supported
- # both 64-bit and 32-bit processors and kernels.
- (Hardware.is_64_bit? or not MacOS.snow_leopard?) \
- and HOMEBREW_PREFIX.to_s == '/usr/local' \
- and HOMEBREW_CELLAR.to_s == '/usr/local/Cellar' \
- end
-
def build_bottle?
- include? '--build-bottle' and bottles_supported?
+ include? '--build-bottle' and MacOS.bottles_supported?
end
def build_from_source?
diff --git a/Library/Homebrew/macos.rb b/Library/Homebrew/macos.rb
index 4979956ab..933070c9f 100644
--- a/Library/Homebrew/macos.rb
+++ b/Library/Homebrew/macos.rb
@@ -215,6 +215,13 @@ module MacOS extend self
def pkgutil_info id
`pkgutil --pkg-info #{id} 2>/dev/null`.strip
end
+
+ def bottles_supported?
+ # We support bottles on all versions of OS X except 32-bit Snow Leopard.
+ (Hardware.is_64_bit? or not MacOS.snow_leopard?) \
+ and HOMEBREW_PREFIX.to_s == '/usr/local' \
+ and HOMEBREW_CELLAR.to_s == '/usr/local/Cellar' \
+ end
end
require 'macos/xcode'