From cd522b171933edd8136ae5ad2bd3bc706dfdbe02 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Fri, 6 Feb 2015 22:36:53 -0500 Subject: [PATCH] Always respect build options when invoking post_install Fixes Homebrew/homebrew#36335. --- Library/Homebrew/cmd/postinstall.rb | 2 +- Library/Homebrew/formula.rb | 6 ++++++ Library/Homebrew/formula_installer.rb | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/cmd/postinstall.rb b/Library/Homebrew/cmd/postinstall.rb index 52a2c1d470..8e145d3fde 100644 --- a/Library/Homebrew/cmd/postinstall.rb +++ b/Library/Homebrew/cmd/postinstall.rb @@ -1,5 +1,5 @@ module Homebrew def postinstall - ARGV.formulae.each {|f| f.post_install } + ARGV.formulae.each { |f| f.run_post_install } end end diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index dd90d72eea..867b7689db 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -347,6 +347,12 @@ class Formula method(:post_install).owner == self.class end + # @private + def run_post_install + self.build = Tab.for_formula(self) + post_install + end + # tell the user about any caveats regarding this package, return a string def caveats; nil end diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 46a1345ce0..5ef6660fd5 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -594,7 +594,7 @@ class FormulaInstaller end def post_install - formula.post_install + formula.run_post_install rescue Exception => e opoo "The post-install step did not complete successfully" puts "You can try again using `brew postinstall #{formula.name}`"