aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/bottles.rb
diff options
context:
space:
mode:
authorJack Nagel2014-03-10 14:56:02 -0500
committerJack Nagel2014-03-10 14:56:02 -0500
commit7da459874fa289d3ebe8b82693e85893499a3148 (patch)
treeba71d538df0a177113807101eeadb53a089c167d /Library/Homebrew/bottles.rb
parent97dd5f61c461e2003efaee0e4428e5e2c1245e51 (diff)
downloadbrew-7da459874fa289d3ebe8b82693e85893499a3148.tar.bz2
Make bottle implementation more generic
Diffstat (limited to 'Library/Homebrew/bottles.rb')
-rw-r--r--Library/Homebrew/bottles.rb18
1 files changed, 6 insertions, 12 deletions
diff --git a/Library/Homebrew/bottles.rb b/Library/Homebrew/bottles.rb
index fa911d200..35654cd23 100644
--- a/Library/Homebrew/bottles.rb
+++ b/Library/Homebrew/bottles.rb
@@ -3,12 +3,9 @@ require 'os/mac'
require 'extend/ARGV'
require 'bottle_version'
-def bottle_filename f, options={}
+def bottle_filename options={}
options = { :tag => bottle_tag }.merge(options)
- name = f.name.downcase
- version = PkgVersion.new(f.stable.version, f.revision)
- options[:revision] ||= f.bottle.revision.to_i if f.bottle
- "#{name}-#{version}#{bottle_native_suffix(options)}"
+ "#{options[:name]}-#{options[:version]}#{bottle_native_suffix(options)}"
end
def install_bottle? f, options={:warn=>false}
@@ -16,7 +13,8 @@ def install_bottle? f, options={:warn=>false}
return true if ARGV.force_bottle?
return false unless f.pour_bottle?
return false unless f.default_build?
- return false unless bottle_current?(f)
+ return false unless f.bottle
+
if f.bottle.cellar != :any && f.bottle.cellar != HOMEBREW_CELLAR.to_s
if options[:warn]
opoo "Building source; cellar of #{f}'s bottle is #{f.bottle.cellar}"
@@ -33,10 +31,6 @@ def built_as_bottle? f
tab.built_as_bottle
end
-def bottle_current? f
- f.bottle and f.bottle.url and not f.bottle.checksum.empty?
-end
-
def bottle_file_outdated? f, file
filename = file.basename.to_s
return nil unless f and f.bottle and f.bottle.url \
@@ -66,8 +60,8 @@ def bottle_regex
Pathname::BOTTLE_EXTNAME_RX
end
-def bottle_url f, tag=bottle_tag
- "#{f.bottle.root_url}/#{bottle_filename(f, :tag => tag)}"
+def bottle_url(root_url, filename_options={})
+ "#{root_url}/#{bottle_filename(filename_options)}"
end
def bottle_tag