diff --git a/config/functions b/config/functions index d702ce7a67..2a2f0e1508 100644 --- a/config/functions +++ b/config/functions @@ -775,6 +775,11 @@ do_autoreconf() { fi } +# True if this is a sequential build, false if multithreaded +is_sequential_build() { + [ "${MTWITHLOCKS}" != "yes" ] && return 0 || return 1 +} + ### PACKAGE HELPERS ### # get variable ($2) for package ($1). @@ -1366,7 +1371,7 @@ enable_service() { ### MULTI-THREADED FUNCTION HELPERS ### -# Test MTWITHLOCKS so that these functions are a no-op during non-multithreaded builds. +# Test build type so that these functions are a no-op during non-multithreaded builds. # Prevent concurrent modifications to a package (unpack) or # package:target (install/build). @@ -1374,7 +1379,7 @@ enable_service() { # If a package is already locked and the owner is ourselves # then assume we already have the required lock. pkg_lock() { - [ "${MTWITHLOCKS}" != "yes" ] && return 0 + is_sequential_build && return 0 local pkg="$1" task="$2" parent_pkg="$3" local this_job="${MTJOBID}" @@ -1414,7 +1419,7 @@ EOF # Log additional information for a locked package. pkg_lock_status() { - [ "${MTWITHLOCKS}" != "yes" ] && return 0 + is_sequential_build && return 0 local status="$1" pkg="$2" task="$3" msg="$4" local this_job="${MTJOBID}" line idwidth @@ -1453,7 +1458,7 @@ pkg_lock_status() { } update_dashboard() { - [ "${MTWITHLOCKS}" != "yes" ] && return 0 + is_sequential_build && return 0 local status="$1" pkg="$2" task="$3" msg="$4" local line preamble num elapsed projdevarch @@ -1503,7 +1508,7 @@ update_dashboard() { # Thread concurrency helpers to avoid concurrency issues with some code, # eg. when Python installs directly into $TOOLCHAIN. acquire_exclusive_lock() { - [ "${MTWITHLOCKS}" != "yes" ] && return 0 + is_sequential_build && return 0 local pkg="$1" task="$2" lockfile="${3:-global}" local this_job="${MTJOBID}" @@ -1528,7 +1533,7 @@ acquire_exclusive_lock() { } release_exclusive_lock() { - [ "${MTWITHLOCKS}" != "yes" ] && return 0 + is_sequential_build && return 0 local pkg="$1" task="$2" lockfile="${3:-global}"