enable parallel xz compression of modules

So this uses the -P option for xargs to allow parallel compression
of xz uaing xargs options, it allows maximum usage of available CPUs
it can be reverted to the prior status quo but running the following
sed -i 's/global zcpu `nproc --all`/global zcpu 1/' kernel.spec
This commit is contained in:
Peter Robinson 2019-06-21 22:02:13 +01:00
parent 2a7e3ab552
commit b0bc74c236
1 changed files with 3 additions and 1 deletions

View File

@ -22,6 +22,8 @@ Summary: The Linux kernel
%if %{zipmodules}
%global zipsed -e 's/\.ko$/\.ko.xz/'
# for parallel xz processes, replace with 1 to go back to single process
%global zcpu `nproc --all`
%endif
# define buildid .local
@ -1559,7 +1561,7 @@ BuildKernel %make_target %kernel_image %{_use_vdso}
fi \
fi \
if [ "%{zipmodules}" -eq "1" ]; then \
find $RPM_BUILD_ROOT/lib/modules/ -type f -name '*.ko' | xargs xz; \
find $RPM_BUILD_ROOT/lib/modules/ -type f -name '*.ko' | xargs -P%{zcpu} xz; \
fi \
%{nil}