Parcourir la source

base.bbclass: warn when there is trailing slash in S or B variables

* 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>
Martin Jansa il y a 3 ans
Parent
commit
8a4c473c07
1 fichiers modifiés avec 5 ajouts et 0 suppressions
  1. 5 0
      meta/classes/base.bbclass

+ 5 - 0
meta/classes/base.bbclass

@@ -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")):