summaryrefslogtreecommitdiffstats
path: root/meta/classes/utils.bbclass
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2013-05-30 17:55:10 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-05-30 21:10:23 +0100
commit3aaa4f78c609a47324da2db3b5c92a28f4f2ccff (patch)
tree42ad1eb0515aa5ced404bc351664e6d5523dc49d /meta/classes/utils.bbclass
parent29049da22197bd05b88619b9e8caea7bbdd2ee46 (diff)
downloadpoky-3aaa4f78c609a47324da2db3b5c92a28f4f2ccff.tar.gz
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. (From OE-Core rev: e8d2a2a3646f964ec61ece62e14788cd7184dd01) 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.bbclass9
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 () {
261 mv $cmd $cmd.real 261 mv $cmd $cmd.real
262 cmdname=`basename $cmd`.real 262 cmdname=`basename $cmd`.real
263 cat <<END >$cmd 263 cat <<END >$cmd
264#!/bin/sh 264#!/bin/bash
265realpath=\`readlink -fn \$0\` 265realpath=\`readlink -fn \$0\`
266exec \`dirname \$realpath\`/$cmdname $@ "\$@" 266exec -a $cmd \`dirname \$realpath\`/$cmdname $@ "\$@"
267END 267END
268 chmod +x $cmd 268 chmod +x $cmd
269} 269}
@@ -284,9 +284,10 @@ create_wrapper () {
284 mv $cmd $cmd.real 284 mv $cmd $cmd.real
285 cmdname=`basename $cmd`.real 285 cmdname=`basename $cmd`.real
286 cat <<END >$cmd 286 cat <<END >$cmd
287#!/bin/sh 287#!/bin/bash
288realpath=\`readlink -fn \$0\` 288realpath=\`readlink -fn \$0\`
289exec env $@ \`dirname \$realpath\`/$cmdname "\$@" 289export $@
290exec -a $cmd \`dirname \$realpath\`/$cmdname "\$@"
290END 291END
291 chmod +x $cmd 292 chmod +x $cmd
292} 293}