aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Library/Homebrew/formula_installer.rb7
-rw-r--r--Library/Homebrew/utils/bottles.rb9
2 files changed, 15 insertions, 1 deletions
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index 4966151a3..ea4415796 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -308,7 +308,12 @@ class FormulaInstaller
clean
# Store the formula used to build the keg in the keg.
- s = formula.path.read.gsub(/ bottle do.+?end\n\n?/m, "")
+ formula_contents = if formula.local_bottle_path
+ Utils::Bottles.formula_contents formula.local_bottle_path, name: formula.name
+ else
+ formula.path.read
+ end
+ s = formula_contents.gsub(/ bottle do.+?end\n\n?/m, "")
brew_prefix = formula.prefix/".brew"
brew_prefix.mkdir
Pathname(brew_prefix/"#{formula.name}.rb").atomic_write(s)
diff --git a/Library/Homebrew/utils/bottles.rb b/Library/Homebrew/utils/bottles.rb
index 73353496a..66b5fb640 100644
--- a/Library/Homebrew/utils/bottles.rb
+++ b/Library/Homebrew/utils/bottles.rb
@@ -54,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