summaryrefslogtreecommitdiffstats
path: root/meta/classes/utils.bbclass
diff options
context:
space:
mode:
authorOleksandr Popovych <opopovyc@cisco.com>2021-08-20 05:41:43 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-08-22 22:21:47 +0100
commita0268e0d4ff6ac123a581b006af96fc9aa3dcf96 (patch)
tree38f944806ce44a1f30e8462e46625ee784dbff02 /meta/classes/utils.bbclass
parent8900a8b337d0655d886a15c09b3a1cbd69438666 (diff)
downloadpoky-a0268e0d4ff6ac123a581b006af96fc9aa3dcf96.tar.gz
utils: Reduce the number of calls to the "dirname" command
utils.bbclass contains create_cmdline_wrapper() function that creates wrapper script with additional arguments for any passed "$cmd" command, and uses several calls to "dirname". Because "dirname" is an external command, in cases of lots of calls to wrapped "$cmd", each call of "dirname" will incur significant overhead. There are three same calls to "dirname": one for saving it`s output to "realdir" variable, and other two in "exec" command. So last two "dirname" calls can be replaced with cached value from "realdir" variable. (From OE-Core rev: 4b9cf2c80fd14386e0b88a2e6c40a9fa3f1ae0f7) Signed-off-by: Oleksandr Popovych <opopovyc@cisco.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/utils.bbclass')
-rw-r--r--meta/classes/utils.bbclass2
1 files changed, 1 insertions, 1 deletions
diff --git a/meta/classes/utils.bbclass b/meta/classes/utils.bbclass
index 120bcc64a6..072ea1f63c 100644
--- a/meta/classes/utils.bbclass
+++ b/meta/classes/utils.bbclass
@@ -214,7 +214,7 @@ create_cmdline_wrapper () {
214#!/bin/bash 214#!/bin/bash
215realpath=\`readlink -fn \$0\` 215realpath=\`readlink -fn \$0\`
216realdir=\`dirname \$realpath\` 216realdir=\`dirname \$realpath\`
217exec -a \`dirname \$realpath\`/$cmdname \`dirname \$realpath\`/$cmdname.real $cmdoptions "\$@" 217exec -a \$realdir/$cmdname \$realdir/$cmdname.real $cmdoptions "\$@"
218END 218END
219 chmod +x $cmd 219 chmod +x $cmd
220} 220}