Add tests to ensure COREBASE/TMPDIR doon't contain ".." as this causes
hard to understand build failures.

Also rework the code to test TMPDIR and COREBASE for all the patterns
since they may be set differently and one may contain problematic
characters.

[YOCTO #14111]

Signed-off-by: Richard Purdie <[email protected]>
---
 meta/classes/sanity.bbclass | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index 14ffac0bf28..a377917f2a9 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -882,15 +882,18 @@ def check_sanity_everybuild(status, d):
         except:
             pass
 
-    oeroot = d.getVar('COREBASE')
-    if oeroot.find('+') != -1:
-        status.addresult("Error, you have an invalid character (+) in your 
COREBASE directory path. Please move the installation to a directory which 
doesn't include any + characters.")
-    if oeroot.find('@') != -1:
-        status.addresult("Error, you have an invalid character (@) in your 
COREBASE directory path. Please move the installation to a directory which 
doesn't include any @ characters.")
-    if oeroot.find('%') != -1:
-        status.addresult("Error, you have an invalid character (%) in your 
COREBASE directory path which causes problems with python string formatting. 
Please move the installation to a directory which doesn't include any % 
characters.") 
-    if oeroot.find(' ') != -1:
-        status.addresult("Error, you have a space in your COREBASE directory 
path. Please move the installation to a directory which doesn't include a space 
since autotools doesn't support this.")
+    for checkdir in ['COREBASE', 'TMPDIR']:
+        val = d.getVar(checkdir)
+        if val.find('..') != -1:
+            status.addresult("Error, you have '..' in your %s directory path. 
Please ensure the variable contains an absolute path as this can break some 
recipe builds in obtuse ways." % checkdir)
+        if val.find('+') != -1:
+            status.addresult("Error, you have an invalid character (+) in your 
%s directory path. Please move the installation to a directory which doesn't 
include any + characters." % checkdir)
+        if val.find('@') != -1:
+            status.addresult("Error, you have an invalid character (@) in your 
%s directory path. Please move the installation to a directory which doesn't 
include any @ characters." % checkdir)
+        if val.find(' ') != -1:
+            status.addresult("Error, you have a space in your %s directory 
path. Please move the installation to a directory which doesn't include a space 
since autotools doesn't support this." % checkdir)
+        if val.find('%') != -1:
+            status.addresult("Error, you have an invalid character (%) in your 
%s directory path which causes problems with python string formatting. Please 
move the installation to a directory which doesn't include any % characters." % 
checkdir)
 
     # Check the format of MIRRORS, PREMIRRORS and SSTATE_MIRRORS
     import re
-- 
2.30.2

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

Reply via email to