Merge "Only mount dist dir to soong sandbox if it exists"
This commit is contained in:
@@ -79,7 +79,7 @@ func (c *Cmd) sandboxSupported() bool {
|
|||||||
sandboxConfig.outDir = absPath(c.ctx, c.config.OutDir())
|
sandboxConfig.outDir = absPath(c.ctx, c.config.OutDir())
|
||||||
sandboxConfig.distDir = absPath(c.ctx, c.config.DistDir())
|
sandboxConfig.distDir = absPath(c.ctx, c.config.DistDir())
|
||||||
|
|
||||||
cmd := exec.CommandContext(c.ctx.Context, nsjailPath,
|
sandboxArgs := []string{
|
||||||
"-H", "android-build",
|
"-H", "android-build",
|
||||||
"-e",
|
"-e",
|
||||||
"-u", "nobody",
|
"-u", "nobody",
|
||||||
@@ -88,10 +88,21 @@ func (c *Cmd) sandboxSupported() bool {
|
|||||||
"-B", sandboxConfig.srcDir,
|
"-B", sandboxConfig.srcDir,
|
||||||
"-B", "/tmp",
|
"-B", "/tmp",
|
||||||
"-B", sandboxConfig.outDir,
|
"-B", sandboxConfig.outDir,
|
||||||
"-B", sandboxConfig.distDir,
|
}
|
||||||
|
|
||||||
|
if _, err := os.Stat(sandboxConfig.distDir); !os.IsNotExist(err) {
|
||||||
|
//Mount dist dir as read-write if it already exists
|
||||||
|
sandboxArgs = append(sandboxArgs, "-B",
|
||||||
|
sandboxConfig.distDir)
|
||||||
|
}
|
||||||
|
|
||||||
|
sandboxArgs = append(sandboxArgs,
|
||||||
"--disable_clone_newcgroup",
|
"--disable_clone_newcgroup",
|
||||||
"--",
|
"--",
|
||||||
"/bin/bash", "-c", `if [ $(hostname) == "android-build" ]; then echo "Android" "Success"; else echo Failure; fi`)
|
"/bin/bash", "-c", `if [ $(hostname) == "android-build" ]; then echo "Android" "Success"; else echo Failure; fi`)
|
||||||
|
|
||||||
|
cmd := exec.CommandContext(c.ctx.Context, nsjailPath, sandboxArgs...)
|
||||||
|
|
||||||
cmd.Env = c.config.Environment().Environ()
|
cmd.Env = c.config.Environment().Environ()
|
||||||
|
|
||||||
c.ctx.Verboseln(cmd.Args)
|
c.ctx.Verboseln(cmd.Args)
|
||||||
@@ -164,9 +175,6 @@ func (c *Cmd) wrapSandbox() {
|
|||||||
//Mount out dir as read-write
|
//Mount out dir as read-write
|
||||||
"-B", sandboxConfig.outDir,
|
"-B", sandboxConfig.outDir,
|
||||||
|
|
||||||
//Mount dist dir as read-write
|
|
||||||
"-B", sandboxConfig.distDir,
|
|
||||||
|
|
||||||
// Mount a writable tmp dir
|
// Mount a writable tmp dir
|
||||||
"-B", "/tmp",
|
"-B", "/tmp",
|
||||||
|
|
||||||
@@ -178,6 +186,11 @@ func (c *Cmd) wrapSandbox() {
|
|||||||
"-q",
|
"-q",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if _, err := os.Stat(sandboxConfig.distDir); !os.IsNotExist(err) {
|
||||||
|
//Mount dist dir as read-write if it already exists
|
||||||
|
sandboxArgs = append(sandboxArgs, "-B", sandboxConfig.distDir)
|
||||||
|
}
|
||||||
|
|
||||||
if c.Sandbox.AllowBuildBrokenUsesNetwork && c.config.BuildBrokenUsesNetwork() {
|
if c.Sandbox.AllowBuildBrokenUsesNetwork && c.config.BuildBrokenUsesNetwork() {
|
||||||
c.ctx.Printf("AllowBuildBrokenUsesNetwork: %v", c.Sandbox.AllowBuildBrokenUsesNetwork)
|
c.ctx.Printf("AllowBuildBrokenUsesNetwork: %v", c.Sandbox.AllowBuildBrokenUsesNetwork)
|
||||||
c.ctx.Printf("BuildBrokenUsesNetwork: %v", c.config.BuildBrokenUsesNetwork())
|
c.ctx.Printf("BuildBrokenUsesNetwork: %v", c.config.BuildBrokenUsesNetwork())
|
||||||
|
Reference in New Issue
Block a user