summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYoann Congal <yoann.congal@smile.fr>2023-10-16 17:51:13 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-10-17 10:54:39 +0100
commit85ddbb67f0f6f823cac0966db78e5b74c5a54c4c (patch)
treeff4234647b905c908231b0ea70f9a085c49ba841
parent9a2d2f7c2b7236667a6d80355f73db4c27e6582e (diff)
downloadopenembedded-core-85ddbb67f0f6f823cac0966db78e5b74c5a54c4c.tar.gz
insane: unimplemented-ptest: ignore source file errors
In some cases, pathlib.Path.glob() might throw FileNotFoundError when file/directory disappear while it is iterating over them. This "warning" is not important enough to crash build in this case so just take a bb.note of the problem and move on. Signed-off-by: Yoann Congal <yoann.congal@smile.fr> Reported-by: Mark Hatle <mark.hatle@amd.com> Closes: https://lists.openembedded.org/g/openembedded-core/message/189254 Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes-global/insane.bbclass26
1 files changed, 16 insertions, 10 deletions
diff --git a/meta/classes-global/insane.bbclass b/meta/classes-global/insane.bbclass
index f7a2c392cf..6f3cd3026d 100644
--- a/meta/classes-global/insane.bbclass
+++ b/meta/classes-global/insane.bbclass
@@ -1353,16 +1353,22 @@ python do_qa_patch() {
###########################################################################
def match_line_in_files(toplevel, filename_glob, line_regex):
import pathlib
- toppath = pathlib.Path(toplevel)
- for entry in toppath.glob(filename_glob):
- try:
- with open(entry, 'r', encoding='utf-8', errors='ignore') as f:
- for line in f.readlines():
- if re.match(line_regex, line):
- return True
- except FileNotFoundError:
- # Broken symlink in source
- pass
+ try:
+ toppath = pathlib.Path(toplevel)
+ for entry in toppath.glob(filename_glob):
+ try:
+ with open(entry, 'r', encoding='utf-8', errors='ignore') as f:
+ for line in f.readlines():
+ if re.match(line_regex, line):
+ return True
+ except FileNotFoundError:
+ # Broken symlink in source
+ pass
+ except FileNotFoundError:
+ # pathlib.Path.glob() might throw this when file/directory
+ # disappear while scanning.
+ bb.note("unimplemented-ptest: FileNotFoundError exception while scanning (disappearing file while scanning?). Check was ignored." % d.getVar('PN'))
+ pass
return False
srcdir = d.getVar('S')