Fix missing glob filelists when sandboxed
Sandboxing the primary builder caused the glob filelists to not
be written because they were using a relative path, causing
primary builder reruns on the second build.
Also report errors when writing the filelist files.
Test: m checkbuild
Change-Id: Id1706560d04c85f00f829cfb714967bb8600626f
diff --git a/bootstrap/glob.go b/bootstrap/glob.go
index 9841611..52dbf2f 100644
--- a/bootstrap/glob.go
+++ b/bootstrap/glob.go
@@ -131,8 +131,14 @@
depFile := fileListFile + ".d"
fileList := strings.Join(g.Files, "\n") + "\n"
- pathtools.WriteFileIfChanged(fileListFile, []byte(fileList), 0666)
- deptools.WriteDepFile(depFile, fileListFile, g.Deps)
+ err := pathtools.WriteFileIfChanged(absolutePath(fileListFile), []byte(fileList), 0666)
+ if err != nil {
+ panic(fmt.Errorf("error writing %s: %s", fileListFile, err))
+ }
+ err = deptools.WriteDepFile(absolutePath(depFile), fileListFile, g.Deps)
+ if err != nil {
+ panic(fmt.Errorf("error writing %s: %s", depFile, err))
+ }
GlobFile(ctx, g.Pattern, g.Excludes, fileListFile, depFile)
} else {