common: Make sure that NUM_JOBS is a positive integer

This commit is contained in:
Krzesimir Nowak 2021-02-17 09:52:48 +01:00
parent 6ed7cd66d5
commit a6a6e0be2c

View File

@ -8,7 +8,10 @@
# The number of jobs to pass to tools that can run in parallel (such as make # The number of jobs to pass to tools that can run in parallel (such as make
# and dpkg-buildpackage # and dpkg-buildpackage
if [[ -z ${NUM_JOBS} ]]; then case "${NUM_JOBS}" in
*[!0-9]*) NUM_JOBS='' ;;
esac
if [[ -z ${NUM_JOBS} ]] || [[ ${NUM_JOBS} -eq 0 ]]; then
NUM_JOBS=$(grep -c "^processor" /proc/cpuinfo) NUM_JOBS=$(grep -c "^processor" /proc/cpuinfo)
fi fi
# Ensure that any sub scripts we invoke get the max proc count. # Ensure that any sub scripts we invoke get the max proc count.