diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb index e980466da1c538cdd27f237af72dc011f6100eeb..5f4af55a2aaec7d0d803ccfd0a0da871d83d6fd8 100755 --- a/Library/Homebrew/cmd/audit.rb +++ b/Library/Homebrew/cmd/audit.rb @@ -290,7 +290,7 @@ module Homebrew extend self ff.each do |f| problems = [] - if f.unstable and f.stable.nil? + if f.unstable and f.standard.nil? problems += [' * head-only formula'] end @@ -314,6 +314,12 @@ module Homebrew extend self problems += [' * invalid or missing version'] if f.version.to_s.empty? + problems << " * 'devel' block found before stable 'url'" if text =~ /devel.+(url '.+').+(url '.+')/m + + problems << " * 'devel' block found before 'head'" if text =~ /devel.+(head '.+')/m + + problems << " * Empty 'devel' block found" if text =~ /devel do\s+end/ + # Don't try remaining audits on text in __END__ text_without_patch = (text.split("__END__")[0]).strip() diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index 735db6107c54806b6b30dc28aef5d4e6a7797446..779482b7c573e5ed3c8d27921fd5720c60ff1b83 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -89,7 +89,7 @@ module Homebrew extend self next if f.installed? unless ARGV.force? # Building head-only without --HEAD is an error - if not ARGV.build_head? and f.stable.nil? + if not ARGV.build_head? and f.standard.nil? raise "This is a head-only formula; install with `brew install --HEAD #{f.name}`" end diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index b4763f8fb00d2b4e6cc928a46b1026895e1106f4..bae651bd3a37954553a3c124f480295a00181c30 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -100,19 +100,19 @@ class Formula include FileUtils attr_reader :name, :path, :url, :version, :homepage, :specs, :downloader - attr_reader :stable, :unstable - attr_reader :bottle, :bottle_sha1, :head + attr_reader :standard, :unstable + attr_reader :bottle_url, :bottle_sha1, :head # Homebrew determines the name def initialize name='__UNKNOWN__', path=nil set_instance_variable 'homepage' set_instance_variable 'url' - set_instance_variable 'bottle' + set_instance_variable 'bottle_url' set_instance_variable 'bottle_sha1' set_instance_variable 'head' set_instance_variable 'specs' - set_instance_variable 'stable' + set_instance_variable 'standard' set_instance_variable 'unstable' if @head and (not @url or ARGV.build_head?) @@ -120,10 +120,10 @@ class Formula @version = 'HEAD' @spec_to_use = @unstable else - if @stable.nil? + if @standard.nil? @spec_to_use = SoftwareSpecification.new(@url, @specs) else - @spec_to_use = @stable + @spec_to_use = @standard end end @@ -583,7 +583,7 @@ private downloader = @downloader # Don't attempt mirrors if this install is not pointed at a "stable" URL. # This can happen when options like `--HEAD` are invoked. - mirror_list = @spec_to_use == @stable ? mirrors : [] + mirror_list = @spec_to_use == @standard ? mirrors : [] # Ensure the cache exists HOMEBREW_CACHE.mkpath @@ -731,7 +731,7 @@ EOF class << self # The methods below define the formula DSL. - attr_reader :stable, :unstable + attr_reader :standard, :unstable def self.attr_rw(*attrs) attrs.each do |attr| @@ -745,7 +745,7 @@ EOF attr_rw :version, :homepage, :mirrors, :specs, :deps, :external_deps attr_rw :keg_only_reason, :fails_with_llvm_reason, :skip_clean_all - attr_rw :bottle, :bottle_sha1 + attr_rw :bottle_url, :bottle_sha1 attr_rw(*CHECKSUM_TYPES) def head val=nil, specs=nil @@ -757,11 +757,35 @@ EOF def url val=nil, specs=nil return @url if val.nil? - @stable = SoftwareSpecification.new(val, specs) + @standard = SoftwareSpecification.new(val, specs) @url = val @specs = specs end + def stable &block + raise "url and md5 must be specified in a block" unless block_given? + instance_eval &block unless ARGV.build_devel? or ARGV.build_head? + end + + def devel &block + raise "url and md5 must be specified in a block" unless block_given? + instance_eval &block if ARGV.build_devel? + end + + def bottle url=nil, &block + if block_given? + eval <<-EOCLASS + module BottleData + def self.url url; @url = url; end + def self.sha1 sha1; @sha1 = sha1; end + def self.return_data; [@url,@sha1]; end + end + EOCLASS + BottleData.instance_eval &block + @bottle_url, @bottle_sha1 = BottleData.return_data + end + end + def mirror val, specs=nil @mirrors ||= [] @mirrors << {:url => val, :specs => specs} diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index deee2b9563b9ddc8c2b01f6615d98bf10984e1f1..c5f0f999e596e7463ec062b6c1a2c3e699e153ae 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -15,8 +15,8 @@ class FormulaInstaller @f = ff @show_header = true @ignore_deps = ARGV.include? '--ignore-dependencies' || ARGV.interactive? - @install_bottle = !ff.bottle.nil? && !ARGV.build_from_source? && - Pathname.new(ff.bottle).version == ff.version + @install_bottle = !ff.bottle_url.nil? && !ARGV.build_from_source? && + Pathname.new(ff.bottle_url).version == ff.version end def install @@ -189,7 +189,7 @@ class FormulaInstaller def pour HOMEBREW_CACHE.mkpath - downloader = CurlBottleDownloadStrategy.new f.bottle, f.name, f.version, nil + downloader = CurlBottleDownloadStrategy.new f.bottle_url, f.name, f.version, nil downloader.fetch f.verify_download_integrity downloader.tarball_path, f.bottle_sha1, "SHA1" HOMEBREW_CELLAR.cd do