diff options
Diffstat (limited to 'Library/Homebrew/formula.rb')
| -rw-r--r-- | Library/Homebrew/formula.rb | 47 |
1 files changed, 36 insertions, 11 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index d544bd668..1230199bf 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -13,6 +13,7 @@ require "pkg_version" require "tap" require "keg" require "migrator" +require "extend/ENV" # A formula provides instructions and metadata for Homebrew to install a piece # of software. Every Homebrew formula is a {Formula}. @@ -1004,19 +1005,26 @@ class Formula def post_install; end # @private - def post_install_defined? - method(:post_install).owner == self.class - end - - # @private def run_post_install @prefix_returns_versioned_prefix = true build = self.build self.build = Tab.for_formula(self) + old_tmpdir = ENV["TMPDIR"] old_temp = ENV["TEMP"] old_tmp = ENV["TMP"] + old_path = ENV["HOMEBREW_PATH"] + ENV["TMPDIR"] = ENV["TEMP"] = ENV["TMP"] = HOMEBREW_TEMP + ENV["HOMEBREW_PATH"] = nil + + ENV.clear_sensitive_environment! + + Pathname.glob("#{bottle_prefix}/{etc,var}/**/*") do |path| + path.extend(InstallRenamed) + path.cp_path_sub(bottle_prefix, HOMEBREW_PREFIX) + end + with_logging("post_install") do post_install end @@ -1025,6 +1033,7 @@ class Formula ENV["TMPDIR"] = old_tmpdir ENV["TEMP"] = old_temp ENV["TMP"] = old_tmp + ENV["HOMEBREW_PATH"] = old_path @prefix_returns_versioned_prefix = false end @@ -1664,9 +1673,15 @@ class Formula old_temp = ENV["TEMP"] old_tmp = ENV["TMP"] old_term = ENV["TERM"] + old_path = ENV["HOMEBREW_PATH"] + ENV["CURL_HOME"] = old_curl_home || old_home ENV["TMPDIR"] = ENV["TEMP"] = ENV["TMP"] = HOMEBREW_TEMP ENV["TERM"] = "dumb" + ENV["HOMEBREW_PATH"] = nil + + ENV.clear_sensitive_environment! + mktemp("#{name}-test") do |staging| staging.retain! if ARGV.keep_tmp? @testpath = staging.tmpdir @@ -1689,6 +1704,7 @@ class Formula ENV["TEMP"] = old_temp ENV["TMP"] = old_tmp ENV["TERM"] = old_term + ENV["HOMEBREW_PATH"] = old_path @prefix_returns_versioned_prefix = false end @@ -1892,7 +1908,6 @@ class Formula def exec_cmd(cmd, args, out, logfn) ENV["HOMEBREW_CC_LOG_PATH"] = logfn - # TODO: system "xcodebuild" is deprecated, this should be removed soon. ENV.remove_cc_etc if cmd.to_s.start_with? "xcodebuild" # Turn on argument filtering in the superenv compiler wrapper. @@ -1925,17 +1940,28 @@ class Formula mkdir_p env_home old_home = ENV["HOME"] - ENV["HOME"] = env_home old_curl_home = ENV["CURL_HOME"] - ENV["CURL_HOME"] = old_curl_home || old_home + old_path = ENV["HOMEBREW_PATH"] + + unless ARGV.interactive? + ENV["HOME"] = env_home + ENV["CURL_HOME"] = old_curl_home || old_home + end + ENV["HOMEBREW_PATH"] = nil + setup_home env_home + ENV.clear_sensitive_environment! + begin yield staging ensure @buildpath = nil - ENV["HOME"] = old_home - ENV["CURL_HOME"] = old_curl_home + unless ARGV.interactive? + ENV["HOME"] = old_home + ENV["CURL_HOME"] = old_curl_home + end + ENV["HOMEBREW_PATH"] = old_path end end end @@ -2396,7 +2422,6 @@ class Formula # version '4.8.1' # end</pre> def fails_with(compiler, &block) - # TODO: deprecate this in future. # odeprecated "fails_with :llvm" if compiler == :llvm specs.each { |spec| spec.fails_with(compiler, &block) } end |
