]> code.ossystems Code Review - openembedded-core.git/commitdiff
sanity.bbclass: sanity check for if bitbake is present in PATH
authorDorinda <dorindabassey@gmail.com>
Tue, 26 Jan 2021 01:33:59 +0000 (02:33 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 27 Jan 2021 10:16:14 +0000 (10:16 +0000)
If a user executes the environment script instead of sourcing it,
there's an error about an empty element in PATH. This is because
bitbake isn't present in environment variable PATH. Hence, this
patch adds a sanity check to verify if bitbake is present in
PATH and if bitbake isn't present issue a warning message.

[YOCTO #13822]

Signed-off-by: Dorinda Bassey <dorindabassey@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/sanity.bbclass

index 62b5253911c4b88b4cd4b32542f38c167e921cfe..c6842ff54931623a488c8468b858d80332253e9f 100644 (file)
@@ -794,6 +794,11 @@ def check_sanity_everybuild(status, d):
     if "." in paths or "./" in paths or "" in paths:
         status.addresult("PATH contains '.', './' or '' (empty element), which will break the build, please remove this.\nParsed PATH is " + str(paths) + "\n")
 
+    #Check if bitbake is present in PATH environment variable
+    bb_check = bb.utils.which(d.getVar('PATH'), 'bitbake')
+    if not bb_check:
+        bb.warn("bitbake binary is not found in PATH, did you source the script?")
+
     # Check whether 'inherit' directive is found (used for a class to inherit)
     # in conf file it's supposed to be uppercase INHERIT
     inherit = d.getVar('inherit')