aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/bottles.rb
diff options
context:
space:
mode:
authorXu Cheng2015-05-27 22:47:19 +0800
committerXu Cheng2015-06-02 16:45:43 +0800
commit557ddcac362ac2f32c87366516879c572fa09d10 (patch)
tree3d93e9523268072034a8d9e158ec7eb3b8e32645 /Library/Homebrew/bottles.rb
parent129f780bbaca3e559cc47004550695b4b6783308 (diff)
downloadbrew-557ddcac362ac2f32c87366516879c572fa09d10.tar.bz2
new method bottle_resolve_formula_names
Also remove bottle_filename_formula_name
Diffstat (limited to 'Library/Homebrew/bottles.rb')
-rw-r--r--Library/Homebrew/bottles.rb18
1 files changed, 13 insertions, 5 deletions
diff --git a/Library/Homebrew/bottles.rb b/Library/Homebrew/bottles.rb
index c1d6225df..e49872f75 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