[OE-core] [PATCH] classes: Standardize strings tests, and join some if/then/while/do lines

Peter Kjellerstedt peter.kjellerstedt at axis.com
Tue Mar 28 14:25:50 UTC 2017


> -----Original Message-----
> From: openembedded-core-bounces at lists.openembedded.org
> [mailto:openembedded-core-bounces at lists.openembedded.org] On Behalf Of
> Robert P. J. Day
> Sent: den 28 mars 2017 12:51
> To: OE Core mailing list
> Subject: [OE-core] [PATCH] classes: Standardize strings tests, and join
> some if/then/while/do lines
> 
> 
> For better or worse, two types of cleanup in meta/classes directory:
> 
> * Replace old-style 'x${VAR} = x' tests with -n/-z string tests
> * Unsplit lines to keep if/then, while/do on same line
> 
> Signed-off-by: Robert P. J. Day <rpjday at crashcourse.ca>
> 
> ---
> 
>   i realize there are two types of tidying here -- if that offends
> people, i can split it into two separate submissions. nothing here
> should affect execution, but it's always possible i screwed something
> up, not sure how to rigourously test these changes.
> 
>   also, when i did change a shell string test, i added {} around the
> variable name, it's just a standard i like for visual clarity. apply
> all or part of what seems useful.

You should absolutely not do this, especially if you want visual clarity 
in a BitBake recipe. This makes the variable look like a BitBake variable 
instead of a shell variable,  and not just to us humans, but to bitbake 
as well. It will cause bitbake to put an unnecessary dependency on the 
(typically non-existent) BitBake variable ${VAR} in the state signature 
for the shell function. Which, as Ross pointed out, will cause problems 
in the case where there actually are both a BitBake variable and a shell 
variable with the same name.

In addition to that, you would throw at least our company's shell expert 
into a fit if you tried to do that in any shell code at all. ;)

//Peter




More information about the Openembedded-core mailing list