summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLucio Andrés Illanes Albornoz <lucio@lucioillanes.de>2020-04-25 15:12:30 +0100
committerLucio Andrés Illanes Albornoz <lucio@lucioillanes.de>2020-04-25 15:12:30 +0100
commit57b30dd4eeca482b65f514b580ee7a843ddb8c53 (patch)
tree574e8d5eed7ce9174b565f53303b144368e42907
parente2c21dd03e415d99a336b21341b78842d39e39f5 (diff)
downloadmidipix_build-57b30dd4eeca482b65f514b580ee7a843ddb8c53.tar.bz2
midipix_build-57b30dd4eeca482b65f514b580ee7a843ddb8c53.tar.xz
pkgtool.sh:pkgtoolp_rdepends(): print direct reverse dependencies in bright yellow and their dependencies in dark yellow, if any.
subr/ex_pkg.subr:ex_pkg_unfold_depends_direct(): initial implementation.
-rwxr-xr-xpkgtool.sh20
-rw-r--r--subr/ex_pkg.subr33
2 files changed, 44 insertions, 9 deletions
diff --git a/pkgtool.sh b/pkgtool.sh
index 28e6dfd4..e2cd5e9e 100755
--- a/pkgtool.sh
+++ b/pkgtool.sh
@@ -50,21 +50,27 @@ pkgtoolp_restart_at() {
};
pkgtoolp_rdepends() {
- local _pkg_name="${1}" _group_name="" _pkg_names="" _rc=0\
- EX_PKG_BUILD_GROUPS="" EX_PKG_DISABLED="" EX_PKG_FINISHED="" EX_PKG_NAMES=""; _status="";
+ local _pkg_name="${1}" _group_name="" _pkg_depends="" _pkg_name_rdepend="" _pkg_names=""\
+ _pkg_rdepends="" _rc=0 EX_PKG_BUILD_GROUPS="" EX_PKG_DISABLED="" EX_PKG_RDEPENDS_DIRECT=""; _status="";
if ! ex_pkg_load_groups; then
_rc=1; _status="Error: failed to load build groups.";
elif ! _group_name="$(ex_pkg_find_package "${EX_PKG_BUILD_GROUPS}" "${_pkg_name}")"; then
_rc=1; _status="Error: unknown package \`${_pkg_name}'.";
elif ! _pkg_names="$(ex_pkg_get_packages "${_group_name}")"; then
_rc=1; _status="Error: failed to expand package list of build group \`${_group_name}'.";
- elif ! ex_pkg_unfold_rdepends "${_group_name}" "${_pkg_names}" "${_pkg_name}" 0; then
+ elif ! ex_pkg_unfold_rdepends_direct "${_group_name}" "${_pkg_names}" "${_pkg_name}"; then
_rc=1; _status="Error: failed to unfold reverse dependency-expanded package name list for \`${_pkg_name}'.";
- elif [ -z "${EX_PKG_NAMES}" ] && [ -z "${EX_PKG_DISABLED}" ]; then
+ elif [ -z "${EX_PKG_DISABLED}" ] && [ -z "${EX_PKG_RDEPENDS_DIRECT}" ]; then
rtl_log_msg info "Package \`%s' has no reverse dependencies." "${_pkg_name}";
- else if [ -n "${EX_PKG_NAMES}" ]; then
- rtl_log_msg info "Reverse dependencies of \`%s': %s"\
- "${_pkg_name}" "$(rtl_lsort "${EX_PKG_NAMES}")";
+ else for _pkg_name_rdepend in $(rtl_lsort "${EX_PKG_RDEPENDS_DIRECT}"); do
+ _pkg_rdepends="$(rtl_lconcat "${_pkg_rdepends}" "${_pkg_name_rdepend}")";
+ if _pkg_depends="$(rtl_lunfold_depends 'PKG_${_name}_DEPENDS' $(rtl_get_var_unsafe -u "PKG_"${_pkg_name}"_DEPENDS"))"\
+ && [ -n "${_pkg_depends}" ]; then
+ _pkg_rdepends="$(rtl_lconcat "${_pkg_rdepends}" "${_pkg_depends}")";
+ fi;
+ done;
+ if [ -n "${_pkg_rdepends}" ]; then
+ rtl_log_msg info "Reverse dependencies of \`%s': %s" "${_pkg_name}" "${_pkg_rdepends}";
fi;
if [ -n "${EX_PKG_DISABLED}" ]; then
rtl_log_msg info "Reverse dependencies of \`%s' (disabled packages:) %s"\
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