Use __SBOX_OUT_DIR__ in sbox output file list
The path to the output directory may be arbitrarily long, use __SBOX_OUT_DIR__ in the list of output files passed to sbox to avoid expanding it multiple times in the command line. Fixes: ninja: fatal: posix_spawn: Argument list too long 09:40:14 ninja failed with: exit status 1 when building libchrome with a long OUT or OUT_DIR_COMMON_BASE. Bug: 73726635 Test: m checkbuild Change-Id: I59024b2164287c8e531711afd9273b692ce9c28a
This commit is contained in:
@@ -136,14 +136,11 @@ func run() error {
|
||||
|
||||
tempDir, err := ioutil.TempDir(sandboxesRoot, "sbox")
|
||||
|
||||
// Rewrite output file paths to be relative to output root
|
||||
// This facilitates matching them up against the corresponding paths in the temporary directory in case they're absolute
|
||||
for i, filePath := range outputsVarEntries {
|
||||
relativePath, err := filepath.Rel(outputRoot, filePath)
|
||||
if err != nil {
|
||||
return err
|
||||
if !strings.HasPrefix(filePath, "__SBOX_OUT_DIR__/") {
|
||||
return fmt.Errorf("output files must start with `__SBOX_OUT_DIR__/`")
|
||||
}
|
||||
outputsVarEntries[i] = relativePath
|
||||
outputsVarEntries[i] = strings.TrimPrefix(filePath, "__SBOX_OUT_DIR__/")
|
||||
}
|
||||
|
||||
allOutputs = append([]string(nil), outputsVarEntries...)
|
||||
|
Reference in New Issue
Block a user