]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
base.bbclass: Fix way to check ccache path
authorChangqing Li <changqing.li@windriver.com>
Fri, 23 Dec 2022 03:38:40 +0000 (11:38 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 26 Dec 2022 10:29:13 +0000 (10:29 +0000)
The previous code had 2 issues:
1. make hosttools/ccache always link to host's ccache (/usr/bin/ccache)
even we have one buildtools
2. make hosttools/gcc etc, link to host's gcc event we have one
buildtools when keyword ccache in buildtools's path, eg:
/mnt/ccache/bin/buildtools

This patch is for fix above issues.

Signed-off-by: Changqing Li <changqing.li@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes-global/base.bbclass

index c4ac43c5696a4f7ab89a65bfd3ead132b4654d47..64e805c9476c87840370e41a1422b4d56b4b8acf 100644 (file)
@@ -116,7 +116,7 @@ def setup_hosttools_dir(dest, toolsvar, d, fatal=True):
             # /usr/local/bin/ccache/gcc -> /usr/bin/ccache, then which(gcc)
             # would return /usr/local/bin/ccache/gcc, but what we need is
             # /usr/bin/gcc, this code can check and fix that.
-            if "ccache" in srctool:
+            if os.path.islink(srctool) and os.path.basename(os.readlink(srctool)) == 'ccache':
                 srctool = bb.utils.which(path, tool, executable=True, direction=1)
             if srctool:
                 os.symlink(srctool, desttool)