getHookFiles: print exact error from getFiles (MR 28)

Instead of assuming that the error is "unable to find file", print the
actual error from getFiles. I just had a situation where the file
exists, but a dependency couldn't be found.

Before:
  generateInitfsExtra: getHookFiles: unable to find file "/usr/bin/expect" required by "/etc/postmarketos-mkinitfs/files-extra/ondev2-test.files"

After:
  generateInitfsExtra: getHookFiles: unable to add file "/usr/bin/expect" required by "/etc/postmarketos-mkinitfs/files-extra/ondev2-test.files": getBinaryDeps: unable to locate dependency for "/usr/bin/expect": libexpect5.45.4.so
This commit is contained in:
Oliver Smith
2023-01-11 19:07:38 +01:00
committed by Clayton Craft
parent 2761535e12
commit 0c0a85f3bb

View File

@@ -165,7 +165,7 @@ func getHookFiles(filesdir string) (files []string, err error) {
s := bufio.NewScanner(f)
for s.Scan() {
if filelist, err := getFiles([]string{s.Text()}, true); err != nil {
return nil, fmt.Errorf("getHookFiles: unable to find file %q required by %q", s.Text(), path)
return nil, fmt.Errorf("getHookFiles: unable to add file %q required by %q: %w", s.Text(), path, err)
} else {
files = append(files, filelist...)
}