summaryrefslogtreecommitdiffstats
path: root/meta/classes/utils.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/utils.bbclass')
-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