summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorOleksandr Popovych <opopovyc@cisco.com>2021-08-20 05:41:43 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-09-01 16:27:09 +0100
commite7eeef5ab7b923b797fd70d5caf6517cc0f7d6f7 (patch)
treee0203245b563add3572bf4027517f9d7695d8903 /meta/classes
parent9b62e6b834463bf70af4a71acd6b1f2adedc44ce (diff)
downloadpoky-e7eeef5ab7b923b797fd70d5caf6517cc0f7d6f7.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: 912c9eda653c45fee2f55092fbe281efba897bc0) Signed-off-by: Oleksandr Popovych <opopovyc@cisco.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 4b9cf2c80fd14386e0b88a2e6c40a9fa3f1ae0f7) Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-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 cd3d05709e..99f68f7505 100644
--- a/meta/classes/utils.bbclass
+++ b/meta/classes/utils.bbclass
@@ -233,7 +233,7 @@ create_cmdline_wrapper () {
233#!/bin/bash 233#!/bin/bash
234realpath=\`readlink -fn \$0\` 234realpath=\`readlink -fn \$0\`
235realdir=\`dirname \$realpath\` 235realdir=\`dirname \$realpath\`
236exec -a \`dirname \$realpath\`/$cmdname \`dirname \$realpath\`/$cmdname.real $cmdoptions "\$@" 236exec -a \$realdir/$cmdname \$realdir/$cmdname.real $cmdoptions "\$@"
237END 237END
238 chmod +x $cmd 238 chmod +x $cmd
239} 239}