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

(From OE-Core rev: 8a4c473c07cba159cf88ed775b9f073c6adf31d4)

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Martin Jansa
2020-10-09 14:58:14 +02:00
committed by Richard Purdie
parent 0576fb4b6f
commit f5b4cd065f

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