From 43ae09aee53cb049da3dc9b7b87a380b19a1925e Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Tue, 30 Apr 2024 14:20:33 +0200 Subject: [PATCH] make-srpm.sh: use the pxz compressor if available ... to speed up creation of .tar.xz on a multicore machine. After the recent extension of the test-suite, compression of the distribution tarball started to take too much time. This change makes it reasonably fast again in my development environment. Closes: https://github.com/csutils/csdiff/pull/175 --- make-srpm.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/make-srpm.sh b/make-srpm.sh index 3fb3b3c5..90da96db 100755 --- a/make-srpm.sh +++ b/make-srpm.sh @@ -68,7 +68,13 @@ if [[ "$1" != "--generate-spec" ]]; then git archive --prefix="$NV/" --format="tar" HEAD -- . > "$SRC_TAR" \ || die "failed to export sources" - xz -c "$SRC_TAR" > "$SRC" || die "failed to compress sources" + # use pxz (threaded xz) if available to speed up the compression + if pxz --version | grep '^Parallel PXZ' > /dev/null; then + XZ=pxz + else + XZ=xz + fi + $XZ -c "$SRC_TAR" > "$SRC" || die "failed to compress sources with ${XZ}" fi SPEC="./$PKG.spec"