Merge pull request #7484 from MikeMcQuaid/cleanup-sandbox
Cleanup Sandbox code
This commit is contained in:
commit
b2571d42eb
@ -91,7 +91,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
Utils.safe_fork do
|
Utils.safe_fork do
|
||||||
if Sandbox.test?
|
if Sandbox.available?
|
||||||
sandbox = Sandbox.new
|
sandbox = Sandbox.new
|
||||||
f.logs.mkpath
|
f.logs.mkpath
|
||||||
sandbox.record_log(f.logs/"test.sandbox.log")
|
sandbox.record_log(f.logs/"test.sandbox.log")
|
||||||
|
@ -753,7 +753,7 @@ class FormulaInstaller
|
|||||||
].concat(build_argv)
|
].concat(build_argv)
|
||||||
|
|
||||||
Utils.safe_fork do
|
Utils.safe_fork do
|
||||||
if Sandbox.formula?(formula)
|
if Sandbox.available?
|
||||||
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")
|
||||||
@ -922,7 +922,7 @@ class FormulaInstaller
|
|||||||
]
|
]
|
||||||
|
|
||||||
Utils.safe_fork do
|
Utils.safe_fork do
|
||||||
if Sandbox.formula?(formula)
|
if Sandbox.available?
|
||||||
sandbox = Sandbox.new
|
sandbox = Sandbox.new
|
||||||
formula.logs.mkpath
|
formula.logs.mkpath
|
||||||
sandbox.record_log(formula.logs/"postinstall.sandbox.log")
|
sandbox.record_log(formula.logs/"postinstall.sandbox.log")
|
||||||
|
@ -10,18 +10,6 @@ class Sandbox
|
|||||||
OS.mac? && File.executable?(SANDBOX_EXEC)
|
OS.mac? && File.executable?(SANDBOX_EXEC)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.formula?(_)
|
|
||||||
return false unless available?
|
|
||||||
|
|
||||||
!Homebrew.args.no_sandbox?
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.test?
|
|
||||||
return false unless available?
|
|
||||||
|
|
||||||
!Homebrew.args.no_sandbox?
|
|
||||||
end
|
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@profile = SandboxProfile.new
|
@profile = SandboxProfile.new
|
||||||
end
|
end
|
||||||
|
@ -12,16 +12,6 @@ describe Sandbox do
|
|||||||
skip "Sandbox not implemented." unless described_class.available?
|
skip "Sandbox not implemented." unless described_class.available?
|
||||||
end
|
end
|
||||||
|
|
||||||
specify "#formula?" do
|
|
||||||
f = formula { url "foo-1.0" }
|
|
||||||
expect(described_class).to be_formula(f), "Formulae should be sandboxed."
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "#test?" do
|
|
||||||
ENV.delete("HOMEBREW_NO_SANDBOX")
|
|
||||||
expect(described_class).to be_test, "Tests should be sandboxed unless --no-sandbox was passed."
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "#allow_write" do
|
specify "#allow_write" do
|
||||||
subject.allow_write file
|
subject.allow_write file
|
||||||
subject.exec "touch", file
|
subject.exec "touch", file
|
||||||
|
Loading…
x
Reference in New Issue
Block a user