diff options
author | Ross Burton <ross.burton@intel.com> | 2013-05-30 17:55:10 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-05-30 21:05:57 +0100 |
commit | e8d2a2a3646f964ec61ece62e14788cd7184dd01 (patch) | |
tree | 449edc367570714d40c5542c5a133dcbd6377679 /meta/classes/utils.bbclass | |
parent | 72c6fb8ac57b1f4a5c6dd3a65c3150f1e2f0ffd1 (diff) | |
download | openembedded-core-e8d2a2a3646f964ec61ece62e14788cd7184dd01.tar.gz openembedded-core-e8d2a2a3646f964ec61ece62e14788cd7184dd01.tar.bz2 openembedded-core-e8d2a2a3646f964ec61ece62e14788cd7184dd01.zip |
utils.bbclass: ensure $0 is correct in wrapper scripts
Some packages (eg mesa) will invoke a tool with --version and do string matches
on the output (i.e. mesa does $LEX --version |grep "^flex "). This doesn't work
with the combination of wrapper scripts and binaries that use $0 as they output
"flex.real".
Luckily bash's exec lets you set $0. As we want to use this we can't use env,
but using export appears to work just as well.
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/utils.bbclass')
-rw-r--r-- | meta/classes/utils.bbclass | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/meta/classes/utils.bbclass b/meta/classes/utils.bbclass index be0a25a2b9..cf8893f5b4 100644 --- a/meta/classes/utils.bbclass +++ b/meta/classes/utils.bbclass @@ -261,9 +261,9 @@ create_cmdline_wrapper () { mv $cmd $cmd.real cmdname=`basename $cmd`.real cat <<END >$cmd -#!/bin/sh +#!/bin/bash realpath=\`readlink -fn \$0\` -exec \`dirname \$realpath\`/$cmdname $@ "\$@" +exec -a $cmd \`dirname \$realpath\`/$cmdname $@ "\$@" END chmod +x $cmd } @@ -284,9 +284,10 @@ create_wrapper () { mv $cmd $cmd.real cmdname=`basename $cmd`.real cat <<END >$cmd -#!/bin/sh +#!/bin/bash realpath=\`readlink -fn \$0\` -exec env $@ \`dirname \$realpath\`/$cmdname "\$@" +export $@ +exec -a $cmd \`dirname \$realpath\`/$cmdname "\$@" END chmod +x $cmd } |