Skip to contentSkip to conversation

layer.conf: fix sanity error for PATH variable in extensible SDK workflow

PATCH In review [email protected] 2 participants 2 messages Oct 8, 2020 – Oct 10, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 layer.conf: fix sanity error for PATH variable in extensible SDK workflow

Sanity checker reports following error for the PATH variable, when bitbake -e <recipe> command is run in an extensible SDK workspace.
PATH contains '.', './' or '' (empty element), which will break the build

In case of extensible SDK, PATH variable is formed with two consecutive ':' as bb.utils.which(d.getVar('PATH'),'bitbake') call returns an empty string.

This change adds the ':' only if the bb.utils.which(d.getVar('PATH'),'bitbake') return a valid path.

---
 meta/conf/layer.conf | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta/conf/layer.conf +2 -1
index 38df0f3..ff9c004 100644
@@ -102,4 +102,5 @@ SSTATE_EXCLUDEDEPS_SYSROOT += "\
 SSTATE_EXCLUDEDEPS_SYSROOT += ".*->autoconf-archive-native"
 
 # We need to keep bitbake tools in PATH
-PATH := "${@os.path.dirname(bb.utils.which(d.getVar('PATH'),'bitbake'))}:${HOSTTOOLS_DIR}"
+PATH := "${@os.path.dirname(bb.utils.which(d.getVar('PATH'),'bitbake'))}"
+PATH := "${@('', ':')[d.getVar('PATH').endswith(':')]}${HOSTTOOLS_DIR}"
Signature · 7 lines
2.7.4



-- 
Regards,
Sourabh
#1 lore raw
Quoted 20 lines · Sourabh Banerjee

Sanity checker reports following error for the PATH variable, when bitbake -e <recipe> command is run in an extensible SDK workspace.
PATH contains '.', './' or '' (empty element), which will break the build

In case of extensible SDK, PATH variable is formed with two consecutive ':' as bb.utils.which(d.getVar('PATH'),'bitbake') call returns an empty string.

This change adds the ':' only if the bb.utils.which(d.getVar('PATH'),'bitbake') return a valid path.

---
 meta/conf/layer.conf | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta/conf/layer.conf +0 -0
index 38df0f3..ff9c004 100644

meta/conf/layer.conf SSTATE_EXCLUDEDEPS_SYSROOT += "\ · line 106

Quoted 6 lines
meta/conf/layer.conf +2 -1
@@ -102,4 +102,5 @@ SSTATE_EXCLUDEDEPS_SYSROOT += "\
 SSTATE_EXCLUDEDEPS_SYSROOT += ".*->autoconf-archive-native"
 
 # We need to keep bitbake tools in PATH
-PATH := "${@os.path.dirname(bb.utils.which(d.getVar('PATH'),'bitbake'))}:${HOSTTOOLS_DIR}"
+PATH := "${@os.path.dirname(bb.utils.which(d.getVar('PATH'),'bitbake'))}"
+PATH := "${@('', ':')[d.getVar('PATH').endswith(':')]}${HOSTTOOLS_DIR}"

I had reservations about this change but I did put it in for testing. It definitely causes problems, particularly in oe-selftest:

https://autobuilder.yoctoproject.org/typhoon/#/builders/79/builds/1448
https://autobuilder.yoctoproject.org/typhoon/#/builders/87/builds/1455
https://autobuilder.yoctoproject.org/typhoon/#/builders/80/builds/1433
https://autobuilder.yoctoproject.org/typhoon/#/builders/86/builds/1430

I did try it locally and saw slightly different errors:

2020-10-10 10:46:37,098 - oe-selftest - INFO - ======================================================================
2020-10-10 10:46:37,098 - oe-selftest - INFO - FAIL: wic.Wic.test_change_directory (subunit.RemotedTestCase)
2020-10-10 10:46:37,098 - oe-selftest - INFO - ----------------------------------------------------------------------
2020-10-10 10:46:37,099 - oe-selftest - INFO - testtools.testresult.real._StringException: Traceback (most recent call last):
  File "/media/build1/poky/meta/lib/oeqa/selftest/cases/wic.py", line 642, in test_change_directory
    % (wks_file, self.resultdir))
  File "/media/build1/poky/meta/lib/oeqa/utils/commands.py", line 201, in runCmd
    raise AssertionError("Command '%s' returned non-zero exit status %d:\n%s" % (command, result.status, exc_output))

AssertionError: Command 'wic create /media/build1/poky/build-st-69370/wic-tmp/test-include/temp.wks -e core-image-minimal -o /media/build1/poky/build-st-69370/wic-tmp/' returned non-zero exit status 1:
ERROR: Cannot run command: bitbake, lost dependency?

The errors are a bit strange and I'm afraid I don't have the bandwidth right now to try and dig in and understand why this breaks. The patch does regress things though so more work or an alternative approach is needed.

Cheers,

Richard