buildsystem: add is_sequential_build() helper

This commit is contained in:
MilhouseVH 2019-12-29 23:14:37 +00:00
parent 439f38bcff
commit 96c510394d

View File

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