summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2017-01-30 23:08:11 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-01-31 23:47:33 +0000
commit2bb0b1d9b51309038fcaaa6e1a62990cd2e7e257 (patch)
tree39aa9ed53f404676ee48f99cfe8a33bf5349eb6c /meta
parentbfead495de7ad78e7bc2ec550676a16420e98edc (diff)
downloadpoky-2bb0b1d9b51309038fcaaa6e1a62990cd2e7e257.tar.gz
utils: Avoid need to relocate wrapper scripts
Whilst the path to the executable is dynamically determined, the passed in environment variables or parameters are not relocatable and rely on the sstate remapping code. In the recipe specific sysroot case this has become more costly. This patch translates such paths into relocatable entries which means that a sed replacement at final installation isn't needed. (From OE-Core rev: 3e02a7cda0ba70e3f9886c5cce37d71361280b11) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/utils.bbclass18
1 files changed, 16 insertions, 2 deletions
diff --git a/meta/classes/utils.bbclass b/meta/classes/utils.bbclass
index 549e4b82f5..fe75f73a77 100644
--- a/meta/classes/utils.bbclass
+++ b/meta/classes/utils.bbclass
@@ -264,10 +264,17 @@ create_cmdline_wrapper () {
264 264
265 mv $cmd $cmd.real 265 mv $cmd $cmd.real
266 cmdname=`basename $cmd` 266 cmdname=`basename $cmd`
267 dirname=`dirname $cmd`
268 cmdoptions=$@
269 if [ "${base_prefix}" != "" ]; then
270 relpath=`python3 -c "import os; print(os.path.relpath('${D}${base_prefix}', '$dirname'))"`
271 cmdoptions=`echo $@ | sed -e "s:${base_prefix}:\\$realdir/$relpath:g"`
272 fi
267 cat <<END >$cmd 273 cat <<END >$cmd
268#!/bin/bash 274#!/bin/bash
269realpath=\`readlink -fn \$0\` 275realpath=\`readlink -fn \$0\`
270exec -a \`dirname \$realpath\`/$cmdname \`dirname \$realpath\`/$cmdname.real $@ "\$@" 276realdir=\`dirname \$realpath\`
277exec -a \`dirname \$realpath\`/$cmdname \`dirname \$realpath\`/$cmdname.real $cmdoptions "\$@"
271END 278END
272 chmod +x $cmd 279 chmod +x $cmd
273} 280}
@@ -287,10 +294,17 @@ create_wrapper () {
287 294
288 mv $cmd $cmd.real 295 mv $cmd $cmd.real
289 cmdname=`basename $cmd` 296 cmdname=`basename $cmd`
297 dirname=`dirname $cmd`
298 exportstring=$@
299 if [ "${base_prefix}" != "" ]; then
300 relpath=`python3 -c "import os; print(os.path.relpath('${D}${base_prefix}', '$dirname'))"`
301 exportstring=`echo $@ | sed -e "s:${base_prefix}:\\$realdir/$relpath:g"`
302 fi
290 cat <<END >$cmd 303 cat <<END >$cmd
291#!/bin/bash 304#!/bin/bash
292realpath=\`readlink -fn \$0\` 305realpath=\`readlink -fn \$0\`
293export $@ 306realdir=\`dirname \$realpath\`
307export $exportstring
294exec -a \`dirname \$realpath\`/$cmdname \`dirname \$realpath\`/$cmdname.real "\$@" 308exec -a \`dirname \$realpath\`/$cmdname \`dirname \$realpath\`/$cmdname.real "\$@"
295END 309END
296 chmod +x $cmd 310 chmod +x $cmd