Set distcc variables at the scriptmodule function calling stage

Only configure distcc variables if a module does not have the "nodistcc" flag.

Skip builder/setup modules to avoid having distcc changes propagate to modules built from them.

This allows easily disabling distcc for certain modules that are not compatible.
This commit is contained in:
Jools Wills 2024-04-16 22:33:12 +01:00
parent 9aa86b8f2d
commit cf0e098106
2 changed files with 10 additions and 6 deletions

View file

@ -112,6 +112,16 @@ function rp_callModule() {
return 3
fi
# skip for modules 'builder' and 'setup' so that distcc settings do not propagate from them
if [[ "$md_id" != "builder" && "$md_id" != "setup" ]]; then
# if distcc is used and the module doesn't exclude it, add /usr/lib/distcc to PATH and MAKEFLAGS
if [[ -n "$DISTCC_HOSTS" ]] && ! hasFlag "${__mod_info[$md_id/flags]}" "nodistcc"; then
# use local variables so they are available to all child functions without changing the globals
local PATH="/usr/lib/distcc:$PATH"
local MAKEFLAGS="$MAKEFLAGS PATH=$PATH"
fi
fi
# parameters _auto_ _binary or _source_ (_source_ is used if no parameters are given for a module)
case "$mode" in
# install the module if not installed, and update if it is

View file

@ -145,12 +145,6 @@ function conf_build_vars() {
export ASFLAGS="$__asflags"
export MAKEFLAGS="$__makeflags"
# if using distcc, add /usr/lib/distcc to PATH/MAKEFLAGS
if [[ -n "$DISTCC_HOSTS" ]]; then
PATH="/usr/lib/distcc:$PATH"
MAKEFLAGS+=" PATH=$PATH"
fi
# if __use_ccache is set, then add ccache to PATH/MAKEFLAGS
if [[ "$__use_ccache" -eq 1 ]]; then
PATH="/usr/lib/ccache:$PATH"