diff mbox series

base: Allow zstd and xz decompression from the host tools

Message ID 20260605113641.3595753-1-richard.purdie@linuxfoundation.org
State Under Review
Headers show
Series base: Allow zstd and xz decompression from the host tools | expand

Commit Message

Richard Purdie June 5, 2026, 11:36 a.m. UTC
We have xz and zstd in HOSTTOOLS but not ASSUME_PROVIDED. In most cases where
we have a dependency on xz-native or zstd-native, we need to compress files
or we need the libraries those recipes provide. In some cases we just need
decompression though.

Compression output is version dependent so we need those dependencies. Libraries
need headers so those are needed too. THe main place we could benefit are the
unpack dependencies from base.bbclass.

Therefore add "XXX-decompress" PROVIDES to those recipes, then change the
dependency in base.bbclass to indicate decompression only. We can then
ASSUME_PROVIDED the decompression side of things to optimise builds whilst
still keeping the other dependencies functional.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 meta/classes-global/base.bbclass         | 8 ++++----
 meta/conf/bitbake.conf                   | 2 ++
 meta/recipes-extended/xz/xz_5.8.3.bb     | 2 ++
 meta/recipes-extended/zstd/zstd_1.5.7.bb | 2 ++
 4 files changed, 10 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/meta/classes-global/base.bbclass b/meta/classes-global/base.bbclass
index d462593c4e0..4684dbd60c8 100644
--- a/meta/classes-global/base.bbclass
+++ b/meta/classes-global/base.bbclass
@@ -663,7 +663,7 @@  python () {
 
         # *.zst should DEPEND on zstd-native for unpacking
         elif path.endswith('.zst'):
-            d.appendVarFlag('do_unpack', 'depends', ' zstd-native:do_populate_sysroot')
+            d.appendVarFlag('do_unpack', 'depends', ' zstd-decompress-native:do_populate_sysroot')
 
         # *.lz should DEPEND on lzip-native for unpacking
         elif path.endswith('.lz'):
@@ -671,7 +671,7 @@  python () {
 
         # *.xz should DEPEND on xz-native for unpacking
         elif path.endswith('.xz') or path.endswith('.txz'):
-            d.appendVarFlag('do_unpack', 'depends', ' xz-native:do_populate_sysroot')
+            d.appendVarFlag('do_unpack', 'depends', ' xz-decompress-native:do_populate_sysroot')
 
         # .zip should DEPEND on unzip-native for unpacking
         elif path.endswith('.zip') or path.endswith('.jar'):
@@ -679,11 +679,11 @@  python () {
 
         # Some rpm files may be compressed internally using xz (for example, rpms from Fedora)
         elif path.endswith('.rpm'):
-            d.appendVarFlag('do_unpack', 'depends', ' xz-native:do_populate_sysroot')
+            d.appendVarFlag('do_unpack', 'depends', ' xz-decompress-native:do_populate_sysroot')
 
         # *.deb should DEPEND on xz-native for unpacking
         elif path.endswith('.deb'):
-            d.appendVarFlag('do_unpack', 'depends', ' xz-native:do_populate_sysroot')
+            d.appendVarFlag('do_unpack', 'depends', ' xz-decompress-native:do_populate_sysroot')
 
         # *.7z should DEPEND on 7zip-native for unpacking
         elif path.endswith('.7z'):
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 4eb235da60a..27d747536e4 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -234,6 +234,8 @@  ASSUME_PROVIDED = "\
     virtual/libiconv-native \
     virtual/libintl-native \
     wget-native \
+    xz-decompress-native \
+    zstd-decompress-native \
     "
 # gzip-native should be listed above?
 
diff --git a/meta/recipes-extended/xz/xz_5.8.3.bb b/meta/recipes-extended/xz/xz_5.8.3.bb
index 74efe561c6b..0c0886fa7aa 100644
--- a/meta/recipes-extended/xz/xz_5.8.3.bb
+++ b/meta/recipes-extended/xz/xz_5.8.3.bb
@@ -3,6 +3,8 @@  HOMEPAGE = "https://tukaani.org/xz/"
 DESCRIPTION = "XZ Utils is free general-purpose data compression software with a high compression ratio. XZ Utils were written for POSIX-like systems, but also work on some not-so-POSIX systems. XZ Utils are the successor to LZMA Utils."
 SECTION = "base"
 
+PROVIDES += "xz-decompress"
+
 # The source includes bits of 0BSD, GPL-2.0, GPL-3.0, LGPL-2.1-or-later, but the
 # only file which is GPL-3.0 is an m4 macro which isn't shipped in any of our
 # packages, and the LGPL bits are under lib/, which appears to be used for
diff --git a/meta/recipes-extended/zstd/zstd_1.5.7.bb b/meta/recipes-extended/zstd/zstd_1.5.7.bb
index 66e326f386e..8d147dbeed9 100644
--- a/meta/recipes-extended/zstd/zstd_1.5.7.bb
+++ b/meta/recipes-extended/zstd/zstd_1.5.7.bb
@@ -5,6 +5,8 @@  It's backed by a very fast entropy stage, provided by Huff0 and FSE library."
 HOMEPAGE = "http://www.zstd.net/"
 SECTION = "console/utils"
 
+PROVIDES += "zstd-decompress"
+
 LICENSE = "BSD-3-Clause | GPL-2.0-only"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=0822a32f7acdbe013606746641746ee8 \
                     file://COPYING;md5=39bba7d2cf0ba1036f2a6e2be52fe3f0 \