From 360af367a816fa2f7b736a270decdd0626f02f22 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sat, 9 Feb 2013 19:06:54 -0800 Subject: Cleanup bottle DSL. * Remove legacy url syntax. * Use revision instead of version. Signed-off-by: Mike McQuaid --- Library/Homebrew/bottles.rb | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'Library/Homebrew/bottles.rb') diff --git a/Library/Homebrew/bottles.rb b/Library/Homebrew/bottles.rb index 88cfc5830..d474a6f65 100644 --- a/Library/Homebrew/bottles.rb +++ b/Library/Homebrew/bottles.rb @@ -2,22 +2,25 @@ require 'tab' require 'macos' require 'extend/ARGV' -def bottle_filename f, bottle_version=nil +def bottle_filename f, bottle_revision=nil name = f.name.downcase version = f.stable.version - bottle_version ||= f.bottle.revision.to_i - "#{name}-#{version}#{bottle_native_suffix(bottle_version)}" + bottle_revision ||= f.bottle.revision.to_i + "#{name}-#{version}#{bottle_native_suffix(bottle_revision)}" end def install_bottle? f 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? \ - and MacOS.bottles_supported? \ - and f.pour_bottle? \ - and f.build.used_options.empty? \ - and bottle_current?(f) + + return false if ARGV.build_from_source? + return false unless MacOS.bottles_supported? + return false unless f.pour_bottle? + return false unless f.build.used_options.empty? + return false unless bottle_current?(f) + + true end def built_as_bottle? f @@ -45,18 +48,18 @@ def bottle_file_outdated? f, file bottle_ext && bottle_url_ext && bottle_ext != bottle_url_ext end -def bottle_new_version f +def bottle_new_revision f return 0 unless bottle_current? f f.bottle.revision + 1 end -def bottle_native_suffix version=nil - ".#{MacOS.cat}#{bottle_suffix(version)}" +def bottle_native_suffix revision=nil + ".#{MacOS.cat}#{bottle_suffix(revision)}" end -def bottle_suffix version=nil - version = version.to_i > 0 ? ".#{version}" : "" - ".bottle#{version}.tar.gz" +def bottle_suffix revision=nil + revision = revision.to_i > 0 ? ".#{revision}" : "" + ".bottle#{revision}.tar.gz" end def bottle_native_regex -- cgit v1.2.3