From 6e5a6073b8549e9de25108dbad6176f319603f5b Mon Sep 17 00:00:00 2001 From: Johannes Kimmel Date: Mon, 11 Jan 2021 08:36:02 +0100 Subject: [PATCH] buildscript: count available cpus with nproc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Grepping `/proc/cpuinfo` does not yield the correct number of available cpus when running in a docker container or setting the number of available cpus with taskset. ``` $ taskset 1 grep -c processor /proc/cpuinfo 8 $ taskset 1 nproc 1 ``` This will prevent using too many build jobs on environments where the number of available cpus is reduced. `nproc` is part of `coreutils`. Signed-off-by: Johannes Kimmel Reviewed-by: Fabian Bläse Reviewed-by: Robert Langhammer --- buildscript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildscript b/buildscript index 81ae501..2108ad0 100755 --- a/buildscript +++ b/buildscript @@ -230,7 +230,7 @@ build() { opath=$(pwd) cd "$builddir" - cpus=$(grep -c processor /proc/cpuinfo) + cpus=$(nproc) case "$1" in "debug")