getBinaryDeps: search in /usr/lib/expect* (MR 28)
Instead of only searching for shared libraries in /usr/lib and /lib, also search in /usr/lib/expect* (currently the expect binary links against /usr/lib/expect5.45.4/libexpect5.45.4.so). I've also considered searching /usr/lib recursively, but that would be a major performance hit. Expect gets added to the initramfs-extra in a script that runs the ondev2 testsuite inside qemu.
This commit is contained in:
committed by
Clayton Craft
parent
112b572dc2
commit
d52cc16c88
32
main.go
32
main.go
@@ -218,20 +218,30 @@ func getBinaryDeps(file string) (files []string, err error) {
|
||||
return files, err
|
||||
}
|
||||
|
||||
libdirs := []string{"/usr/lib", "/lib"}
|
||||
// we don't recursively search these paths for performance reasons
|
||||
libdirGlobs := []string{
|
||||
"/usr/lib",
|
||||
"/lib",
|
||||
"/usr/lib/expect*",
|
||||
}
|
||||
|
||||
for _, lib := range libs {
|
||||
found := false
|
||||
for _, libdir := range libdirs {
|
||||
path := filepath.Join(libdir, lib)
|
||||
if _, err := os.Stat(path); err == nil {
|
||||
binaryDepFiles, err := getBinaryDeps(path)
|
||||
if err != nil {
|
||||
return files, err
|
||||
findDepLoop:
|
||||
for _, libdirGlob := range libdirGlobs {
|
||||
libdirs, _ := filepath.Glob(libdirGlob)
|
||||
for _, libdir := range libdirs {
|
||||
path := filepath.Join(libdir, lib)
|
||||
if _, err := os.Stat(path); err == nil {
|
||||
binaryDepFiles, err := getBinaryDeps(path)
|
||||
if err != nil {
|
||||
return files, err
|
||||
}
|
||||
files = append(files, binaryDepFiles...)
|
||||
files = append(files, path)
|
||||
found = true
|
||||
break findDepLoop
|
||||
}
|
||||
files = append(files, binaryDepFiles...)
|
||||
files = append(files, path)
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
|
Reference in New Issue
Block a user