Skip to contentSkip to conversation

sanity.bbclass: sanity check for if bitbake is present in PATH

PATCH In review Dorinda 2 participants 2 messages Jan 26, 2021

lore
Share & tools
lore

Dorinda

author
#0 lore raw

PATCH 1/2 sanity.bbclass: sanity check for if bitbake is present in PATH

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]

---
 meta/classes/sanity.bbclass | 5 +++++
 1 file changed, 5 insertions(+)
meta/classes/sanity.bbclass +5 -0
index d134b40a87..e527c13746 100644
@@ -787,6 +787,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')
Signature · 1 line
2.17.1
#1 lore raw

Hi Dorinda,

Quoted 2 lines · Dorinda

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.

Same remarks as your other patch for the pseudo related fix.

=> v2 + commit log wrap

Your patch also has [PATCH 1/2] but there's no second patch AFAICT, you might want to check the content of the patch before sending it (you can read the patch with your favorite text editor, it's just text). I think git send-email also asks you if you want to send the mail with the subject being "<insert commit title>" before actually sending it but I'm not sure anymore.

Still only nitpicks so no need to send a v3 on my side.

Cheers,
Quentin