All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] base.bbclass: clean up dead symlink when handling hosttools
@ 2019-12-25  7:01 Chen Qi
  0 siblings, 0 replies; only message in thread
From: Chen Qi @ 2019-12-25  7:01 UTC (permalink / raw)
  To: openembedded-core

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>
---
 meta/classes/base.bbclass | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 2fdab74f4b..3db8527d04 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -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)
-- 
2.17.1



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-12-25  7:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-25  7:01 [PATCH] base.bbclass: clean up dead symlink when handling hosttools Chen Qi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.