|
|
e9fa07 |
#
|
|
|
8d7a8a |
# Copyright (c) 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 LucĂa Andrea Illanes Albornoz <lucia@luciaillanes.de>
|
|
|
e9fa07 |
# set +o errexit -o noglob -o nounset is assumed.
|
|
|
e9fa07 |
#
|
|
|
e9fa07 |
|
|
|
e9fa07 |
#
|
|
|
e9fa07 |
# exp_pkg_dispatch_complete() - XXX
|
|
|
e9fa07 |
# @_dispatch_fn: top-level dispatch function name
|
|
|
e9fa07 |
# @_group_names: build group name(s)
|
|
|
e9fa07 |
# @_pkg_disabled: list of disabled packages
|
|
|
e9fa07 |
# @_pkg_finished: list of finished packages
|
|
|
e9fa07 |
#
|
|
|
e9fa07 |
# Return: zero (0) on success, non-zero (>0) on failure.
|
|
|
e9fa07 |
#
|
|
|
e9fa07 |
exp_pkg_dispatch_complete() {
|
|
|
e9fa07 |
local _epdc_dispatch_fn="${1}" _epdc_group_name="${2}" _epdc_pkg_disabled="${3}" \
|
|
|
e9fa07 |
_epdc_pkg_finished="${4}" \
|
|
|
e9fa07 |
_epdc_pkg_name="";
|
|
|
e9fa07 |
|
|
|
e9fa07 |
for _epdc_pkg_name in ${_epdc_pkg_disabled}; do
|
|
|
e9fa07 |
"${_epdc_dispatch_fn}" disabled_pkg "${_epdc_group_name}" "${_epdc_pkg_name}";
|
|
|
e9fa07 |
done;
|
|
|
e9fa07 |
for _epdc_pkg_name in ${_epdc_pkg_finished}; do
|
|
|
e9fa07 |
"${_epdc_dispatch_fn}" skipped_pkg "${_epdc_group_name}" "${_epdc_pkg_name}";
|
|
|
e9fa07 |
done;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
return 0;
|
|
|
e9fa07 |
};
|
|
|
e9fa07 |
|
|
|
e9fa07 |
#
|
|
|
e9fa07 |
# exp_pkg_dispatch_expand_packages() - expand build group name to list of packages ordered and filtered according to dependency and restart constraints
|
|
|
e9fa07 |
# @_rdisabled: reference to out variable of disabled packages
|
|
|
e9fa07 |
# @_rfinished: reference to out variable of finished packages
|
|
|
e9fa07 |
# @_rnames: reference to out variable of package names
|
|
|
e9fa07 |
# @_checkfl: enable (1) or inhibit (0) dependency expansion
|
|
|
e9fa07 |
# @_forcefl: enable (1) or inhibit (0) forcibly rebuilding finished packages
|
|
|
e9fa07 |
# @_group_name: build group name
|
|
|
e9fa07 |
# @_restart: optional whitespace-separated list of package names to rebuild
|
|
|
e9fa07 |
# @_reversefl: unfold reverse dependencies (1) or dependencies (0)
|
|
|
e9fa07 |
# @_workdir: pathname to build-specific temporary directory
|
|
|
e9fa07 |
#
|
|
|
e9fa07 |
# Return: zero (0) on success, non-zero (>0) on failure.
|
|
|
e9fa07 |
#
|
|
|
e9fa07 |
exp_pkg_dispatch_expand_packages() {
|
|
|
e9fa07 |
local _epdep_rdisabled="${1#\$}" _epdep_rfinished="${2#\$}" _epdep_rnames="${3#\$}" \
|
|
|
e9fa07 |
_epdep_checkfl="${4}" _epdep_forcefl="${5}" _epdep_group_name="${6}" \
|
|
|
e9fa07 |
_epdep_restart="${7}" _epdep_reversefl="${8}" _epdep_workdir="${9}" \
|
|
|
e9fa07 |
_epdep_pkg_names="";
|
|
|
e9fa07 |
|
|
|
e9fa07 |
eval ${_epdep_rdisabled}=;
|
|
|
e9fa07 |
eval ${_epdep_rfinished}=;
|
|
|
e9fa07 |
eval ${_epdep_rnames}=;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
if rtl_get_var_unsafe \$_epdep_pkg_names -u "${_epdep_group_name}_PACKAGES"\
|
|
|
e9fa07 |
&& [ "${_epdep_pkg_names:+1}" = 1 ]; then
|
|
|
e9fa07 |
if [ "${_epdep_reversefl:-0}" -eq 0 ]; then
|
|
|
e9fa07 |
ex_pkg_unfold_depends \
|
|
|
e9fa07 |
"${_epdep_rdisabled}" "${_epdep_rfinished}" \
|
|
|
e9fa07 |
"${_epdep_rnames}" "${_epdep_checkfl}" "${_epdep_forcefl}" \
|
|
|
e9fa07 |
"${_epdep_group_name}" "${_epdep_pkg_names}" \
|
|
|
e9fa07 |
"${_epdep_restart}" 1 "${_epdep_workdir}";
|
|
|
e9fa07 |
else
|
|
|
e9fa07 |
ex_pkg_unfold_rdepends \
|
|
|
e9fa07 |
"${_epdep_rdisabled}" "${_epdep_rfinished}" \
|
|
|
e9fa07 |
"${_epdep_rnames}" "${_epdep_group_name}" \
|
|
|
e9fa07 |
"${_epdep_pkg_names}" "${_epdep_restart}" 1 \
|
|
|
e9fa07 |
"${_epdep_workdir}";
|
|
|
e9fa07 |
fi;
|
|
|
e9fa07 |
fi;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
eval ${_epdep_rdisabled}='$(rtl_uniq2 "${_epdep_rdisabled}")';
|
|
|
e9fa07 |
eval ${_epdep_rfinished}='$(rtl_uniq2 "${_epdep_rfinished}")';
|
|
|
e9fa07 |
eval ${_epdep_rnames}='$(rtl_uniq2 "${_epdep_rnames}")';
|
|
|
e9fa07 |
|
|
|
e9fa07 |
return 0;
|
|
|
e9fa07 |
};
|
|
|
e9fa07 |
|
|
|
e9fa07 |
#
|
|
|
e9fa07 |
# exp_pkg_dispatch_group() - dispatch a single build group
|
|
|
e9fa07 |
# @_rdispatch_count: reference to inout variable of dispatcher count
|
|
|
e9fa07 |
# @_rdispatch_count_cur: reference to inout variable of current dispatcher count
|
|
|
e9fa07 |
# @_dispatch_count_max: maximum dispatcher count
|
|
|
e9fa07 |
# @_dispatch_group_cur: current group
|
|
|
e9fa07 |
# @_dispatch_group_max: maximum group
|
|
|
e9fa07 |
# @_rdispatch_njobs: reference to inout variable of dispatcher count
|
|
|
e9fa07 |
# @_rdispatch_wait: reference to inout variable of package names in a wait state
|
|
|
e9fa07 |
# @_rpkg_disabled: reference to in variable of list of disabled packages
|
|
|
e9fa07 |
# @_rpkg_finished: reference to inout variable of list of finished packages
|
|
|
e9fa07 |
# @_rpkg_names: reference to inout variable of list of package names
|
|
|
e9fa07 |
# @_build_steps_default: list of default build steps
|
|
|
e9fa07 |
# @_build_vars_default: list of default build variables
|
|
|
e9fa07 |
# @_checkfl: enable (1) or inhibit (0) dependency expansion
|
|
|
e9fa07 |
# @_dispatch_fn: top-level dispatch function name
|
|
|
e9fa07 |
# @_group_name: build group name
|
|
|
e9fa07 |
# @_njobs_max: maximum count of simultaneous jobs
|
|
|
e9fa07 |
# @_pipe_path: pathname to build FIFO
|
|
|
e9fa07 |
# @_restart_at: optional comma-separated list of build steps at which to rebuild or ALL or LAST
|
|
|
e9fa07 |
# @_workdir: pathname to build-specific temporary directory
|
|
|
e9fa07 |
#
|
|
|
e9fa07 |
# Return: zero (0) on success, non-zero (>0) on failure.
|
|
|
e9fa07 |
#
|
|
|
e9fa07 |
exp_pkg_dispatch_group() {
|
|
|
e9fa07 |
local _epdg_rdispatch_count="${1#\$}" _epdg_rdispatch_count_cur="${2#\$}" _epdg_dispatch_count_max="${3#\$}" \
|
|
|
e9fa07 |
_epdg_dispatch_group_cur="${4#\$}" _epdg_dispatch_group_max="${5#\$}" _epdg_rdispatch_njobs="${6#\$}" \
|
|
|
e9fa07 |
_epdg_rdispatch_wait="${7#\$}" _epdg_rpkg_disabled="${8#\$}" _epdg_rpkg_finished="${9#\$}" \
|
|
|
e9fa07 |
_epdg_rpkg_names="${10#\$}" _epdg_build_steps_default="${11}" _epdg_build_vars_default="${12}" \
|
|
|
e9fa07 |
_epdg_checkfl="${13}" _epdg_dispatch_fn="${14}" _epdg_group_name="${15}" _epdg_njobs_max="${16}" \
|
|
|
e9fa07 |
_epdg_pipe_path="${17}" _epdg_restart_at="${18}" _epdg_workdir="${19}" \
|
|
|
e9fa07 |
_epdg_perc_group=0 _epdg_perc_pkg=0 _epdg_pipe_msg="" _epdg_pkg_name="" _epdg_rc=0;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
rtl_fileop mkfifo "${_epdg_pipe_path}";
|
|
|
e9fa07 |
while true; do
|
|
|
e9fa07 |
while eval [ \"\${${_epdg_rdispatch_njobs}:-0}\" -gt 0 ]\
|
|
|
e9fa07 |
&& read _epdg_pipe_msg;
|
|
|
e9fa07 |
do
|
|
|
e9fa07 |
|
|
|
e9fa07 |
case "${_epdg_pipe_msg%% *}" in
|
|
|
e9fa07 |
|
|
|
e9fa07 |
done) _epdg_pkg_name="${_epdg_pipe_msg#done * }";
|
|
|
e9fa07 |
eval : '$(('${_epdg_rdispatch_count_cur}'+=1))';
|
|
|
e9fa07 |
eval : '$(('${_epdg_rdispatch_njobs}'-=1))';
|
|
|
e9fa07 |
|
|
|
e9fa07 |
rtl_lconcat "${_epdg_rpkg_finished}" "${_epdg_pkg_name}";
|
|
|
e9fa07 |
rtl_percentage2 \$_epdg_dispatch_group_cur \$_epdg_dispatch_group_max \$_epdg_perc_group;
|
|
|
e9fa07 |
rtl_percentage2 "${_epdg_rdispatch_count_cur}" \$_epdg_dispatch_count_max \$_epdg_perc_pkg;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
"${_epdg_dispatch_fn}" \
|
|
|
e9fa07 |
finish_pkg ${_epdg_pipe_msg#done } \
|
|
|
e9fa07 |
"${_epdg_dispatch_count_max}" \
|
|
|
e9fa07 |
"${_epdg_perc_group}" "${_epdg_perc_pkg}";
|
|
|
e9fa07 |
|
|
|
e9fa07 |
rtl_lfilter "${_epdg_rpkg_names}" "${_epdg_pkg_name}";
|
|
|
e9fa07 |
rtl_lfilter "${_epdg_rdispatch_wait}" "${_epdg_pkg_name}";
|
|
|
e9fa07 |
|
|
|
e9fa07 |
if eval [ \"\${${_epdg_rpkg_names}:+1}\" = 1 ]\
|
|
|
e9fa07 |
&& [ "${_epdg_rc}" -eq 0 ];
|
|
|
e9fa07 |
then
|
|
|
e9fa07 |
if eval [ \"\${${_epdg_rdispatch_njobs}:-0}\" -ne \"\${_epdg_njobs_max}\" ]; then
|
|
|
e9fa07 |
exp_pkg_dispatch_packages \
|
|
|
e9fa07 |
"${_epdg_rdispatch_count}" \
|
|
|
e9fa07 |
"${_epdg_rdispatch_count_cur}" \
|
|
|
e9fa07 |
"${_epdg_dispatch_count_max}" \
|
|
|
e9fa07 |
"${_epdg_dispatch_group_cur}" \
|
|
|
e9fa07 |
"${_epdg_dispatch_group_max}" \
|
|
|
e9fa07 |
"${_epdg_rdispatch_njobs}" \
|
|
|
e9fa07 |
"${_epdg_rdispatch_wait}" \
|
|
|
e9fa07 |
"${_epdg_rpkg_disabled}" \
|
|
|
e9fa07 |
"${_epdg_rpkg_finished}" "${_epdg_rpkg_names}" \
|
|
|
e9fa07 |
"${_epdg_build_steps_default}" \
|
|
|
e9fa07 |
"${_epdg_build_vars_default}" "${_epdg_checkfl}" \
|
|
|
e9fa07 |
"${_epdg_dispatch_fn}" "${_epdg_group_name}" \
|
|
|
e9fa07 |
"${_epdg_njobs_max}" "${_epdg_pipe_path}" \
|
|
|
e9fa07 |
"${_epdg_restart_at}" "${_epdg_workdir}";
|
|
|
e9fa07 |
fi;
|
|
|
e9fa07 |
elif eval [ \"\${${_epdg_rdispatch_njobs}:-0}\" -eq 0 ]; then
|
|
|
e9fa07 |
break;
|
|
|
e9fa07 |
fi;
|
|
|
e9fa07 |
;;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
fail) eval : '$(('${_epdg_rdispatch_njobs}'-=1))';
|
|
|
e9fa07 |
_epdg_rc=1;
|
|
|
e9fa07 |
"${_epdg_dispatch_fn}" \
|
|
|
e9fa07 |
fail_pkg ${_epdg_pipe_msg#fail } \
|
|
|
e9fa07 |
"${_epdg_dispatch_count_max}";
|
|
|
e9fa07 |
;;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
msg_pkg)
|
|
|
e9fa07 |
"${_epdg_dispatch_fn}" msg_pkg ${_epdg_pipe_msg#msg_pkg };
|
|
|
e9fa07 |
;;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
step) "${_epdg_dispatch_fn}" step_pkg ${_epdg_pipe_msg#step };
|
|
|
e9fa07 |
;;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
esac; done <>"${_epdg_pipe_path}";
|
|
|
e9fa07 |
|
|
|
e9fa07 |
if eval [ \"\${${_epdg_rpkg_names}:+1}\" = 1 ]\
|
|
|
e9fa07 |
&& [ "${_epdg_rc}" -eq 0 ];
|
|
|
e9fa07 |
then
|
|
|
e9fa07 |
if eval [ \"\${${_epdg_rdispatch_njobs}:-0}\" -ne \"\${_epdg_njobs_max}\" ]; then
|
|
|
e9fa07 |
exp_pkg_dispatch_packages \
|
|
|
e9fa07 |
"${_epdg_rdispatch_count}" \
|
|
|
e9fa07 |
"${_epdg_rdispatch_count_cur}" \
|
|
|
e9fa07 |
"${_epdg_dispatch_count_max}" \
|
|
|
e9fa07 |
"${_epdg_dispatch_group_cur}" \
|
|
|
e9fa07 |
"${_epdg_dispatch_group_max}" \
|
|
|
e9fa07 |
"${_epdg_rdispatch_njobs}" \
|
|
|
e9fa07 |
"${_epdg_rdispatch_wait}" \
|
|
|
e9fa07 |
"${_epdg_rpkg_disabled}" \
|
|
|
e9fa07 |
"${_epdg_rpkg_finished}" "${_epdg_rpkg_names}" \
|
|
|
e9fa07 |
"${_epdg_build_steps_default}" \
|
|
|
e9fa07 |
"${_epdg_build_vars_default}" "${_epdg_checkfl}" \
|
|
|
e9fa07 |
"${_epdg_dispatch_fn}" "${_epdg_group_name}" \
|
|
|
e9fa07 |
"${_epdg_njobs_max}" "${_epdg_pipe_path}" \
|
|
|
e9fa07 |
"${_epdg_restart_at}" "${_epdg_workdir}";
|
|
|
e9fa07 |
fi;
|
|
|
e9fa07 |
elif eval [ \"\${${_epdg_rdispatch_njobs}:-0}\" -eq 0 ]; then
|
|
|
e9fa07 |
break;
|
|
|
e9fa07 |
fi;
|
|
|
e9fa07 |
done;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
rtl_fileop rm "${_epdg_pipe_path}";
|
|
|
e9fa07 |
|
|
|
e9fa07 |
return "${_epdg_rc}";
|
|
|
e9fa07 |
};
|
|
|
e9fa07 |
|
|
|
e9fa07 |
#
|
|
|
e9fa07 |
# exp_pkg_dispatch_packages() - dispatch set of packages
|
|
|
e9fa07 |
# @_rdispatch_count: reference to inout variable of dispatcher count
|
|
|
e9fa07 |
# @_dispatch_count_cur: current dispatcher count
|
|
|
e9fa07 |
# @_dispatch_count_max: maximum dispatcher count
|
|
|
e9fa07 |
# @_dispatch_group_cur: current group
|
|
|
e9fa07 |
# @_dispatch_group_max: maximum group
|
|
|
e9fa07 |
# @_rdispatch_njobs: reference to inout variable of dispatcher count
|
|
|
e9fa07 |
# @_rdispatch_wait: reference to inout variable of package names in a wait state
|
|
|
e9fa07 |
# @_rpkg_disabled: reference to in variable of list of disabled packages
|
|
|
e9fa07 |
# @_rpkg_finished: reference to inout variable of list of finished packages
|
|
|
e9fa07 |
# @_rpkg_names: reference to inout variable of list of package names
|
|
|
e9fa07 |
# @_build_steps_default: list of default build steps
|
|
|
e9fa07 |
# @_build_vars_default: list of default build variables
|
|
|
e9fa07 |
# @_checkfl: enable (1) or inhibit (0) dependency expansion
|
|
|
e9fa07 |
# @_dispatch_fn: top-level dispatch function name
|
|
|
e9fa07 |
# @_group_name: build group name
|
|
|
e9fa07 |
# @_njobs_max: maximum count of simultaneous jobs
|
|
|
e9fa07 |
# @_pipe_path: pathname to parent-child process FIFO
|
|
|
e9fa07 |
# @_restart_at: optional comma-separated list of build steps at which to rebuild or ALL or LAST
|
|
|
e9fa07 |
# @_workdir: pathname to build-specific temporary directory
|
|
|
e9fa07 |
#
|
|
|
e9fa07 |
# Return: zero (0) on success, non-zero (>0) on failure.
|
|
|
e9fa07 |
#
|
|
|
e9fa07 |
exp_pkg_dispatch_packages() {
|
|
|
e9fa07 |
local _epdp2_rdispatch_count="${1#\$}" _epdp2_dispatch_count_cur="${2}" _epdp2_dispatch_count_max="${3}" \
|
|
|
e9fa07 |
_epdp2_dispatch_group_cur="${4}" _epdp2_dispatch_group_max="${5}" _epdp2_rdispatch_njobs="${6#\$}" \
|
|
|
e9fa07 |
_epdp2_rdispatch_wait="${7#\$}" _epdp2_rpkg_disabled="${8#\$}" _epdp2_rpkg_finished="${9#\$}" \
|
|
|
e9fa07 |
_epdp2_rpkg_names="${10#\$}" _epdp2_build_steps_default="${11}" _epdp2_build_vars_default="${12}" \
|
|
|
e9fa07 |
_epdp2_checkfl="${13}" _epdp2_dispatch_fn="${14}" _epdp2_group_name="${15}" _epdp2_njobs_max="${16}" \
|
|
|
e9fa07 |
_epdp2_pipe_path="${17}" _epdp2_restart_at="${18}" _epdp2_workdir="${19}" \
|
|
|
e9fa07 |
_epdp2_foundfl=0 _epdp2_njob=0 _epdp2_pkg_depends="" _epdp2_pkg_name="";
|
|
|
e9fa07 |
|
|
|
e9fa07 |
while eval [ \"\${${_epdp2_rdispatch_njobs}}\" -lt \"\${_epdp2_njobs_max}\" ]; do
|
|
|
e9fa07 |
_epdp2_foundfl=0;
|
|
|
e9fa07 |
eval _epdp2_pkg_names="\${${_epdp2_rpkg_names}}";
|
|
|
e9fa07 |
for _epdp2_pkg_name in ${_epdp2_pkg_names}; do
|
|
|
e9fa07 |
if ! rtl_lmatch "${_epdp2_rdispatch_wait}" "${_epdp2_pkg_name}"\
|
|
|
e9fa07 |
&& ex_pkg_check_depends \
|
|
|
e9fa07 |
"${_epdp2_checkfl}" "${_epdp2_rpkg_disabled}" \
|
|
|
e9fa07 |
"${_epdp2_rpkg_finished}" "${_epdp2_pkg_name}" \
|
|
|
e9fa07 |
"${_epdp2_rpkg_names}" "${_epdp2_workdir}";
|
|
|
e9fa07 |
then
|
|
|
e9fa07 |
ex_pkg_exec \
|
|
|
e9fa07 |
"${_epdp2_rdispatch_count}" \
|
|
|
e9fa07 |
"${_epdp2_dispatch_count_cur}" "${_epdp2_dispatch_count_max}" \
|
|
|
e9fa07 |
"${_epdp2_dispatch_group_cur}" "${_epdp2_dispatch_group_max}" \
|
|
|
e9fa07 |
"${_epdp2_rdispatch_njobs}" "${_epdp2_rdispatch_wait}" \
|
|
|
e9fa07 |
"${_epdp2_build_steps_default}" \
|
|
|
e9fa07 |
"${_epdp2_build_vars_default}" "${_epdp2_dispatch_fn}" \
|
|
|
e9fa07 |
"${_epdp2_group_name}" "${_epdp2_pipe_path}" \
|
|
|
e9fa07 |
"${_epdp2_pkg_name}" "${_epdp2_restart_at}" \
|
|
|
e9fa07 |
"${_epdp2_workdir}";
|
|
|
e9fa07 |
_epdp2_foundfl=1; break;
|
|
|
e9fa07 |
fi;
|
|
|
e9fa07 |
done;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
if [ "${_epdp2_foundfl:-0}" -eq 0 ]; then
|
|
|
e9fa07 |
break;
|
|
|
e9fa07 |
fi;
|
|
|
e9fa07 |
done;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
return "${_epdp2_foundfl}";
|
|
|
e9fa07 |
};
|
|
|
e9fa07 |
|
|
|
e9fa07 |
#
|
|
|
e9fa07 |
# ex_pkg_dispatch() - dispatch a set of build group
|
|
|
e9fa07 |
# @_rdispatch_wait: reference to out variable of package names in a wait state
|
|
|
e9fa07 |
# @_build_steps_default: list of default build steps
|
|
|
e9fa07 |
# @_build_vars_default: list of default build variables
|
|
|
e9fa07 |
# @_dispatch_fn: top-level dispatch function name
|
|
|
e9fa07 |
# @_group_names: build group name(s)
|
|
|
e9fa07 |
# @_groups_inhibit_deps: inhibit group-group dependency expansion
|
|
|
e9fa07 |
# @_njobs_max: maximum count of simultaneous jobs
|
|
|
e9fa07 |
# @_pipe_path: pathname to build FIFO
|
|
|
e9fa07 |
# @_restart: optional whitespace-separated list of package names to rebuild
|
|
|
e9fa07 |
# @_restart_at: optional comma-separated list of build steps at which to rebuild or ALL or LAST
|
|
|
e9fa07 |
# @_restart_recursive: optional flag specifiying either no dependency expansion (0,) dependency expansion (1,) dependency expansion and forcibly rebuild (2,) forcibly rebuild reverse dependencies (3.)
|
|
|
e9fa07 |
# @_workdir: pathname to build-specific temporary directory
|
|
|
e9fa07 |
#
|
|
|
e9fa07 |
# Return: zero (0) on success, non-zero (>0) on failure.
|
|
|
e9fa07 |
#
|
|
|
e9fa07 |
ex_pkg_dispatch() {
|
|
|
e9fa07 |
local _epd_rdispatch_wait="${1#\$}" _epd_build_steps_default="${2}" _epd_build_vars_default="${3}" \
|
|
|
e9fa07 |
_epd_dispatch_fn="${4}" _epd_group_names="${5}" _epd_groups_inhibit_deps="${6}" _epd_njobs_max="${7}" \
|
|
|
e9fa07 |
_epd_pipe_path="${8}" _epd_restart="${9}" _epd_restart_at="${10}" _epd_restart_recursive="${11}" \
|
|
|
e9fa07 |
_epd_workdir="${12}" \
|
|
|
e9fa07 |
_epd_checkfl=1 _epd_forcefl=0 _epd_perc_group=0 \
|
|
|
e9fa07 |
_epd_pkg_disabled="" _epd_pkg_finished="" _epd_pkg_names="" _epd_pkg_name="" \
|
|
|
e9fa07 |
_epd_pkg_dispatch_count=0 _epd_pkg_dispatch_count_cur=0 _epd_pkg_dispatch_count_max=0 \
|
|
|
e9fa07 |
_epd_pkg_dispatch_group_cur=0 _epd_pkg_dispatch_group_max=0 \
|
|
|
e9fa07 |
_epd_pkg_dispatch_njobs=0 \
|
|
|
e9fa07 |
_epd_rc=0 _epd_reversefl=0;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
case "${_epd_groups_inhibit_deps:-0}" in
|
|
|
e9fa07 |
0) rtl_lunfold_depends '${_rld_name}_GROUP_DEPENDS' \$_epd_group_names ${_epd_group_names};
|
|
|
e9fa07 |
_epd_group_names="$(rtl_uniq2 \$_epd_group_names)";
|
|
|
e9fa07 |
esac;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
if [ "${_epd_restart:+1}" = 1 ]; then
|
|
|
e9fa07 |
case "${_epd_restart_recursive:-0}" in
|
|
|
e9fa07 |
0) _epd_checkfl=0; _epd_forcefl=0; _epd_reversefl=0; ;;
|
|
|
e9fa07 |
1) _epd_checkfl=1; _epd_forcefl=0; _epd_reversefl=0; ;;
|
|
|
e9fa07 |
2) _epd_checkfl=1; _epd_forcefl=1; _epd_reversefl=0; ;;
|
|
|
e9fa07 |
3) _epd_checkfl=1; _epd_forcefl=1; _epd_reversefl=1; ;;
|
|
|
e9fa07 |
esac;
|
|
|
e9fa07 |
fi;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
rtl_llength \$_epd_pkg_dispatch_group_max \$_epd_group_names;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
for _epd_group_name in ${_epd_group_names}; do
|
|
|
e9fa07 |
_epd_pkg_disabled="";
|
|
|
e9fa07 |
_epd_pkg_finished="";
|
|
|
e9fa07 |
_epd_pkg_names="";
|
|
|
e9fa07 |
eval ${_epd_rdispatch_wait}=;
|
|
|
e9fa07 |
_epd_pkg_dispatch_count=0;
|
|
|
e9fa07 |
_epd_pkg_dispatch_count_cur=0;
|
|
|
e9fa07 |
_epd_pkg_dispatch_count_max=0;
|
|
|
e9fa07 |
_epd_pkg_dispatch_njobs=0;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
rtl_percentage "${_epd_pkg_dispatch_group_cur}" "${_epd_pkg_dispatch_group_max}" \$_epd_perc_group;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
if "${_epd_dispatch_fn}" \
|
|
|
e9fa07 |
start_group "${_epd_group_name}" \
|
|
|
e9fa07 |
"" "${_epd_pkg_dispatch_group_cur}" \
|
|
|
e9fa07 |
"${_epd_pkg_dispatch_group_max}" \
|
|
|
e9fa07 |
"${_epd_perc_group}";
|
|
|
e9fa07 |
then
|
|
|
e9fa07 |
if rtl_fileop mkdir "${_epd_workdir}"\
|
|
|
e9fa07 |
&& rtl_log_msg "verbose" "${MSG_build_resolving_deps}" "${_epd_group_name}"\
|
|
|
e9fa07 |
&& exp_pkg_dispatch_expand_packages \
|
|
|
e9fa07 |
\$_epd_pkg_disabled \$_epd_pkg_finished \
|
|
|
e9fa07 |
\$_epd_pkg_names "${_epd_checkfl}" \
|
|
|
e9fa07 |
"${_epd_forcefl}" "${_epd_group_name}" \
|
|
|
e9fa07 |
"${_epd_restart}" "${_epd_reversefl}" \
|
|
|
e9fa07 |
"${_epd_workdir}" \
|
|
|
e9fa07 |
&& exp_pkg_dispatch_complete \
|
|
|
e9fa07 |
"${_epd_dispatch_fn}" "${_epd_group_name}" \
|
|
|
e9fa07 |
"${_epd_pkg_disabled}" "${_epd_pkg_finished}" \
|
|
|
e9fa07 |
&& rtl_log_msg "verbose" "${MSG_build_resolved_deps}" "${_epd_group_name}"\
|
|
|
e9fa07 |
&& rtl_llength \$_epd_pkg_dispatch_count_max \$_epd_pkg_names\
|
|
|
e9fa07 |
&& [ "${_epd_pkg_dispatch_count_max}" -gt 0 ];
|
|
|
e9fa07 |
then
|
|
|
e9fa07 |
exp_pkg_dispatch_group \
|
|
|
e9fa07 |
\$_epd_pkg_dispatch_count \$_epd_pkg_dispatch_count_cur \
|
|
|
e9fa07 |
"${_epd_pkg_dispatch_count_max}" \
|
|
|
e9fa07 |
"${_epd_pkg_dispatch_group_cur}" "${_epd_pkg_dispatch_group_max}" \
|
|
|
e9fa07 |
\$_epd_pkg_dispatch_njobs "${_epd_rdispatch_wait}" \
|
|
|
e9fa07 |
\$_epd_pkg_disabled \$_epd_pkg_finished \$_epd_pkg_names \
|
|
|
e9fa07 |
"${_epd_build_steps_default}" "${_epd_build_vars_default}" \
|
|
|
e9fa07 |
"${_epd_checkfl}" "${_epd_dispatch_fn}" "${_epd_group_name}" \
|
|
|
e9fa07 |
"${_epd_njobs_max}" "${_epd_pipe_path}" "${_epd_restart_at}" \
|
|
|
e9fa07 |
"${_epd_workdir}";
|
|
|
e9fa07 |
_epd_rc="${?}";
|
|
|
e9fa07 |
fi;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
: $((_epd_pkg_dispatch_group_cur+=1));
|
|
|
e9fa07 |
rtl_percentage "${_epd_pkg_dispatch_group_cur}" "${_epd_pkg_dispatch_group_max}" \$_epd_perc_group;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
"${_epd_dispatch_fn}" \
|
|
|
e9fa07 |
finish_group "${_epd_group_name}" \
|
|
|
e9fa07 |
"" "${_epd_pkg_dispatch_group_cur}" \
|
|
|
e9fa07 |
"${_epd_pkg_dispatch_group_max}" \
|
|
|
e9fa07 |
"${_epd_perc_group}";
|
|
|
e9fa07 |
if [ "${_epd_rc}" -ne 0 ]; then
|
|
|
e9fa07 |
break;
|
|
|
e9fa07 |
fi;
|
|
|
e9fa07 |
fi;
|
|
|
e9fa07 |
done;
|
|
|
e9fa07 |
|
|
|
e9fa07 |
return "${_epd_rc}";
|
|
|
e9fa07 |
};
|
|
|
e9fa07 |
|
|
|
e9fa07 |
# vim:filetype=sh textwidth=0
|