diff options
author | Oleksandr Popovych <opopovyc@cisco.com> | 2021-08-20 05:41:43 -0700 |
---|---|---|
committer | Steve Sakoman <steve@sakoman.com> | 2021-08-27 04:58:08 -1000 |
commit | 912c9eda653c45fee2f55092fbe281efba897bc0 (patch) | |
tree | 4319507169752b55f78151924cb90db06d0659b3 | |
parent | 69e33b9eee6ae97208e766fd96353dfcb8c20bd5 (diff) | |
download | openembedded-core-912c9eda653c45fee2f55092fbe281efba897bc0.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.
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>
-rw-r--r-- | meta/classes/utils.bbclass | 2 |
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 () { #!/bin/bash realpath=\`readlink -fn \$0\` realdir=\`dirname \$realpath\` -exec -a \`dirname \$realpath\`/$cmdname \`dirname \$realpath\`/$cmdname.real $cmdoptions "\$@" +exec -a \$realdir/$cmdname \$realdir/$cmdname.real $cmdoptions "\$@" END chmod +x $cmd } |