diff mbox series

[5/5] fetch: Improve tar pipeline unpack commands

Message ID 20260604133446.2528212-5-richard.purdie@linuxfoundation.org
State New
Headers show
Series [1/5] fetch2: Reorder unpack code to facilitate changes | expand

Commit Message

Richard Purdie June 4, 2026, 1:34 p.m. UTC
When originally implemented, tar didn't support many of the compression options so
it was easier for the code to use pipelines. tar does support these now, so we
can switch to using them.

zstd isn't converted since the --zstd option isn't present in tar v1.30 present
on RHEL 8 derived distros.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 lib/bb/fetch2/__init__.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py
index 58359896602..088136bb627 100644
--- a/lib/bb/fetch2/__init__.py
+++ b/lib/bb/fetch2/__init__.py
@@ -1584,17 +1584,17 @@  class FetchMethod(object):
             elif file.endswith('.tgz') or file.endswith('.tar.gz') or file.endswith('.tar.Z'):
                 cmd = tar_cmd + ['-z', '-f', file]
             elif file.endswith('.tbz') or file.endswith('.tbz2') or file.endswith('.tar.bz2'):
-                cmd = 'bzip2 -dc %s | %s -f -' % (file, shlex.join(tar_cmd))
+                cmd = tar_cmd + ['-j', '-f', file]
             elif file.endswith('.gz') or file.endswith('.Z') or file.endswith('.z'):
                 cmd = 'gzip -dc %s > %s' % (file, efile)
             elif file.endswith('.bz2'):
                 cmd = 'bzip2 -dc %s > %s' % (file, efile)
             elif file.endswith('.txz') or file.endswith('.tar.xz'):
-                cmd = 'xz -dc %s | %s -f -' % (file, shlex.join(tar_cmd))
+                cmd = tar_cmd + ['-J', '-f', file]
             elif file.endswith('.xz'):
                 cmd = 'xz -dc %s > %s' % (file, efile)
             elif file.endswith('.tar.lz'):
-                cmd = 'lzip -dc %s | %s -f -' % (file, shlex.join(tar_cmd))
+                cmd = tar_cmd + ['--lzip', '-f', file]
             elif file.endswith('.lz'):
                 cmd = 'lzip -dc %s > %s' % (file, efile)
             elif file.endswith('.tar.7z'):