kernel/parallel_xz.sh
Justin M. Forbes 14694918cd kernel-5.11.0-0.rc0.20201217gite994cc240a3b.102
* Thu Dec 17 2020 Fedora Kernel Team <kernel-team@fedoraproject.org> [5.11.0-0.rc0.20201217gite994cc240a3b.102]
- build_configs.sh: Fix syntax flagged by shellcheck (Ben Crocker)
- genspec.sh: Fix syntax flagged by shellcheck (Ben Crocker)
- ark-rebase-patches.sh: Fix for shellcheck (Ben Crocker)
- ark-create-release.sh: Fix syntax flagged by shellcheck (Ben Crocker)
- merge-subtrees.sh: Fix syntax flagged by shellcheck (Ben Crocker)
- rh-dist-git.sh: Fix syntax flagged by shellcheck (Ben Crocker)
- update_scripts.sh: Fix syntax flagged by shellcheck (Ben Crocker)
- x86_rngd.sh: Fix syntax flagged by shellcheck (Ben Crocker)
- parallel_xz.sh: Fix syntax flagged by shellcheck (Ben Crocker)
- expand_srpm.sh: Fix syntax flagged by shellcheck (Ben Crocker)
- create-tarball.sh: Fix syntax flagged by shellcheck (Ben Crocker)
- generate_bls_conf.sh: Fix syntax flagged by shellcheck (Ben Crocker)
- clone_tree.sh: Fix syntax flagged by shellcheck (Ben Crocker)
- new_release.sh: Fix syntax flagged by shellcheck (Ben Crocker)
- download_cross.sh: Fix syntax flagged by shellcheck (Ben Crocker)
- create_distgit_changelog.sh: Fix syntax flagged by shellcheck (Ben Crocker)
- generate_cross_report.sh: Fix syntax flagged by shellcheck (Ben Crocker)
- run_kabi-dw.sh: Fix syntax flagged by shellcheck (Ben Crocker)
- mod-blacklist.sh: Fix syntax flagged by shellcheck (Ben Crocker)
- scripts/configdiff.sh: Fix syntax flagged by shellcheck (Ben Crocker)
Resolves: rhbz#

Signed-off-by: Justin M. Forbes <jforbes@fedoraproject.org>
2020-12-17 11:17:34 -06:00

27 lines
733 B
Bash
Executable File

#!/bin/sh
# Reads filenames on stdin, xz-compresses each in place.
# Not optimal for "compress relatively few, large files" scenario!
# How many xz's to run in parallel:
procgroup=""
while test "$#" != 0; do
# Get it from -jNUM
N="${1#-j}"
if test "$N" = "$1"; then
# Not -j<something> - warn and ignore
echo "parallel_xz: warning: unrecognized argument: '$1'"
else
procgroup="$N"
fi
shift
done
# If told to use only one cpu:
test "$procgroup" || exec xargs -r xz
test "$procgroup" = 1 && exec xargs -r xz
# xz has some startup cost. If files are really small,
# this cost might be significant. To combat this,
# process several files (in sequence) by each xz process via -n 16:
exec xargs -r -n 16 -P "$procgroup" xz