diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2015-10-01 19:43:58 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2015-10-01 19:53:09 +0000 |
commit | 1500a0a136fcf89af50be0364d9f70f77dc595e0 (patch) | |
tree | 1db6bb0833da718d3d584293276b2e7da3dbe50b | |
parent | 3514a493f2c8cca84215f0d24aa927ace4597727 (diff) | |
download | buildslave-scripts-1500a0a136fcf89af50be0364d9f70f77dc595e0.tar.gz |
Replace ncpus logic with something easier to debug and hopefully more reliable
-rwxr-xr-x | build_a_system.sh | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/build_a_system.sh b/build_a_system.sh index d38b8ce..c2a6e36 100755 --- a/build_a_system.sh +++ b/build_a_system.sh @@ -16,13 +16,17 @@ ybd_dir="$(pwd)/ybd" # x86 VPS, but we'd like to see some parallelism on the ARM builders, # which have 8 CPUs total, so we'd need to have 4 to see any parallelism. cpus_per_instance=4 +ncpus="$(nproc)" # Determine the number of instances to have such that each has at least # the specified number of CPUs but not more than double it. # STYLE NOTE: Substitutions are intentionally not quoted here, since in # some shells arithmetic expansion doesn't follow the traditional POSIX # word splitting, so quotes aren't removed. -instances="$(( $(nproc) / $cpus_per_instance == 0 ? 1 : $(nproc) / $cpus_per_instance ))" +instances="$(expr "$ncpus" / "$cpus_per_instance")" +if [ "$instances" -eq 0 ]; then + instances=1 +fi sudo sed -i "/^instances: /c\\instances: $instances" "$ybd_dir"/ybd.conf # will this build things - No. |