Mac upload_system_symbols: make dump of /Library/QuickTime optional

/Library/QuickTime is gone in 10.15b2 19A487l.

Change-Id: I927350a9cb383b93e8b18aef5f36c77bb67fede1
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1663996
Reviewed-by: Robert Sesek <rsesek@chromium.org>
This commit is contained in:
Mark Mentovai 2019-06-18 10:48:04 -04:00
parent 9575315d8b
commit a7d686086c

View file

@ -69,13 +69,18 @@ var (
var ( var (
// pathsToScan are the subpaths in the systemRoot that should be scanned for shared libraries. // pathsToScan are the subpaths in the systemRoot that should be scanned for shared libraries.
pathsToScan = []string{ pathsToScan = []string{
"/Library/QuickTime",
"/System/Library/Components", "/System/Library/Components",
"/System/Library/Frameworks", "/System/Library/Frameworks",
"/System/Library/PrivateFrameworks", "/System/Library/PrivateFrameworks",
"/usr/lib", "/usr/lib",
} }
// optionalPathsToScan is just like pathsToScan, but the paths are permitted to be absent.
optionalPathsToScan = []string{
// Gone in 10.15.
"/Library/QuickTime",
}
// uploadServers are the list of servers to which symbols should be uploaded. // uploadServers are the list of servers to which symbols should be uploaded.
uploadServers = []string{ uploadServers = []string{
"https://clients2.google.com/cr/symbol", "https://clients2.google.com/cr/symbol",
@ -322,7 +327,11 @@ func findLibsInRoot(root string, dq *DumpQueue) {
fq.WorkerPool = StartWorkerPool(12, fq.worker) fq.WorkerPool = StartWorkerPool(12, fq.worker)
for _, p := range pathsToScan { for _, p := range pathsToScan {
fq.findLibsInPath(path.Join(root, p)) fq.findLibsInPath(path.Join(root, p), true)
}
for _, p := range optionalPathsToScan {
fq.findLibsInPath(path.Join(root, p), false)
} }
close(fq.queue) close(fq.queue)
@ -332,9 +341,12 @@ func findLibsInRoot(root string, dq *DumpQueue) {
// findLibsInPath recursively walks the directory tree, sending file paths to // findLibsInPath recursively walks the directory tree, sending file paths to
// test for being Mach-O to the findQueue. // test for being Mach-O to the findQueue.
func (fq *findQueue) findLibsInPath(loc string) { func (fq *findQueue) findLibsInPath(loc string, mustExist bool) {
d, err := os.Open(loc) d, err := os.Open(loc)
if err != nil { if err != nil {
if !mustExist && os.IsNotExist(err) {
return
}
log.Fatalf("Could not open %s: %v", loc, err) log.Fatalf("Could not open %s: %v", loc, err)
} }
defer d.Close() defer d.Close()
@ -348,7 +360,7 @@ func (fq *findQueue) findLibsInPath(loc string) {
for _, fi := range fis { for _, fi := range fis {
fp := path.Join(loc, fi.Name()) fp := path.Join(loc, fi.Name())
if fi.IsDir() { if fi.IsDir() {
fq.findLibsInPath(fp) fq.findLibsInPath(fp, true)
continue continue
} else if fi.Mode()&os.ModeSymlink != 0 { } else if fi.Mode()&os.ModeSymlink != 0 {
continue continue