summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--etc/build.msgs.en1
-rw-r--r--subr.ex/ex_pkg.subr50
-rw-r--r--subr.rtl/rtl_list.subr48
3 files changed, 97 insertions, 2 deletions
diff --git a/etc/build.msgs.en b/etc/build.msgs.en
index ddacb97b..529d1bda 100644
--- a/etc/build.msgs.en
+++ b/etc/build.msgs.en
@@ -13,6 +13,7 @@ MSG_build_reset_pkg_state="1;Reset package state for: %s";
MSG_build_resolved_deps="1;Resolved \`%s' dependencies.";
MSG_build_resolving_deps="1;Resolving \`%s' dependencies...";
MSG_build_unknown_dep="2;Error: dependency \`%s' of \`%s' unknown.";
+MSG_build_unknown_deps="0;Error: packages with unknown dependencies.";
MSG_group_begin="4;[%3d%% ] [%03d/%03d] Starting \`%s' build group...";
MSG_group_finish="4;[%3d%% ] [%03d/%03d] Finished \`%s' build group.";
diff --git a/subr.ex/ex_pkg.subr b/subr.ex/ex_pkg.subr
index 97d5ea0b..a14ac215 100644
--- a/subr.ex/ex_pkg.subr
+++ b/subr.ex/ex_pkg.subr
@@ -39,6 +39,34 @@ ex_pkg_check_depends() {
};
#
+# ex_pkg_check_depends_unknown() - check single named package for unknown dependencies
+# @_pkg_name: single package name
+# @_rpkg_names_set: in reference to variable of set of package names
+# @_rpkg_unknown: out reference to variable of list of finished packages
+#
+# Returns: zero (0) given no unknown dependencies, non-zero (>0) otherwise
+#
+ex_pkg_check_depends_unknown() {
+ local _epcdu_pkg_name="${1}" _epcdu_rpkg_names_set="${2#\$}" \
+ _epcdu_rpkg_unknown="${3#\$}" \
+ _epcdu_defined=0 _epcdu_depends="" _epcdu_pkg_name_depend="" \
+ _epcdu_rc=0;
+
+ if rtl_get_var_unsafe \$_epcdu_depends -u "PKG_"${_epcdu_pkg_name}"_DEPENDS"\
+ && [ "${_epcdu_depends:+1}" = 1 ]; then
+ for _epcdu_pkg_name_depend in ${_epcdu_depends}; do
+ if ! rtl_get_var_unsafe \$_epcdu_defined "${_epcdu_rpkg_names_set}_${_epcdu_pkg_name_depend}"\
+ || [ "${_epcdu_defined:-0}" -eq 0 ]; then
+ rtl_lconcat "${_epcdu_rpkg_unknown}" "${_epcdu_pkg_name_depend}";
+ _epcdu_rc=1;
+ fi;
+ done;
+ fi;
+
+ return "${_epcdu_rc}";
+};
+
+#
# ex_pkg_copy_group_vars() - copy build group variables into build group
# @_group_name_src: single source build group name
# @_group_name_dst: single destination build group name
@@ -372,8 +400,9 @@ ex_pkg_unfold_depends() {
_epud_checkfl="${4}" _epud_forcefl="${5}" _epud_group_name="${6}" \
_epud_pkg_names="${7}" _epud_restart="${8}" _epud_test_finished="${9}" \
_epud_workdir="${10}" \
- _epud_pkg_disabled="" _epud_pkg_force="" _epud_pkg_name="" \
- _epud_pkg_names_new="" _epud_restartfl=0;
+ _epud_depends="" _epud_pkg_disabled="" _epud_pkg_force="" _epud_pkg_name="" \
+ _epud_pkg_name_depend="" _epud_pkg_names_new="" _epud_pkg_names_set="" \
+ _epud_pkg_unknown="" _epud_restartfl=0 _epud_unknown_depends=0;
if [ "${_epud_restart:+1}" = 1 ]\
&& ! rtl_lmatch \$_epud_restart "ALL LAST"; then
@@ -385,7 +414,19 @@ ex_pkg_unfold_depends() {
_epud_pkg_names="$(rtl_uniq ${_epud_pkg_names})";
fi;
+ rtl_llift_set \$_epud_pkg_names \$_epud_pkg_names_set;
for _epud_pkg_name in ${_epud_pkg_names}; do
+ if rtl_get_var_unsafe \$_epud_depends -u "PKG_"${_epud_pkg_name}"_DEPENDS"\
+ && [ "${_epud_depends:+1}" = 1 ]; then
+ _epud_pkg_unknown="";
+ if ! ex_pkg_check_depends_unknown "${_epud_pkg_name}" \$_epud_pkg_names_set \$_epud_pkg_unknown; then
+ for _epud_pkg_name_depend in ${_epud_pkg_unknown}; do
+ rtl_log_msgV "fatal" "${MSG_build_unknown_dep}" "${_epud_pkg_name_depend}" "${_epud_pkg_name}";
+ done;
+ _epud_unknown_depends=1;
+ fi;
+ fi;
+
if [ "${_epud_restart}" = "ALL" ]\
|| rtl_lmatch \$_epud_restart "${_epud_pkg_name}"; then
_epud_restartfl=1;
@@ -411,6 +452,11 @@ ex_pkg_unfold_depends() {
rtl_lconcat \$_epud_pkg_names_new "${_epud_pkg_name}";
fi;
done;
+ rtl_llift_unset \$_epud_pkg_names_set;
+
+ if [ "${_epud_unknown_depends}" -eq 1 ]; then
+ rtl_log_msgV "fatalexit" "${MSG_build_unknown_deps}";
+ fi;
eval ${_epud_rdisabled}='$(rtl_uniq2 "${_epud_rdisabled}")';
eval ${_epud_rfinished}='$(rtl_uniq2 "${_epud_rfinished}")';
diff --git a/subr.rtl/rtl_list.subr b/subr.rtl/rtl_list.subr
index 36bc77e9..0ec53661 100644
--- a/subr.rtl/rtl_list.subr
+++ b/subr.rtl/rtl_list.subr
@@ -222,6 +222,54 @@ rtl_llift2() {
};
#
+# rtl_llift_set() - convert list w/ separator to set
+# @_rlist: in reference to list
+# @_rset_new: out reference to new set
+# @_sep: single non-zero, possibly multi-character, separator
+#
+# Notate bene: all list items in @_rlist must form valid shell parameter name substrings;
+# no list item must be named "__000000__"
+# Returns: zero (0) on success, non-zero (>0) on failure
+#
+rtl_llift_set() {
+ local _rls3_rlist="${1#\$}" _rls3_rset_new="${2#\$}" _rls3_sep="${3:-}" \
+ _rls3_litem="";
+
+ if [ "${_rls3_sep:+1}" = 1 ]; then
+ local IFS="${_rls3_sep}";
+ else
+ local _rls3_sep=" " IFS="${RTL_IFS_ORIG}";
+ fi;
+
+ eval set -- '${'"${_rls3_rlist}"'}';
+ eval "${_rls3_rset_new}___000000__=\${${_rls3_rlist}}";
+ for _rls3_litem in "${@}"; do
+ eval "${_rls3_rset_new}_${_rls3_litem}=1";
+ done;
+ return 0;
+};
+
+#
+# rtl_llift_unset() - unset set previously created w/ rtl_llift_set()
+# @_rset: in reference to set
+#
+# Returns: zero (0) on success, non-zero (>0) on failure
+#
+rtl_llift_unset() {
+ local _rlu_rset="${1#\$}" \
+ _rlu_index="" _rlu_item="";
+
+ if rtl_get_var_unsafe \$_rlu_index "${_rlu_rset}___000000__"; then
+ for _rlu_item in ${_rlu_index}; do
+ unset "${_rlu_rset}_${_rlu_item}";
+ done;
+ unset "${_rlu_rset}___000000__";
+ fi;
+
+ return 0;
+};
+
+#
# rtl_lmatch() - check if item(s) in list
# @_rlist: in reference to list
# @_item: item(s) to search for