Skip to contentSkip to conversation

package_rpm: use zstd instead of xz

PATCH New Alexander Kanavin 1 participant 1 message Oct 4, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package_rpm: use zstd instead of xz

zstd has similar time and space performance in compression but is vastly faster in decompression, which benefits rootfs creation (especially when installing very large packages) and on-target package installation.

Also, ensure ZSTD_THREADS doesn't change sstate checksums. The detailed explanation is in the commit making similar change for XZ_THREADS.

---
 meta/classes/package_rpm.bbclass | 4 ++--
 meta/conf/bitbake.conf           | 4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)
meta/classes/package_rpm.bbclass +2 -2
index 1c62d8283b..e738806fd7 100644
@@ -684,8 +684,8 @@ python do_package_rpm () {
     cmd = cmd + " --define '_use_internal_dependency_generator 0'"
     cmd = cmd + " --define '_binaries_in_noarch_packages_terminate_build 0'"
     cmd = cmd + " --define '_build_id_links none'"
-    cmd = cmd + " --define '_binary_payload w6T%d.xzdio'" % int(d.getVar("XZ_THREADS"))
-    cmd = cmd + " --define '_source_payload w6T%d.xzdio'" % int(d.getVar("XZ_THREADS"))
+    cmd = cmd + " --define '_binary_payload w19T%d.zstdio'" % int(d.getVar("ZSTD_THREADS"))
+    cmd = cmd + " --define '_source_payload w19T%d.zstdio'" % int(d.getVar("ZSTD_THREADS"))
     cmd = cmd + " --define 'clamp_mtime_to_source_date_epoch 1'"
     cmd = cmd + " --define 'use_source_date_epoch_as_buildtime 1'"
     cmd = cmd + " --define '_buildhost reproducible'"
meta/conf/bitbake.conf +4 -0
index e25d632dc1..1ae377750b 100644
@@ -815,6 +815,10 @@ XZ_THREADS[vardepvalue] = "1"
 XZ_DEFAULTS ?= "--memlimit=${XZ_MEMLIMIT} --threads=${XZ_THREADS}"
 XZ_DEFAULTS[vardepsexclude] += "XZ_MEMLIMIT XZ_THREADS"
 
+# Default parallelism for zstd
+ZSTD_THREADS ?= "${@oe.utils.cpu_count(at_least=2)}"
+ZSTD_THREADS[vardepvalue] = "1"
+
 # Limit the number of threads that OpenMP libraries will use. Otherwise they
 # may fallback to using all CPUs
 export OMP_NUM_THREADS = "${BB_NUMBER_THREADS}"
Signature · 1 line
2.31.1