From: Bernhard Rosenkränzer <[email protected]>

base.bbclass currently symlinks the first copy of tar on the PATH
to hosttools.

If that copy of tar isn't GNU tar (some Linux distributions use
libarchive tar for the fact that it can handle zip files etc. as
well; some others probably use busybox or toybox tar for space
issues), the build fails early on because path.py uses --xattrs
and --xattrs-include

With this patch, base.bbclass checks if tar supports --xattrs-include,
and checks for gtar if the first tar found doesn't support it.

Signed-off-by: Bernhard Rosenkränzer <[email protected]>
---
 meta/classes-global/base.bbclass | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/meta/classes-global/base.bbclass b/meta/classes-global/base.bbclass
index 8203f54519..b6391501ca 100644
--- a/meta/classes-global/base.bbclass
+++ b/meta/classes-global/base.bbclass
@@ -135,6 +135,16 @@ def setup_hosttools_dir(dest, toolsvar, d, fatal=True):
             if os.path.islink(desttool):
                 os.unlink(desttool)
             srctool = bb.utils.which(path, tool, executable=True)
+            # copytree() uses tar options such as --xattrs and
+            # --xattrs-include that are currently specific to GNU tar.
+            # If the first tar in PATH is libarchive tar or busybox/toybox
+            # tar, GNU tar may well be available as gtar.
+            if (tool == "tar"):
+                import subprocess
+                if not b'--xattrs-include' in 
subprocess.check_output([srctool, '--help']):
+                    gtar = bb.utils.which(path, "gtar", executable=True)
+                    if gtar:
+                        srctool = gtar
             # gcc/g++ may link to ccache on some hosts, e.g.,
             # /usr/local/bin/ccache/gcc -> /usr/bin/ccache, then which(gcc)
             # would return /usr/local/bin/ccache/gcc, but what we need is
-- 
2.38.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#172229): 
https://lists.openembedded.org/g/openembedded-core/message/172229
Mute This Topic: https://lists.openembedded.org/mt/94616037/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to