diff --git a/Library/Homebrew/bottles.rb b/Library/Homebrew/bottles.rb index c1d6225df6..e49872f75f 100644 --- a/Library/Homebrew/bottles.rb +++ b/Library/Homebrew/bottles.rb @@ -38,11 +38,19 @@ def bottle_tag end end -def bottle_filename_formula_name filename - path = Pathname.new filename - version = BottleVersion.parse(path).to_s - basename = path.basename.to_s - basename.rpartition("-#{version}").first +def bottle_resolve_formula_names bottle_file + receipt_file_path = Utils.popen_read("tar", "-tzf", bottle_file, "*/*/INSTALL_RECEIPT.json").chomp + receipt_file = Utils.popen_read("tar", "-xOzf", bottle_file, receipt_file_path) + name = receipt_file_path.split("/").first + tap = Tab.from_file_content(receipt_file, "#{bottle_file}/#{receipt_file_path}").tap + + if tap.nil? || tap == "Homebrew/homebrew" || tap == "mxcl/master" + full_name = name + else + full_name = "#{tap.sub("homebrew-", "")}/#{name}" + end + + [name, full_name] end class Bintray