summaryrefslogtreecommitdiffstats
path: root/meta/classes-global
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 11:41:34 +0100
commit07546cc63f5e2a1a74bd7f5cac6ad1c9948264d4 (patch)
tree0c159b43766c15035c5d9a04cee48cd576f31861 /meta/classes-global
parent11bab63ca8f7f0350e519d62282e4fcdc3a470ce (diff)
downloadpoky-07546cc63f5e2a1a74bd7f5cac6ad1c9948264d4.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. (From OE-Core rev: 85ddbb67f0f6f823cac0966db78e5b74c5a54c4c) 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>
Diffstat (limited to 'meta/classes-global')
-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() {
1353 ########################################################################### 1353 ###########################################################################
1354 def match_line_in_files(toplevel, filename_glob, line_regex): 1354 def match_line_in_files(toplevel, filename_glob, line_regex):
1355 import pathlib 1355 import pathlib
1356 toppath = pathlib.Path(toplevel) 1356 try:
1357 for entry in toppath.glob(filename_glob): 1357 toppath = pathlib.Path(toplevel)
1358 try: 1358 for entry in toppath.glob(filename_glob):
1359 with open(entry, 'r', encoding='utf-8', errors='ignore') as f: 1359 try:
1360 for line in f.readlines(): 1360 with open(entry, 'r', encoding='utf-8', errors='ignore') as f:
1361 if re.match(line_regex, line): 1361 for line in f.readlines():
1362 return True 1362 if re.match(line_regex, line):
1363 except FileNotFoundError: 1363 return True
1364 # Broken symlink in source 1364 except FileNotFoundError:
1365 pass 1365 # Broken symlink in source
1366 pass
1367 except FileNotFoundError:
1368 # pathlib.Path.glob() might throw this when file/directory
1369 # disappear while scanning.
1370 bb.note("unimplemented-ptest: FileNotFoundError exception while scanning (disappearing file while scanning?). Check was ignored." % d.getVar('PN'))
1371 pass
1366 return False 1372 return False
1367 1373
1368 srcdir = d.getVar('S') 1374 srcdir = d.getVar('S')