diff options
Diffstat (limited to 'subr')
-rw-r--r-- | subr/ex_pkg.subr | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/subr/ex_pkg.subr b/subr/ex_pkg.subr index ddd9414b..8de0774e 100644 --- a/subr/ex_pkg.subr +++ b/subr/ex_pkg.subr @@ -204,8 +204,8 @@ ex_pkg_unfold_depends() { # Return: zero (0) on success, non-zero (>0) on failure, ${EX_PKG_DISABLED}, ${EX_PKG_FINISHED}, and ${EX_PKG_NAMES} set post-return. # ex_pkg_unfold_rdepends() { - local _group_name="${1}" _pkg_names="${2}" _restart="${3}" _test_finished="${4}" \ - _pkg_depends="" _pkg_name="" _pkg_name_depend="" _pkg_rdepends="" _restartfl=0; + local _group_name="${1}" _pkg_names="${2}" _restart="${3}" _test_finished="${4}"\ + _pkg_depends="" _pkg_name="" _pkg_name_depend="" _pkg_rdepends=""; for _pkg_name_depend in ${_restart}; do for _pkg_name in ${_pkg_names}; do if [ "${_pkg_name}" != "${_pkg_name_depend}" ]\ @@ -243,4 +243,33 @@ ex_pkg_unfold_rdepends() { EX_PKG_NAMES="$(rtl_uniq ${_pkg_names})"; }; +# +# ex_pkg_unfold_rdepends_direct() - unfold list of package names into direct reverse dependency-expanded set of disabled and outstanding package names +# @_group_name: build group name +# @_pkg_names: list of package names +# @_restart: optional whitespace-separated list of package names to rebuild +# +# Return: zero (0) on success, non-zero (>0) on failure, ${EX_PKG_DISABLED} and ${EX_PKG_RDEPENDS_DIRECT} set post-return. +# +ex_pkg_unfold_rdepends_direct() { + local _group_name="${1}" _pkg_names="${2}" _restart="${3}"\ + _pkg_depends="" _pkg_disabled="" _pkg_name="" _pkg_name_depend="" _pkg_rdepends=""; + for _pkg_name_depend in ${_restart}; do + for _pkg_name in ${_pkg_names}; do + if [ "${_pkg_name}" != "${_pkg_name_depend}" ]\ + && _pkg_depends="$(rtl_get_var_unsafe -u "PKG_${_pkg_name}_DEPENDS")"\ + && [ -n "${_pkg_depends}" ]\ + && rtl_lmatch "${_pkg_depends}" "${_pkg_name_depend}"; then + if [ "x$(rtl_get_var_unsafe -u "PKG_${_pkg_name}_DISABLED")" != "x1" ]; then + _pkg_rdepends="$(rtl_lconcat "${_pkg_rdepends}" "${_pkg_name}")"; + else + _pkg_disabled="$(rtl_lconcat "${_pkg_disabled}" "${_pkg_name}")"; + fi; + fi; + done; + done; + EX_PKG_DISABLED="$(rtl_uniq ${_pkg_disabled})"; + EX_PKG_RDEPENDS_DIRECT="$(rtl_uniq ${_pkg_rdepends})"; +}; + # vim:filetype=sh textwidth=0 |