public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: "Richard Purdie" <richard.purdie@linuxfoundation.org>
To: Sourabh Banerjee <sbanerje@codeaurora.org>,
	 openembedded-core@lists.openembedded.org
Subject: Re: [OE-core] [PATCH v2] layer.conf: fix sanity error for PATH variable in extensible SDK workflow
Date: Tue, 13 Oct 2020 10:02:20 +0100	[thread overview]
Message-ID: <70e6251e77a670b27d5f615f17b5e6ade4b9af90.camel@linuxfoundation.org> (raw)
In-Reply-To: <1602403005-20733-1-git-send-email-sbanerje@codeaurora.org>

On Sun, 2020-10-11 at 13:26 +0530, Sourabh Banerjee wrote:
> 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')
> returns a valid path.
> 
> Signed-off-by: Sourabh Banerjee <sbanerje@codeaurora.org>
> ---
>  meta/conf/layer.conf | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/conf/layer.conf b/meta/conf/layer.conf
> index 38df0f3..75d2ee0 100644
> --- a/meta/conf/layer.conf
> +++ b/meta/conf/layer.conf
> @@ -102,4 +102,12 @@ 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}"
> +# The ':' separator is conditionally added only if 'bitbake' is in environment.
> +# In case of extensible SDK, bitbake is not in environment, which results in
> +# two consecutive ':'. Sanity checker reports "empty element" error when it
> +# encounters two consecutive ':' for PATH variable in the extensible SDK.
> +PATH := "\
> +${@os.path.dirname(bb.utils.which(d.getVar('PATH'),'bitbake'))}\
> +${@(':', '')[bb.utils.which(d.getVar('PATH'),'bitbake') is ""]}\
> +${HOSTTOOLS_DIR}\
> +"

I think we need to try and find something a little neater than this.
How about:

# Need to avoid empty path entries
BITBAKEPATH := "${@os.path.dirname(bb.utils.which(d.getVar('PATH'),'bitbake'))}"
PATH := "${@'${BITBAKEPATH}:' if ${BITBAKEPATH} is not ""}${HOSTTOOLS_DIR}"

Cheers,

Richard




  reply	other threads:[~2020-10-13  9:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-11  7:56 [PATCH v2] layer.conf: fix sanity error for PATH variable in extensible SDK workflow sbanerje
2020-10-13  9:02 ` Richard Purdie [this message]
2020-10-13  9:29   ` [OE-core] " Sourabh Banerjee
2020-10-13 16:51   ` Sourabh Banerjee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=70e6251e77a670b27d5f615f17b5e6ade4b9af90.camel@linuxfoundation.org \
    --to=richard.purdie@linuxfoundation.org \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=sbanerje@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox