[OE-core] [PATCH v3 2/6] toolchain-scripts: allow non-sh post-relocate

Richard Purdie richard.purdie at linuxfoundation.org
Tue Jun 5 10:36:05 UTC 2018


On Tue, 2018-06-05 at 10:27 +0000, Peter Kjellerstedt wrote:
> > -----Original Message-----
> > From: openembedded-core-bounces at lists.openembedded.org
> > [mailto:openembedded-core-bounces at lists.openembedded.org] On Behalf
> > Of
> > Martin Kelly
> > Sent: den 5 juni 2018 01:06
> > To: openembedded-core at lists.openembedded.org
> > Subject: [OE-core] [PATCH v3 2/6] toolchain-scripts: allow non-sh
> > post-
> > relocate
> > 
> > Currently, we look only for scripts matching *.sh, which means we
> > can't
> > write post-relocate scripts in other languages.
> > 
> > Expand this to allow any type of script.
> > 
> > Signed-off-by: Martin Kelly <mkelly at xevo.com>
> > ---
> > v3:
> > - Test for executability prior to running each script.
> > 
> >  meta/classes/toolchain-scripts.bbclass | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/meta/classes/toolchain-scripts.bbclass
> > b/meta/classes/toolchain-scripts.bbclass
> > index a72436167c..da8a57f24b 100644
> > --- a/meta/classes/toolchain-scripts.bbclass
> > +++ b/meta/classes/toolchain-scripts.bbclass
> > @@ -124,7 +124,10 @@ toolchain_create_post_relocate_script() {
> > 
> >  	cat >> $script <<EOF
> >  if [ -d "${SDKPATHNATIVE}/post-relocate-setup.d/" ]; then
> > -    for s in ${SDKPATHNATIVE}/post-relocate-setup.d/*.sh; do
> > +    for s in ${SDKPATHNATIVE}/post-relocate-setup.d/*; do
> > +        if [ ! -x \$s ]; then
> > +            continue
> > +        fi
> 
> That can be written as:
> 
>          [ -x \$s ] || continue
> 
> >          \$s "\$1"
> 
> Or you can replace all of it with:
> 
>          [ ! -x \$s ] || \$s "\$1"
> 
> You should not invert the test and replace the || with && though 
> (even if it may seem more logical) due to the return status of 
> the [ command in case $s is not executable.

FWIW personally I prefer the original patch version as being more
readable...

Cheers,

Richard



More information about the Openembedded-core mailing list