Allow buildpath HOME checks exceptions to match for substrings.

E.g. if the recipe source code contains "/home/buildroot", the QA check
will also trigger when the home folder is "/home/build". So adding
"/home/buildroot" in OEQA_BUILDPATHS_SKIP should also ignore
"/home/build".

Signed-off-by: Mathieu Dubois-Briand <[email protected]>
---
 meta/classes-global/insane.bbclass | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meta/classes-global/insane.bbclass 
b/meta/classes-global/insane.bbclass
index c0868849fbe0..a4d17ccd2ad6 100644
--- a/meta/classes-global/insane.bbclass
+++ b/meta/classes-global/insane.bbclass
@@ -437,12 +437,13 @@ def package_qa_check_buildpaths(path, name, d, elf):
 
     tmpdir = bytes(d.getVar('TMPDIR'), encoding="utf-8")
     homedir = bytes(os.environ.get('HOME', ''), encoding="utf-8")
+    buildpaths_skip = (d.getVar("OEQA_BUILDPATHS_SKIP") or "").split()
     with open(path, 'rb') as f:
         file_content = f.read()
         if tmpdir in file_content:
             path = package_qa_clean_path(path, d, name)
             oe.qa.handle_error("buildpaths", "File %s in package %s contains 
reference to TMPDIR" % (path, name), d)
-        if homedir and homedir in file_content and not homedir.decode() in 
(d.getVar("OEQA_BUILDPATHS_SKIP") or "").split():
+        if homedir and homedir in file_content and not 
any(path.startswith(homedir.decode()) for path in buildpaths_skip):
             path = package_qa_clean_path(path, d, name)
             oe.qa.handle_error("buildpaths", "File %s in package %s contains a 
reference to the build host HOME directory. If upstream hardcodes a directory 
path that matches your home, you can set OEQA_BUILDPATHS_SKIP = \"%s\" in the 
recipe." % (path, name, homedir.decode()), d)
 

-- 
2.47.3

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#243455): 
https://lists.openembedded.org/g/openembedded-core/message/243455
Mute This Topic: https://lists.openembedded.org/mt/120749965/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to