From be18a816afe27ee48eef1914c1b27c51db304831 Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Wed, 27 May 2015 23:00:42 +0800 Subject: [PATCH] bottle: remove bottle_filename_formula_name --- Library/Homebrew/cmd/bottle.rb | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/Library/Homebrew/cmd/bottle.rb b/Library/Homebrew/cmd/bottle.rb index 51df4ec05d..966b137211 100644 --- a/Library/Homebrew/cmd/bottle.rb +++ b/Library/Homebrew/cmd/bottle.rb @@ -136,11 +136,6 @@ module Homebrew end filename = Bottle::Filename.create(f, bottle_tag, bottle_revision) - - if bottle_filename_formula_name(filename).empty? - return ofail "Add a new regex to bottle_version.rb to parse #{f.version} from #{filename}" - end - bottle_path = Pathname.pwd/filename prefix = HOMEBREW_PREFIX.to_s @@ -209,7 +204,10 @@ module Homebrew puts output if ARGV.include? '--rb' - File.open("#{filename.prefix}.bottle.rb", "w") { |file| file.write(output) } + File.open("#{filename.prefix}.bottle.rb", "w") do |file| + file.write("\# #{f.full_name}\n") + file.write(output) + end end end @@ -222,9 +220,9 @@ module Homebrew def merge merge_hash = {} ARGV.named.each do |argument| - formula_name = bottle_filename_formula_name argument + bottle_block = IO.read(argument) + formula_name = bottle_block.lines.first.sub(/^# /,"").chomp merge_hash[formula_name] ||= [] - bottle_block = IO.read argument merge_hash[formula_name] << bottle_block end @@ -238,13 +236,7 @@ module Homebrew puts output if ARGV.include? '--write' - tap = ARGV.value('tap') - canonical_formula_name = if tap - "#{tap}/#{formula_name}" - else - formula_name - end - f = Formulary.factory(canonical_formula_name) + f = Formulary.factory(formula_name) update_or_add = nil Utils::Inreplace.inreplace(f.path) do |s|