]> code.ossystems Code Review - openembedded-core.git/commitdiff
base.bbclass: warn when there is trailing slash in S or B variables
authorMartin Jansa <Martin.Jansa@gmail.com>
Fri, 9 Oct 2020 12:58:14 +0000 (14:58 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 10 Oct 2020 12:37:44 +0000 (13:37 +0100)
* to make sure we won't hit such corner cases in future add a warning
  to prevent trailing slashes and duplicated slashes even when they
  in most cases don't cause harm

* only a few cases were found in layers included in my world builds:
  oe-core: 1
  meta-oe: 7
  meta-python2: 1
  meta-qt5: 1
  meta-aws: 1

  will send patches for these once this warning is approved for oe-core

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/base.bbclass

index 62e34d0079beff0178bbc89df4269b4d2ed34ded..5a0b0c6b3e2d7246875eea2751623f62cff880cf 100644 (file)
@@ -388,6 +388,11 @@ python () {
     oe.utils.features_backfill("DISTRO_FEATURES", d)
     oe.utils.features_backfill("MACHINE_FEATURES", d)
 
+    if d.getVar("S")[-1] == '/':
+        bb.warn("Recipe %s sets S variable with trailing slash '%s', remove it" % (d.getVar("PN"), d.getVar("S")))
+    if d.getVar("B")[-1] == '/':
+        bb.warn("Recipe %s sets B variable with trailing slash '%s', remove it" % (d.getVar("PN"), d.getVar("B")))
+
     if os.path.normpath(d.getVar("WORKDIR")) != os.path.normpath(d.getVar("S")):
         d.appendVar("PSEUDO_IGNORE_PATHS", ",${S}")
     if os.path.normpath(d.getVar("WORKDIR")) != os.path.normpath(d.getVar("B")):