aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/utils
diff options
context:
space:
mode:
authorMike McQuaid2017-09-29 13:59:52 +0100
committerGitHub2017-09-29 13:59:52 +0100
commit296a44195bb8c8c0d5d9b512f10c7ee70f400efb (patch)
tree0b814ef58bd8a8476f39b84a9166e39435ac38b4 /Library/Homebrew/utils
parent978bd61f5883414d4e9813bd2456a984d0ecb0c7 (diff)
parentc19cc70ac8b87bfe93d2b94e5693584139238e23 (diff)
downloadbrew-296a44195bb8c8c0d5d9b512f10c7ee70f400efb.tar.bz2
Merge pull request #3176 from sjackman/bottle-formula
BottleLoader: Use the formula stored in the bottle
Diffstat (limited to 'Library/Homebrew/utils')
-rw-r--r--Library/Homebrew/utils/bottles.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/Library/Homebrew/utils/bottles.rb b/Library/Homebrew/utils/bottles.rb
index 927963bc1..66b5fb640 100644
--- a/Library/Homebrew/utils/bottles.rb
+++ b/Library/Homebrew/utils/bottles.rb
@@ -29,9 +29,11 @@ module Utils
end
def receipt_path(bottle_file)
- Utils.popen_read("tar", "-tzf", bottle_file).lines.map(&:chomp).find do |line|
+ path = Utils.popen_read("tar", "-tzf", bottle_file).lines.map(&:chomp).find do |line|
line =~ %r{.+/.+/INSTALL_RECEIPT.json}
end
+ raise "This bottle does not contain the file INSTALL_RECEIPT.json: #{bottle_file}" unless path
+ path
end
def resolve_formula_names(bottle_file)
@@ -52,6 +54,15 @@ module Utils
def resolve_version(bottle_file)
PkgVersion.parse receipt_path(bottle_file).split("/")[1]
end
+
+ def formula_contents(bottle_file,
+ name: resolve_formula_names(bottle_file)[0])
+ bottle_version = resolve_version bottle_file
+ formula_path = "#{name}/#{bottle_version}/.brew/#{name}.rb"
+ contents = Utils.popen_read "tar", "-xOzf", bottle_file, formula_path
+ raise BottleFormulaUnavailableError.new(bottle_file, formula_path) unless $CHILD_STATUS.success?
+ contents
+ end
end
class Bintray