Merge "Dereference paths to be mounted into soong sandbox" am: 895d5bf924

Change-Id: I608d02eca0c82c685ba225d9dbdcad92f66dcbf3
This commit is contained in:
Treehugger Robot
2020-04-16 07:18:25 +00:00
committed by Automerger Merge Worker

View File

@@ -19,6 +19,7 @@ import (
"os" "os"
"os/exec" "os/exec"
"os/user" "os/user"
"path/filepath"
"strings" "strings"
"sync" "sync"
) )
@@ -75,9 +76,20 @@ func (c *Cmd) sandboxSupported() bool {
sandboxConfig.group = "nobody" sandboxConfig.group = "nobody"
} }
// These directories will be bind mounted
// so we need full non-symlink paths
sandboxConfig.srcDir = absPath(c.ctx, ".") sandboxConfig.srcDir = absPath(c.ctx, ".")
if derefPath, err := filepath.EvalSymlinks(sandboxConfig.srcDir); err == nil {
sandboxConfig.srcDir = absPath(c.ctx, derefPath)
}
sandboxConfig.outDir = absPath(c.ctx, c.config.OutDir()) sandboxConfig.outDir = absPath(c.ctx, c.config.OutDir())
if derefPath, err := filepath.EvalSymlinks(sandboxConfig.outDir); err == nil {
sandboxConfig.outDir = absPath(c.ctx, derefPath)
}
sandboxConfig.distDir = absPath(c.ctx, c.config.DistDir()) sandboxConfig.distDir = absPath(c.ctx, c.config.DistDir())
if derefPath, err := filepath.EvalSymlinks(sandboxConfig.distDir); err == nil {
sandboxConfig.distDir = absPath(c.ctx, derefPath)
}
sandboxArgs := []string{ sandboxArgs := []string{
"-H", "android-build", "-H", "android-build",