]> code.ossystems Code Review - openembedded-core.git/commitdiff
base.bbclass: clean up dead symlink when handling hosttools
authorChen Qi <Qi.Chen@windriver.com>
Wed, 25 Dec 2019 07:01:13 +0000 (15:01 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 30 Dec 2019 08:45:02 +0000 (08:45 +0000)
When some hosttool is a dead symlink, bitbake any recipe will
fail with error like below.

  FileExistsError: [Errno 17] File exists: '/usr/bin/chrpath' -> '/path/to/builddir/tmp-glibc/hosttools/chrpath'

So we remove dead symlink under hostools/ directory to avoid
such error.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/base.bbclass

index 145daea3ecff75ae628fdaadd7f2567ff36fd950..5e5cf6632228477c77fe41f6ddbcda3b923bb81a 100644 (file)
@@ -127,6 +127,9 @@ def setup_hosttools_dir(dest, toolsvar, d, fatal=True):
     for tool in tools:
         desttool = os.path.join(dest, tool)
         if not os.path.exists(desttool):
+            # clean up dead symlink
+            if os.path.islink(desttool):
+                os.unlink(desttool)
             srctool = bb.utils.which(path, tool, executable=True)
             # gcc/g++ may link to ccache on some hosts, e.g.,
             # /usr/local/bin/ccache/gcc -> /usr/bin/ccache, then which(gcc)