Allow --interactive to access HOME

This may result in a slightly varied build but it’s generally just far
less annoying to be able to access all your e.g. shell configuration.
This commit is contained in:
Mike McQuaid 2017-05-09 20:00:11 +01:00
parent f1d4c4be78
commit 7055abc436
3 changed files with 9 additions and 8 deletions

View File

@ -1943,8 +1943,10 @@ class Formula
old_curl_home = ENV["CURL_HOME"] old_curl_home = ENV["CURL_HOME"]
old_path = ENV["HOMEBREW_PATH"] old_path = ENV["HOMEBREW_PATH"]
unless ARGV.interactive?
ENV["HOME"] = env_home ENV["HOME"] = env_home
ENV["CURL_HOME"] = old_curl_home || old_home ENV["CURL_HOME"] = old_curl_home || old_home
end
ENV["HOMEBREW_PATH"] = nil ENV["HOMEBREW_PATH"] = nil
setup_home env_home setup_home env_home
@ -1955,8 +1957,10 @@ class Formula
yield staging yield staging
ensure ensure
@buildpath = nil @buildpath = nil
unless ARGV.interactive?
ENV["HOME"] = old_home ENV["HOME"] = old_home
ENV["CURL_HOME"] = old_curl_home ENV["CURL_HOME"] = old_curl_home
end
ENV["HOMEBREW_PATH"] = old_path ENV["HOMEBREW_PATH"] = old_path
end end
end end

View File

@ -664,6 +664,7 @@ class FormulaInstaller
sandbox = Sandbox.new sandbox = Sandbox.new
formula.logs.mkpath formula.logs.mkpath
sandbox.record_log(formula.logs/"build.sandbox.log") sandbox.record_log(formula.logs/"build.sandbox.log")
sandbox.allow_write_path(ENV["HOME"]) if ARGV.interactive?
sandbox.allow_write_temp_and_cache sandbox.allow_write_temp_and_cache
sandbox.allow_write_log(formula) sandbox.allow_write_log(formula)
sandbox.allow_write_xcode sandbox.allow_write_xcode

View File

@ -5,10 +5,6 @@ class Sandbox
SANDBOX_EXEC = "/usr/bin/sandbox-exec".freeze SANDBOX_EXEC = "/usr/bin/sandbox-exec".freeze
SANDBOXED_TAPS = %w[ SANDBOXED_TAPS = %w[
homebrew/core homebrew/core
homebrew/dupes
homebrew/fuse
homebrew/devel-only
homebrew/tex
].freeze ].freeze
def self.available? def self.available?