diff options
author | Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de> | 2020-05-15 11:29:24 +0100 |
---|---|---|
committer | Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de> | 2020-05-15 11:29:24 +0100 |
commit | 3382d9576f26d6ad8286255a3b4489cb57d67f7a (patch) | |
tree | a3c4077d9aef7bcce345330b0d13b1a72a573a50 /subr | |
parent | 2a66c97ade7316e6c009275581cb240a3e55bcce (diff) | |
download | midipix_build-3382d9576f26d6ad8286255a3b4489cb57d67f7a.tar.bz2 midipix_build-3382d9576f26d6ad8286255a3b4489cb57d67f7a.tar.xz |
Include percentage and package counts in build status informationals.
Diffstat (limited to 'subr')
-rw-r--r-- | subr/ex_pkg_dispatch.subr | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/subr/ex_pkg_dispatch.subr b/subr/ex_pkg_dispatch.subr index 3145ab2f..018970a4 100644 --- a/subr/ex_pkg_dispatch.subr +++ b/subr/ex_pkg_dispatch.subr @@ -56,19 +56,19 @@ exp_pkg_dispatch_expand_packages() { # @_restart_at: optional comma-separated list of build steps at which to rebuild or ALL # @_workdir: pathname to build-specific temporary directory # -# Return: zero (0) on success, non-zero (>0) on failure. +# Return: zero (0) on success, non-zero (>0) on failure, ${EXP_PKG_DISPATCH_COUNT_CUR} may be mutated post-return. # exp_pkg_dispatch_group() { - local _build_steps_default="${1}" _build_vars_default="${2}" _checkfl="${3}" \ - _dispatch_fn="${4}" _group_name="${5}" _njobs_max="${6}" _pipe_path="${7}" \ + local _build_steps_default="${1}" _build_vars_default="${2}" _checkfl="${3}"\ + _dispatch_fn="${4}" _group_name="${5}" _njobs_max="${6}" _pipe_path="${7}"\ _restart_at="${8}" _workdir="${9}" _pipe_msg="" _pkg_name="" _rc=0 _status_percentage=""; rtl_fileop mkfifo "${_pipe_path}"; while true; do while [ "${EXP_PKG_DISPATCH_NJOBS:-0}" -gt 0 ] && read _pipe_msg; do case "${_pipe_msg%% *}" in - done) _pkg_name="${_pipe_msg#done * }"; : $((EXP_PKG_DISPATCH_NJOBS-=1)); + done) _pkg_name="${_pipe_msg#done * }"; : $((EXP_PKG_DISPATCH_COUNT_CUR+=1)); : $((EXP_PKG_DISPATCH_NJOBS-=1)); EX_PKG_FINISHED="$(rtl_lconcat "${EX_PKG_FINISHED}" "${_pkg_name}")"; - _status_percentage="$(((100 * ${EXP_PKG_DISPATCH_COUNT} + ${EXP_PKG_DISPATCH_COUNT_MAX} / 2)))"; + _status_percentage="$(((100 * ${EXP_PKG_DISPATCH_COUNT_CUR} + ${EXP_PKG_DISPATCH_COUNT_MAX} / 2)))"; if [ "${_status_percentage}" -gt 0 ]; then _status_percentage="$((${_status_percentage} / ${EXP_PKG_DISPATCH_COUNT_MAX}))"; fi; @@ -125,7 +125,7 @@ exp_pkg_dispatch_group() { exp_pkg_dispatch_package() { local _build_steps_default="${1}" _build_vars_default="${2}" _dispatch_fn="${3}"\ _group_name="${4}" _pkg_name="${5}" _restart_at="${6}" _workdir="${7}"\ - _status_percentage="$((100 * ${EXP_PKG_DISPATCH_COUNT} + (${EXP_PKG_DISPATCH_COUNT_MAX} / 2)))"; + _status_percentage="$((100 * ${EXP_PKG_DISPATCH_COUNT_CUR} + (${EXP_PKG_DISPATCH_COUNT_MAX} / 2)))"; if [ "${_status_percentage}" -gt 0 ]; then _status_percentage="$((${_status_percentage} / ${EXP_PKG_DISPATCH_COUNT_MAX}))"; fi; @@ -212,7 +212,7 @@ ex_pkg_dispatch() { _restart="${8}" _restart_at="${9}" _restart_recursive="${10}" _workdir="${11}" \ _checkfl=1 _forcefl=0 _pkg_name="" _pkg_names="" _rc=0 _reversefl=0 \ EX_PKG_DISABLED EX_PKG_FINISHED EX_PKG_NAMES EXP_PKG_DISPATCH_COUNT \ - EXP_PKG_DISPATCH_COUNT_MAX EXP_PKG_DISPATCH_NJOBS; EX_PKG_DISPATCH_WAIT=""; + EXP_PKG_DISPATCH_COUNT_CUR EXP_PKG_DISPATCH_COUNT_MAX EXP_PKG_DISPATCH_NJOBS; EX_PKG_DISPATCH_WAIT=""; case "${_groups_inhibit_deps:-0}" in 0) _group_names="$(rtl_uniq $(rtl_lunfold_depends '${_name}_GROUP_DEPENDS' ${_group_names}))"; esac; @@ -226,7 +226,7 @@ ex_pkg_dispatch() { fi; for _group_name in ${_group_names}; do EX_PKG_DISABLED=""; EX_PKG_DISPATCH_WAIT=""; EX_PKG_FINISHED=""; EX_PKG_NAMES=""; - EXP_PKG_DISPATCH_COUNT=0; EXP_PKG_DISPATCH_COUNT_MAX=0; EXP_PKG_DISPATCH_NJOBS=0; + EXP_PKG_DISPATCH_COUNT=0; EXP_PKG_DISPATCH_COUNT_CUR=0; EXP_PKG_DISPATCH_COUNT_MAX=0; EXP_PKG_DISPATCH_NJOBS=0; if "${_dispatch_fn}" start_group "${_group_name}" ""; then if rtl_fileop mkdir "${_workdir}"\ && rtl_log_msg notice "Resolving \`%s' dependencies..." "${_group_name}"\ |