[bitbake-devel] [PATCH] bitbake: toaster: allow OE_ROOT to be provided through environment
Peter Kjellerstedt
peter.kjellerstedt at axis.com
Fri Nov 2 08:49:53 UTC 2018
Actually, the originally suggested parameter expansion "${foo:-bar}" is
_not_ a bashism. It is standard POSIX, see:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02
I would recommend the following, as it also avoids doing an unnecessary
fork to dirname, which has already been done two lines above when
setting BBBASEDIR:
OE_ROOT=${OE_ROOT:-$BBBASEDIR/..}
An alternative, but maybe a bit less obvious variant, is:
: ${OE_ROOT:=$BBBASEDIR/..}
making use of the fact that the parameter expansion and conditional
variable setting will happen before the : command (aka nop) is executed.
//Peter
> -----Original Message-----
> From: bitbake-devel-bounces at lists.openembedded.org <bitbake-devel-
> bounces at lists.openembedded.org> On Behalf Of Reyna, David
> Sent: den 1 november 2018 19:08
> To: Awais Belal <awais_belal at mentor.com>; bitbake-
> devel at lists.openembedded.org
> Subject: Re: [bitbake-devel] [PATCH] bitbake: toaster: allow OE_ROOT to
> be provided through environment
>
> Hi Awais,
>
> I agree to the idea. My only concern is that you are using a bashism to
> expand the variable, and that will fail on systems that for example are
> based on "dash". Since the "toaster" script is sourced, it cannot
> override the shell executor to "bash".
>
> While not as compact, I would prefer a shell-safe expansion such as:
>
> vvvv
>
> if [ -z "$OE_ROOT" ] ; then
> OE_ROOT=`dirname $TOASTER`/../..
> endif
>
> ^^^^
>
> - David
>
> -----Original Message-----
> From: bitbake-devel-bounces at lists.openembedded.org [mailto:bitbake-
> devel-bounces at lists.openembedded.org] On Behalf Of Awais Belal
> Sent: Thursday, November 01, 2018 6:35 AM
> To: bitbake-devel at lists.openembedded.org
> Subject: [bitbake-devel] [PATCH] bitbake: toaster: allow OE_ROOT to be
> provided through environment
>
> Updates for YOCTO #12891 allowed a user to have a directory
> structure different to that of yocto (bitbake isn't inside
> oe-core) whereas the definition of OE_ROOT in the main toaster
> binary still assumes the same while checking for .templateconf
> and hence we see an error on the cmdline in such cases:
> bash: <repo-path>/bitbake/bin/../../.templateconf: No such file or
> directory
> The change here now allows the user to provide OE_ROOT through
> the environment in such cases and otherwise defaults to the older
> mechanism to fix this issue.
>
> Signed-off-by: Awais Belal <awais_belal at mentor.com>
> ---
> bin/toaster | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/bin/toaster b/bin/toaster
> index 9fffbc6..4e227cc 100755
> --- a/bin/toaster
> +++ b/bin/toaster
> @@ -161,7 +161,7 @@ fi
>
> export BBBASEDIR=`dirname $TOASTER`/..
> MANAGE="python3 $BBBASEDIR/lib/toaster/manage.py"
> -OE_ROOT=`dirname $TOASTER`/../..
> +OE_ROOT=${OE_ROOT:-`dirname $TOASTER`/../..}
>
> # this is the configuraton file we are using for toaster
> # we are using the same logic that oe-setup-builddir uses
> --
> 2.7.4
>
> --
> _______________________________________________
> bitbake-devel mailing list
> bitbake-devel at lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/bitbake-devel
> --
> _______________________________________________
> bitbake-devel mailing list
> bitbake-devel at lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/bitbake-devel
More information about the bitbake-devel
mailing list