summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xbuild.sh48
-rw-r--r--dist/dist_zipdist.dist10
-rw-r--r--[l---------]etc/rtl.msgs.C36
-rw-r--r--etc/rtl.msgs.en2
-rwxr-xr-xpkgtool.sh68
-rw-r--r--subr.ex/ex_init.subr20
-rw-r--r--subr.ex/ex_pkg.subr2
-rw-r--r--subr.ex/ex_pkg_dispatch.subr4
-rw-r--r--subr.ex/ex_pkg_env.subr10
-rw-r--r--subr.pkg/pkg_build.subr34
-rw-r--r--subr.pkg/pkg_build_clean.subr5
-rw-r--r--subr.pkg/pkg_install_files.subr2
-rw-r--r--subr.pkg/pkg_install_make.subr13
-rw-r--r--subr.rtl/rtl_fetch.subr2
-rw-r--r--subr.rtl/rtl_fetch_wget.subr16
-rw-r--r--subr.rtl/rtl_fileop.subr26
-rw-r--r--subr.rtl/rtl_install_v2.subr2
-rw-r--r--subr.rtl/rtl_list.subr4
-rw-r--r--subr.rtl/rtl_log.subr79
-rw-r--r--subr.rtl/rtl_platform.subr147
-rw-r--r--subr.rtl/rtl_state.subr77
-rw-r--r--vars/texinfo.vars24
22 files changed, 406 insertions, 225 deletions
diff --git a/build.sh b/build.sh
index da3fb631..efe554f1 100755
--- a/build.sh
+++ b/build.sh
@@ -10,7 +10,7 @@ buildp_ast() {
for _bpa_cmd in \
rtl_fileop rtl_kill_tree rtl_lconcat \
- rtl_log_msg rtl_uniq rtl_state_clear;
+ rtl_log_msgV rtl_uniq rtl_state_clear;
do
if ! command -v "${_bpa_cmd}" >/dev/null 2>&1; then
return 0;
@@ -20,7 +20,7 @@ buildp_ast() {
trap '' HUP INT TERM USR1 USR2;
if [ "${_bpa_param}" = "abort" ]; then
- rtl_log_msg "fatalexit" "${MSG_build_aborted}";
+ rtl_log_msgV "fatalexit" "${MSG_build_aborted}";
fi;
for _bpa_signal in "TERM" "KILL"; do
@@ -38,7 +38,7 @@ buildp_ast() {
done;
if [ "${_bpa_pids:+1}" = 1 ]; then
- rtl_log_msg "verbose" "${MSG_build_killed_pids}" "$(rtl_uniq ${_bpa_pids})";
+ rtl_log_msgV "verbose" "${MSG_build_killed_pids}" "$(rtl_uniq ${_bpa_pids})";
fi;
if [ "${BUILD_PKG_WAIT:+1}" = 1 ]\
@@ -46,7 +46,7 @@ buildp_ast() {
for _bpa_pkg_name in ${BUILD_PKG_WAIT}; do
rtl_state_clear "${BUILD_WORKDIR}" "${_bpa_pkg_name}";
done;
- rtl_log_msg "verbose" "${MSG_build_reset_pkg_state}" "${BUILD_PKG_WAIT}";
+ rtl_log_msgV "verbose" "${MSG_build_reset_pkg_state}" "${BUILD_PKG_WAIT}";
fi;
if [ "${DEFAULT_BUILD_STATUS_IN_PROGRESS_FNAME:+1}" = 1 ]; then
@@ -309,7 +309,7 @@ buildp_init_getopts_fn() {
fi;
case "${_bpigf_arg}" in
- *=*) rtl_set_var_from_cmdline "${_bpigf_rstatus}" "${_bpigf_arg}";
+ *=*) rtl_set_var_from_spec "${_bpigf_rstatus}" "${_bpigf_arg}";
_bpigf_rc="${?}";
;;
@@ -404,16 +404,16 @@ buildp_dispatch_fail_pkg() {
rtl_lconcat \$BUILD_PKGS_FAILED "${_bpdfp_pkg_name}";
if [ "${ARG_RELAXED:-0}" -eq 0 ]; then
- rtl_log_msg "fatal" "${MSG_pkg_stderrout_log}" "${BUILD_WORKDIR}" "${_bpdfp_pkg_name}";
+ rtl_log_msgV "fatal" "${MSG_pkg_stderrout_log}" "${BUILD_WORKDIR}" "${_bpdfp_pkg_name}";
cat "${BUILD_WORKDIR}/${_bpdfp_pkg_name}_stderrout.log";
if [ "${DEFAULT_BUILD_LAST_FAILED_PKG_FNAME:+1}" = 1 ]; then
printf "%s\n" "${_bpdfp_pkg_name}" > "${DEFAULT_BUILD_LAST_FAILED_PKG_FNAME}";
fi;
- rtl_log_msg "fatal" "${MSG_build_failed_in}" "${_bpdfp_pkg_name}" "${BUILD_WORKDIR}/${_bpdfp_pkg_name}_stderrout.log";
+ rtl_log_msgV "fatal" "${MSG_build_failed_in}" "${_bpdfp_pkg_name}" "${BUILD_WORKDIR}/${_bpdfp_pkg_name}_stderrout.log";
else
- rtl_log_msg "warning" "${MSG_build_failed_in}" "${_bpdfp_pkg_name}" "${BUILD_WORKDIR}/${_bpdfp_pkg_name}_stderrout.log";
+ rtl_log_msgV "warning" "${MSG_build_failed_in}" "${_bpdfp_pkg_name}" "${BUILD_WORKDIR}/${_bpdfp_pkg_name}_stderrout.log";
fi;
return 0;
@@ -424,8 +424,8 @@ buildp_dispatch_group_state() {
local _bpdgs_msg="${1}" _bpdgs_group_name="${2}";
case "${_bpdgs_msg}" in
- finish_group) rtl_log_msg "group_finish" "${MSG_group_finish}" "${6}" "${4}" "${5}" "${_bpdgs_group_name}"; ;;
- start_group) rtl_log_msg "group_begin" "${MSG_group_begin}" "${6}" "${4}" "${5}" "${_bpdgs_group_name}"; ;;
+ finish_group) rtl_log_msgV "group_finish" "${MSG_group_finish}" "${6}" "${4}" "${5}" "${_bpdgs_group_name}"; ;;
+ start_group) rtl_log_msgV "group_begin" "${MSG_group_begin}" "${6}" "${4}" "${5}" "${_bpdgs_group_name}"; ;;
esac;
return 0;
@@ -437,19 +437,19 @@ buildp_dispatch_pkg_state() {
_bpdps_var="" _bpdps_vars="";
case "${_bpdps_msg}" in
- disabled_pkg) : $((BUILD_NSKIP+=1)); rtl_log_msg "pkg_skip" "${MSG_pkg_skip_disabled}" "${_bpdps_pkg_name}"; ;;
- missing_pkg) rtl_log_msg "fatalexit" "${MSG_pkg_skip_unknown}" "${_bpdps_pkg_name}"; ;;
- msg_pkg) shift 3; rtl_log_msg "${MSG_pkg_msg}" "${_bpdps_group_name}" "${_bpdps_pkg_name}" "${*}"; ;;
- skipped_pkg) : $((BUILD_NSKIP+=1)); rtl_log_msg "pkg_skip" "${MSG_pkg_skip_finished}" "${_bpdps_pkg_name}"; ;;
- start_pkg) rtl_log_msg "pkg_begin" "${MSG_pkg_begin}" "${7}" "${6}" "${4}" "${5}" "${_bpdps_pkg_name}"; ;;
- step_pkg) rtl_log_msg "pkg_step" "${MSG_pkg_step}" "${4}" "${_bpdps_pkg_name}"; ;;
+ disabled_pkg) : $((BUILD_NSKIP+=1)); rtl_log_msgV "pkg_skip" "${MSG_pkg_skip_disabled}" "${_bpdps_pkg_name}"; ;;
+ missing_pkg) rtl_log_msgV "fatalexit" "${MSG_pkg_skip_unknown}" "${_bpdps_pkg_name}"; ;;
+ msg_pkg) shift 3; rtl_log_msgV "${MSG_pkg_msg}" "${_bpdps_group_name}" "${_bpdps_pkg_name}" "${*}"; ;;
+ skipped_pkg) : $((BUILD_NSKIP+=1)); rtl_log_msgV "pkg_skip" "${MSG_pkg_skip_finished}" "${_bpdps_pkg_name}"; ;;
+ start_pkg) rtl_log_msgV "pkg_begin" "${MSG_pkg_begin}" "${7}" "${6}" "${4}" "${5}" "${_bpdps_pkg_name}"; ;;
+ step_pkg) rtl_log_msgV "pkg_step" "${MSG_pkg_step}" "${4}" "${_bpdps_pkg_name}"; ;;
finish_pkg)
: $((BUILD_NFINI+=1));
if rtl_lmatch \$ARG_VERBOSE_TAGS "build" ","; then
cat "${BUILD_WORKDIR}/${_bpdps_pkg_name}_stderrout.log";
fi;
- rtl_log_msg "pkg_finish" "${MSG_pkg_finish}" "${7}" "${6}" "${4}" "${5}" "${_bpdps_pkg_name}"; ;;
+ rtl_log_msgV "pkg_finish" "${MSG_pkg_finish}" "${7}" "${6}" "${4}" "${5}" "${_bpdps_pkg_name}"; ;;
start_pkg_child)
if [ "${PKG_NO_LOG_VARS:-0}" -eq 0 ]; then
@@ -506,7 +506,7 @@ build() {
_status="Error: ${_status}";
else
buildp_time_init;
- rtl_log_msg "build_begin" "${MSG_build_begin}" "${BUILD_USER}" "${BUILD_HNAME}" "${BUILD_DATE_START}";
+ rtl_log_msgV "build_begin" "${MSG_build_begin}" "${BUILD_USER}" "${BUILD_HNAME}" "${BUILD_DATE_START}";
rtl_log_env_vars "build_vars" "build (global)" ${DEFAULT_LOG_ENV_VARS};
ex_pkg_dispatch \
@@ -517,8 +517,8 @@ build() {
"${ARG_RESTART_RECURSIVE}" "${BUILD_WORKDIR}";
buildp_time_update;
- rtl_log_msg "build_finish" "${MSG_build_finish}" "${BUILD_NFINI:-0}" "${BUILD_NSKIP:-0}" "${BUILD_NFAIL:-0}";
- rtl_log_msg "build_finish_time" "${MSG_build_finish_time}" "${_build_time_hours:-0}" "${_build_time_minutes:-0}" "${_build_time_secs:-0}";
+ rtl_log_msgV "build_finish" "${MSG_build_finish}" "${BUILD_NFINI:-0}" "${BUILD_NSKIP:-0}" "${BUILD_NFAIL:-0}";
+ rtl_log_msgV "build_finish_time" "${MSG_build_finish_time}" "${_build_time_hours:-0}" "${_build_time_minutes:-0}" "${_build_time_secs:-0}";
if [ "${BUILD_PKGS_FAILED:+1}" = 1 ]; then
_rc=1;
@@ -527,11 +527,11 @@ build() {
fi;
if [ "${_rc}" -ne 0 ]; then
- rtl_log_enable_tags "${LOG_TAGS_all}";
- rtl_log_msg "fatalexit" "0;${_status}";
+ rtl_log_enable_tagsV "${LOG_TAGS_all}";
+ rtl_log_msgV "fatalexit" "0;${_status}";
elif [ "${_status:+1}" = 1 ]; then
- rtl_log_enable_tags "${LOG_TAGS_all}";
- rtl_log_msg "info" "0;${_status}";
+ rtl_log_enable_tagsV "${LOG_TAGS_all}";
+ rtl_log_msgV "info" "0;${_status}";
fi;
};
diff --git a/dist/dist_zipdist.dist b/dist/dist_zipdist.dist
index 505fcac6..51e8dad0 100644
--- a/dist/dist_zipdist.dist
+++ b/dist/dist_zipdist.dist
@@ -12,11 +12,11 @@ pkg_dist_zipdist_all() {
fi;
ex_pkg_dispatch_send "msg_pkg" "dist" "dist_zipdist" "${MSG_zipdist_begin}";
- rtl_log_msg "zipdist" "${MSG_zipdist_begin}";
+ rtl_log_msgV "zipdist" "${MSG_zipdist_begin}";
for _pdza_pkg_name in $(cat "${_pdza_pkglist_fname}"); do
if [ ! -e "${BUILD_WORKDIR}/${_pdza_pkg_name}-native-${DEFAULT_TARGET}" ]; then
- rtl_log_msg "fatalexit" "${MSG_zipdist_missing_pkg_build_dir}" "${_pdza_pkg_name}";
+ rtl_log_msgV "fatalexit" "${MSG_zipdist_missing_pkg_build_dir}" "${_pdza_pkg_name}";
fi;
done;
@@ -44,14 +44,14 @@ pkg_dist_zipdist_all() {
fi;
ex_pkg_dispatch_send "msg_pkg" "dist" "dist_zipdist" "${MSG_zipdist_finished}";
- rtl_log_msg "zipdist" "${MSG_zipdist_finished}";
+ rtl_log_msgV "zipdist" "${MSG_zipdist_finished}";
if [ "${DEFAULT_ZIPDIST_SIGN_GPG_KEY:+}" = 1 ]\
&& command which gpg >/dev/null 2>&1\
&& gpg --list-keys "${DEFAULT_ZIPDIST_SIGN_GPG_KEY}" >/dev/null 2>&1;
then
ex_pkg_dispatch_send "msg_pkg" "dist" "dist_zipdist" "${MSG_zipdist_signing}";
- rtl_log_msg "zipdist" "${MSG_zipdist_signing}";
+ rtl_log_msgV "zipdist" "${MSG_zipdist_signing}";
if ! gpg --armor --passphrase-file /dev/null \
--local-user "${DEFAULT_ZIPDIST_SIGN_GPG_KEY}" \
@@ -60,7 +60,7 @@ pkg_dist_zipdist_all() {
fi;
ex_pkg_dispatch_send "msg_pkg" "dist" "dist_zipdist" "${MSG_zipdist_signed}";
- rtl_log_msg "zipdist" "${MSG_zipdist_signed}";
+ rtl_log_msgV "zipdist" "${MSG_zipdist_signed}";
fi;
ex_pkg_dispatch_send "step" "${_pdza_group_name}" "${_pdza_pkg_name}" "finish";
diff --git a/etc/rtl.msgs.C b/etc/rtl.msgs.C
index 6cbc93ed..3f393357 120000..100644
--- a/etc/rtl.msgs.C
+++ b/etc/rtl.msgs.C
@@ -1 +1,35 @@
-rtl.msgs.en \ No newline at end of file
+#
+# en_* locale messages file for subr.rtl/*.subr
+#
+
+MSG_rtl_fetch_fail="2;Error: failed to fetch URL \`%s' (wget(1) exit status: %s)";
+MSG_rtl_fetch_fail_retryurl="2;Warning: failed to fetch URL \`%s', retrying with alternative URL... (wget(1) exit status: %s)";
+MSG_rtl_fetch_hashfail1="3;Error: hash mismatch for URL \`%s' (should be: %s vs.: %s.)";
+MSG_rtl_fetch_hashfail2="2;Error: hash mismatch for URL \`%s' (should be: %s.)";
+MSG_rtl_fetch_hashfail_retryurl="2;Warning: hash mismatch for URL \`%s', retrying with alternative URL... (from build variables: %s.)";
+MSG_rtl_fetch_lockfail="1;Error: failed to acquire fetching lock for URL \`%s'.";
+MSG_rtl_fetch_lockfail_retryurl="1;Warning: failed to acquire fetching lock for URL \`%s', retrying with alternative URL...";
+MSG_rtl_fetch_rm_redundant="2;Deleting redundant file \`%s' for package \`%s'.";
+
+MSG_rtl_fileop_invalid_dir="1;Error: Invalid or non-existent directory \`%s'.";
+MSG_rtl_fileop_invparm_chgrp="1;Error: Missing parameters (in: chgrp %s.)";
+MSG_rtl_fileop_invparm_chmod="1;Error: Missing parameters (in: chmod %s.)";
+MSG_rtl_fileop_invparm_chown="1;Error: Missing parameters (in: chown %s.)";
+MSG_rtl_fileop_invparm_cp="1;Error: Missing parameters (in: cp %s.)";
+MSG_rtl_fileop_invparm_cp_follow="1;Error: Missing parameters (in: cp_follow %s.)";
+MSG_rtl_fileop_invparm="2;Error: Missing parameters (in: %s %s.)";
+MSG_rtl_fileop_invparm_fileop="1;Error: rtl_fileop() called w/ invalid parameter(s): %s";
+MSG_rtl_fileop_invparm_install="1;Error: Missing parameters (in: install %s.)";
+MSG_rtl_fileop_invparm_ln_symbolic="1;Error: Missing parameters (in: ln_symbolic %s.)";
+MSG_rtl_fileop_invparm_mv="1;Error: Missing parameters (in: mv %s.)";
+MSG_rtl_fileop_invparm_touch="1;Error: Missing parameters (in: touch %s.)";
+
+MSG_rtl_install_v2_rc="1;%s";
+
+MSG_rtl_log_vars_header="1;Variables for this %s:";
+MSG_rtl_log_unknown_tag="1;==> FIXME TODO XXX UNKNOWN TAG \`%s' PASSED TO rtl_log_msgVV()\n";
+
+MSG_rtl_platform_rc1="2;Command line: %s %s";
+MSG_rtl_platform_rc2="1;Command line: %s";
+
+# vim:foldmethod=marker ft=sh
diff --git a/etc/rtl.msgs.en b/etc/rtl.msgs.en
index 4298dae3..522640c5 100644
--- a/etc/rtl.msgs.en
+++ b/etc/rtl.msgs.en
@@ -27,7 +27,7 @@ MSG_rtl_fileop_invparm_touch="1;Error: Missing parameters (in: touch %s.)";
MSG_rtl_install_v2_rc="1;%s";
MSG_rtl_log_vars_header="1;Variables for this %s:";
-MSG_rtl_log_unknown_tag="1;==> FIXME TODO XXX UNKNOWN TAG \`%s' PASSED TO rtl_log_msg()\n";
+MSG_rtl_log_unknown_tag="1;==> FIXME TODO XXX UNKNOWN TAG \`%s' PASSED TO rtl_log_msgV()\n";
MSG_rtl_platform_rc1="2;Command line: %s %s";
MSG_rtl_platform_rc2="1;Command line: %s";
diff --git a/pkgtool.sh b/pkgtool.sh
index 0b4a518f..e5dc7952 100755
--- a/pkgtool.sh
+++ b/pkgtool.sh
@@ -145,7 +145,7 @@ pkgtoolp_init_getopts_fn() {
shift 2;
case "${1}" in
- *=*) rtl_set_var_from_cmdline "${_ppigf_rstatus}" "${1}";
+ *=*) rtl_set_var_from_spec "${_ppigf_rstatus}" "${1}";
_ppigf_rc="${?}"; ;;
*) PKGTOOL_PKG_NAME="${1}"; ;;
esac;
@@ -168,8 +168,8 @@ pkgtoolp_init_getopts_fn() {
export PKGTOOL_PKG_NAME;
case "${ARG_VERBOSE:-0}" in
- 0) rtl_log_enable_tags "${LOG_TAGS_normal}"; ;;
- 1) rtl_log_enable_tags "${LOG_TAGS_verbose}"; ;;
+ 0) rtl_log_enable_tagsV "${LOG_TAGS_normal}"; ;;
+ 1) rtl_log_enable_tagsV "${LOG_TAGS_verbose}"; ;;
*) _ppigf_rc=1;
rtl_setrstatus "${_ppigf_rstatus}" 'invalid verbosity level (max. -v)';
;;
@@ -220,34 +220,34 @@ pkgtoolp_info() {
rtl_setrstatus "${_ppi_rstatus}" 'Error: failed to set package environment for \`'"${_ppi_pkg_name}'"'.';
else
rtl_get_var_unsafe \$_ppi_pkg_version -u "PKG_${_ppi_pkg_name}_VERSION";
- rtl_log_env_vars "package_vars" "Package variables" $(rtl_get_vars_fast "^PKG_${_ppi_pkg_name_uc}");
- rtl_log_msg "info_build_group" "${MSG_info_build_group}" "${_ppi_group_name}";
+ rtl_log_env_vars "package_vars" "Package variables" $(rtl_get_vars_unsafe_fast "^PKG_${_ppi_pkg_name_uc}");
+ rtl_log_msgV "info_build_group" "${MSG_info_build_group}" "${_ppi_group_name}";
if [ "${PKG_DISABLED:-0}" -eq 1 ]; then
- rtl_log_msg "info_pkg_disabled" "${MSG_info_pkg_disabled}" "${_ppi_pkg_name}";
+ rtl_log_msgV "info_pkg_disabled" "${MSG_info_pkg_disabled}" "${_ppi_pkg_name}";
fi;
if [ "${PKG_DEPENDS:+1}" != 1 ]; then
- rtl_log_msg "info_pkg_no_deps" "${MSG_info_pkg_no_deps}" "${_ppi_pkg_name}";
+ rtl_log_msgV "info_pkg_no_deps" "${MSG_info_pkg_no_deps}" "${_ppi_pkg_name}";
else
- rtl_log_msg "info_pkg_direct_deps" "${MSG_info_pkg_direct_deps}" "${_ppi_pkg_name}" "${PKG_DEPENDS}";
+ rtl_log_msgV "info_pkg_direct_deps" "${MSG_info_pkg_direct_deps}" "${_ppi_pkg_name}" "${PKG_DEPENDS}";
if ! ex_pkg_unfold_depends \
\$_ppi_pkg_disabled \$_ppi_pkg_finished \
\$_ppi_pkg_names 1 1 "${_ppi_group_name}" \
"${_ppi_pkg_names}" "${_ppi_pkg_name}" 0 \
"${BUILD_WORKDIR}";
then
- rtl_log_msg "warning" "${MSG_info_pkg_deps_fail}" "${_ppi_pkg_name}";
+ rtl_log_msgV "warning" "${MSG_info_pkg_deps_fail}" "${_ppi_pkg_name}";
else
rtl_lfilter \$_ppi_pkg_names "${_ppi_pkg_name}";
if [ "${_ppi_pkg_names:+1}" = 1 ]; then
- rtl_log_msg "info_pkg_deps_full" "${MSG_info_pkg_deps_full}"\
+ rtl_log_msgV "info_pkg_deps_full" "${MSG_info_pkg_deps_full}"\
"${_ppi_pkg_name}" "$(rtl_lsortV "${_ppi_pkg_names}")";
fi;
if [ "${_ppi_pkg_disabled:+1}" = 1 ]; then
- rtl_log_msg "info_pkg_deps_full_disabled" "${MSG_info_pkg_deps_full_disabled}"\
+ rtl_log_msgV "info_pkg_deps_full_disabled" "${MSG_info_pkg_deps_full_disabled}"\
"${_ppi_pkg_name}" "$(rtl_lsortV "${_ppi_pkg_disabled}")";
fi;
fi;
@@ -323,7 +323,7 @@ pkgtoolp_mirror_fetch() {
if rtl_get_var_unsafe \$_ppmf_pkg_disabled -u "PKG_${_ppmf_pkg_name_real}_DISABLED"\
&& [ "${_ppmf_pkg_disabled:-0}" -eq 1 ]; then
- rtl_log_msg "verbose" "${MSG_mirror_pkg_disabled}" "${_ppmf_pkg_name}" "${_ppmf_pkg_name_real}";
+ rtl_log_msgV "verbose" "${MSG_mirror_pkg_disabled}" "${_ppmf_pkg_name}" "${_ppmf_pkg_name_real}";
else
if rtl_get_var_unsafe \$_ppmf_pkg_url -u "PKG_${_ppmf_pkg_name_real}_URL"\
&& rtl_get_var_unsafe \$_ppmf_pkg_sha256sum -u "PKG_${_ppmf_pkg_name_real}_SHA256SUM"\
@@ -332,12 +332,12 @@ pkgtoolp_mirror_fetch() {
then
if [ "${_ppmf_mirror_dname:+1}" != 1 ]; then
- _ppmf_rc=0; rtl_log_msg "verbose" "${MSG_mirror_pkg_skip_archive_mirror}" "${_ppmf_pkg_name}";
+ _ppmf_rc=0; rtl_log_msgV "verbose" "${MSG_mirror_pkg_skip_archive_mirror}" "${_ppmf_pkg_name}";
elif [ "${_ppmf_pkg_name}" != "${_ppmf_pkg_name_real}" ]; then
- rtl_log_msg "mirror_pkg_archive_mirroring_parent" "${MSG_mirror_pkg_archive_mirroring_parent}" "${_ppmf_pkg_name}" "${_ppmf_pkg_name_real}" "${_ppmf_pkg_url}";
+ rtl_log_msgV "mirror_pkg_archive_mirroring_parent" "${MSG_mirror_pkg_archive_mirroring_parent}" "${_ppmf_pkg_name}" "${_ppmf_pkg_name_real}" "${_ppmf_pkg_url}";
if ! rtl_fileop ln_symbolic "${_ppmf_pkg_name_real}" "${_ppmf_mirror_dname}/${_ppmf_pkg_name}"; then
- _ppmf_rc=1; rtl_log_msg "warning" "${MSG_mirror_pkg_link_fail}"\
+ _ppmf_rc=1; rtl_log_msgV "warning" "${MSG_mirror_pkg_link_fail}"\
"${_ppmf_mirror_dname}/${_ppmf_pkg_name}" "${_ppmf_pkg_name}" "${_ppmf_pkg_name_real}";
fi;
@@ -346,7 +346,7 @@ pkgtoolp_mirror_fetch() {
&& [ "${_ppmf_pkg_fname:+1}" != 1 ]; then
_ppmf_pkg_fname="${_ppmf_pkg_url##*/}";
fi;
- rtl_log_msg "mirror_pkg_archive_mirroring" "${MSG_mirror_pkg_archive_mirroring}" "${_ppmf_pkg_name}" "${_ppmf_pkg_url}";
+ rtl_log_msgV "mirror_pkg_archive_mirroring" "${MSG_mirror_pkg_archive_mirroring}" "${_ppmf_pkg_name}" "${_ppmf_pkg_url}";
if ! rtl_fileop mkdir "${_ppmf_mirror_dname}/${_ppmf_pkg_name}"\
|| ! rtl_fetch_url_wget \
@@ -357,7 +357,7 @@ pkgtoolp_mirror_fetch() {
"";
then
_ppmf_rc=1;
- rtl_log_msg "warning" "${MSG_mirror_pkg_mirror_fail}" "${_ppmf_pkg_name}";
+ rtl_log_msgV "warning" "${MSG_mirror_pkg_mirror_fail}" "${_ppmf_pkg_name}";
rtl_lconcat "${_ppmf_rpkgs_failed}" "${_ppmf_pkg_name}";
else
rtl_fetch_clean_dlcache \
@@ -375,27 +375,27 @@ pkgtoolp_mirror_fetch() {
then
if [ "${_ppmf_mirror_dname_git:+1}" != 1 ]; then
- _ppmf_rc=0; rtl_log_msg "verbose" "${MSG_mirror_pkg_skip_git_mirror}" "${_ppmf_pkg_name}";
+ _ppmf_rc=0; rtl_log_msgV "verbose" "${MSG_mirror_pkg_skip_git_mirror}" "${_ppmf_pkg_name}";
elif rtl_get_var_unsafe \$_ppmf_pkg_mirrors_git -u "PKG_${_ppmf_pkg_name_real}_MIRRORS_GIT"\
&& [ "${_ppmf_pkg_mirrors_git}" = "skip" ]; then
- _ppmf_rc=0; rtl_log_msg "verbose" "${MSG_mirror_pkg_skip_git_mirror_disabled}" "${_ppmf_pkg_name}";
+ _ppmf_rc=0; rtl_log_msgV "verbose" "${MSG_mirror_pkg_skip_git_mirror_disabled}" "${_ppmf_pkg_name}";
elif [ "${_ppmf_pkg_name}" != "${_ppmf_pkg_name_real}" ]; then
- rtl_log_msg "mirror_pkg_git_mirroring_parent" "${MSG_mirror_pkg_git_mirroring_parent}" "${_ppmf_pkg_name}" "${_ppmf_pkg_name_real}" "${_ppmf_pkg_urls_git}";
+ rtl_log_msgV "mirror_pkg_git_mirroring_parent" "${MSG_mirror_pkg_git_mirroring_parent}" "${_ppmf_pkg_name}" "${_ppmf_pkg_name_real}" "${_ppmf_pkg_urls_git}";
if ! rtl_fileop ln_symbolic "${_ppmf_pkg_name_real}" "${_ppmf_mirror_dname_git}/${_ppmf_pkg_name}"; then
_ppmf_rc=1;
- rtl_log_msg "warning" "${MSG_mirror_pkg_link_fail}" \
+ rtl_log_msgV "warning" "${MSG_mirror_pkg_link_fail}" \
"${_ppmf_mirror_dname_git}/${_ppmf_pkg_name}" "${_ppmf_pkg_name}" "${_ppmf_pkg_name_real}";
rtl_lconcat "${_ppmf_rpkgs_failed}" "${_ppmf_pkg_name}";
fi;
else
- rtl_log_msg "mirror_pkg_git_mirroring" "${MSG_mirror_pkg_git_mirroring}" "${_ppmf_pkg_name}" "${_ppmf_pkg_urls_git}";
+ rtl_log_msgV "mirror_pkg_git_mirroring" "${MSG_mirror_pkg_git_mirroring}" "${_ppmf_pkg_name}" "${_ppmf_pkg_urls_git}";
if ! rtl_fileop mkdir "${_ppmf_mirror_dname_git}/${_ppmf_pkg_name}"\
|| ! rtl_fetch_mirror_urls_git "${DEFAULT_GIT_ARGS}" "${_ppmf_mirror_dname_git}/${_ppmf_pkg_name}" ${_ppmf_pkg_urls_git}; then
_ppmf_rc=1;
- rtl_log_msg "warning" "${MSG_mirror_pkg_mirror_fail}" "${_ppmf_pkg_name}";
+ rtl_log_msgV "warning" "${MSG_mirror_pkg_mirror_fail}" "${_ppmf_pkg_name}";
rtl_lconcat "${_ppmf_rpkgs_failed}" "${_ppmf_pkg_name}";
else
rtl_fetch_clean_dlcache "${_ppmf_mirror_dname_git}" "${_ppmf_pkg_name}" "${_ppmf_pkg_fname}" "${_ppmf_pkg_urls_git}";
@@ -407,7 +407,7 @@ pkgtoolp_mirror_fetch() {
if [ "${_ppmf_pkg_url:+1}" != 1 ]\
&& [ "${_ppmf_pkg_sha256sum:+1}" != 1 ]\
&& [ "${_ppmf_pkg_urls_git:+1}" != 1 ]; then
- _ppmf_rc=0; rtl_log_msg "verbose" "${MSG_mirror_pkg_skip_no_urls}" "${_ppmf_pkg_name}";
+ _ppmf_rc=0; rtl_log_msgV "verbose" "${MSG_mirror_pkg_skip_no_urls}" "${_ppmf_pkg_name}";
fi;
fi;
@@ -443,7 +443,7 @@ pkgtoolp_rdepends() {
&& [ "${_ppr_pkg_finished:+1}" != 1 ]\
&& [ "${_ppr_pkg_rdepends_direct:+1}" != 1 ];
then
- rtl_log_msg "info" "${MSG_rdepends_pkg_deps_rev_none}" "${_ppr_pkg_name}";
+ rtl_log_msgV "info" "${MSG_rdepends_pkg_deps_rev_none}" "${_ppr_pkg_name}";
else
for _ppr_pkg_name_rdepend in $(rtl_lsortV \
${_ppr_pkg_finished} \
@@ -462,14 +462,14 @@ pkgtoolp_rdepends() {
if [ "${_ppr_pkg_rdepends:+1}" = 1 ]; then
if [ "${_ppr_full_rdependsfl}" -eq 1 ]; then
- rtl_log_msg "info" "${MSG_rdepends_pkgs_deps_rev_recurse}" "${_ppr_pkg_name}" "${_ppr_pkg_rdepends}";
+ rtl_log_msgV "info" "${MSG_rdepends_pkgs_deps_rev_recurse}" "${_ppr_pkg_name}" "${_ppr_pkg_rdepends}";
else
- rtl_log_msg "info" "${MSG_rdepends_pkgs_deps_rev}" "${_ppr_pkg_name}" "${_ppr_pkg_rdepends}";
+ rtl_log_msgV "info" "${MSG_rdepends_pkgs_deps_rev}" "${_ppr_pkg_name}" "${_ppr_pkg_rdepends}";
fi;
fi;
if [ "${_ppr_pkg_disabled:+1}" = 1 ]; then
- rtl_log_msg "info" "${MSG_rdepends_pkgs_deps_rev_disabled}" "${_ppr_pkg_name}" "$(rtl_lsortV "${_ppr_pkg_disabled}")";
+ rtl_log_msgV "info" "${MSG_rdepends_pkgs_deps_rev_disabled}" "${_ppr_pkg_name}" "$(rtl_lsortV "${_ppr_pkg_disabled}")";
fi;
fi;
@@ -508,7 +508,7 @@ pkgtoolp_tarball() {
fi;
_ppt_tarball_fname="${_ppt_pkg_name_full}@${_ppt_hname}-${_ppt_date}.tbz2";
- rtl_log_msg "info" "${MSG_tarball_creating}" "${PKG_BASE_DIR}" "${_ppt_pkg_name}";
+ rtl_log_msgV "info" "${MSG_tarball_creating}" "${PKG_BASE_DIR}" "${_ppt_pkg_name}";
if ! tar -C "${BUILD_WORKDIR}" -cpf - \
"${PKG_BASE_DIR#${BUILD_WORKDIR%/}/}" \
@@ -518,7 +518,7 @@ pkgtoolp_tarball() {
_ppt_rc=1;
rtl_setrstatus "${_ppt_rstatus}" 'Error: failed to create compressed tarball of \`'"${PKG_BASE_DIR}'"' and \`'"${_ppt_pkg_name}"'_stderrout.log'"'"'.';
else
- rtl_log_msg "info" "${MSG_tarball_created}" "${PKG_BASE_DIR}" "${_ppt_pkg_name}";
+ rtl_log_msgV "info" "${MSG_tarball_created}" "${PKG_BASE_DIR}" "${_ppt_pkg_name}";
fi;
fi;
@@ -545,11 +545,11 @@ pkgtool() {
fi;
if [ "${_rc}" -ne 0 ]; then
- rtl_log_enable_tags "${LOG_TAGS_all}";
- rtl_log_msg "fatalexit" "0;${_status}";
+ rtl_log_enable_tagsV "${LOG_TAGS_all}";
+ rtl_log_msgV "fatalexit" "0;${_status}";
elif [ "${_status:+1}" = 1 ]; then
- rtl_log_enable_tags "${LOG_TAGS_all}";
- rtl_log_msg "info" "0;${_status}";
+ rtl_log_enable_tagsV "${LOG_TAGS_all}";
+ rtl_log_msgV "info" "0;${_status}";
fi;
};
diff --git a/subr.ex/ex_init.subr b/subr.ex/ex_init.subr
index 3125aadf..71bcc672 100644
--- a/subr.ex/ex_init.subr
+++ b/subr.ex/ex_init.subr
@@ -291,8 +291,8 @@ ex_init_files() {
if rtl_lmatch "${_eif_rclean_builds}" $"prefix" ","; then
trap "rm -f \"${_eif_build_status_in_progress_fname}\" 2>/dev/null;
- rtl_log_msg \"fatalexit\" \"${MSG_build_aborted}\"" HUP INT TERM USR1 USR2;
- rtl_log_msg "info" "${MSG_build_clean_prefix}";
+ rtl_log_msgV \"fatalexit\" \"${MSG_build_aborted}\"" HUP INT TERM USR1 USR2;
+ rtl_log_msgV "info" "${MSG_build_clean_prefix}";
for _eif_pname in ${_eif_clear_prefix_paths}; do
if ! rtl_fileop rm "${_eif_prefix}/${_eif_pname}"; then
@@ -327,11 +327,11 @@ ex_init_logging() {
case "${_eil_verbose}" in
0) if eval [ \"\${#${_eil_rverbose_tags}}\" -eq 0 ]; then
- rtl_log_enable_tags "${LOG_TAGS_normal}";
+ rtl_log_enable_tagsV "${LOG_TAGS_normal}";
fi;
;;
- 1) rtl_log_enable_tags "${LOG_TAGS_verbose}"; ;;
+ 1) rtl_log_enable_tagsV "${LOG_TAGS_verbose}"; ;;
*) _eil_rc=1;
rtl_setrstatus "${_eil_rstatus}" 'invalid verbosity level (max. -v)';
@@ -343,7 +343,7 @@ ex_init_logging() {
eval _eil_tags="\${${_eil_rverbose_tags}}";
case "${_eil_tags}" in
- +*) rtl_log_enable_tags "${LOG_TAGS_normal}";
+ +*) rtl_log_enable_tagsV "${LOG_TAGS_normal}";
eval ${_eil_rverbose_tags}="\${${_eil_rverbose_tags}#+}";
;;
@@ -356,17 +356,17 @@ ex_init_logging() {
for _eil_tag in ${_eil_tags}; do
case "${_eil_tag}" in
- all) rtl_log_enable_tags "${LOG_TAGS_all}"; ;;
+ all) rtl_log_enable_tagsV "${LOG_TAGS_all}"; ;;
clear|none) rtl_log_clear_tags; ;;
- normal) rtl_log_enable_tags "${LOG_TAGS_normal}"; ;;
+ normal) rtl_log_enable_tagsV "${LOG_TAGS_normal}"; ;;
- verbose) rtl_log_enable_tags "${LOG_TAGS_verbose}"; ;;
+ verbose) rtl_log_enable_tagsV "${LOG_TAGS_verbose}"; ;;
*) rtl_lsearch_patternl2 \$LOG_TAGS_all \$_eil_tags_enable "${_eil_tag}" ",";
if [ "${#_eil_tags_enable}" -gt 0 ]; then
- rtl_log_enable_tags "${_eil_tags_enable}";
+ rtl_log_enable_tagsV "${_eil_tags_enable}";
else
_eil_rc=1;
rtl_setrstatus "${_eil_rstatus}" 'invalid log tag or tag pattern \`'"${_eil_tag}"''\''.';
@@ -392,7 +392,7 @@ ex_init_prereqs() {
local _eip_rstatus="${1#\$}" _eip_prereqs="${2}" \
_eip_rc=0;
- if ! rtl_check_prereqs "${_eip_rstatus}" ${_eip_prereqs}; then
+ if ! rtl_check_prereqsV "${_eip_rstatus}" ${_eip_prereqs}; then
_eip_rc=1;
elif ! awk -V 2>/dev/null | grep -q "^GNU Awk "; then
_eip_rc=1;
diff --git a/subr.ex/ex_pkg.subr b/subr.ex/ex_pkg.subr
index 978808a6..041faa4f 100644
--- a/subr.ex/ex_pkg.subr
+++ b/subr.ex/ex_pkg.subr
@@ -37,7 +37,7 @@ ex_pkg_check_depends() {
&& ! ex_pkg_state_test2 "${_epcd_workdir}" "${_epcd_pkg_name_depend}" finish;
then
if ! rtl_lmatch "${_epcd_rpkg_names}" "${_epcd_pkg_name_depend}"; then
- rtl_log_msg "fatalexit" "${MSG_build_unknown_dep}" "${_epcd_pkg_name_depend}" "${_epcd_pkg_name}";
+ rtl_log_msgV "fatalexit" "${MSG_build_unknown_dep}" "${_epcd_pkg_name_depend}" "${_epcd_pkg_name}";
else
_epcd_dependfl=1; break;
fi;
diff --git a/subr.ex/ex_pkg_dispatch.subr b/subr.ex/ex_pkg_dispatch.subr
index d95339ee..22917baa 100644
--- a/subr.ex/ex_pkg_dispatch.subr
+++ b/subr.ex/ex_pkg_dispatch.subr
@@ -341,7 +341,7 @@ ex_pkg_dispatch() {
"${_epd_perc_group}";
then
if rtl_fileop mkdir "${_epd_workdir}"\
- && rtl_log_msg "verbose" "${MSG_build_resolving_deps}" "${_epd_group_name}"\
+ && rtl_log_msgV "verbose" "${MSG_build_resolving_deps}" "${_epd_group_name}"\
&& exp_pkg_dispatch_expand_packages \
\$_epd_pkg_disabled \$_epd_pkg_finished \
\$_epd_pkg_names "${_epd_checkfl}" \
@@ -351,7 +351,7 @@ ex_pkg_dispatch() {
&& exp_pkg_dispatch_complete \
"${_epd_dispatch_fn}" "${_epd_group_name}" \
"${_epd_pkg_disabled}" "${_epd_pkg_finished}" \
- && rtl_log_msg "verbose" "${MSG_build_resolved_deps}" "${_epd_group_name}"\
+ && rtl_log_msgV "verbose" "${MSG_build_resolved_deps}" "${_epd_group_name}"\
&& rtl_llength \$_epd_pkg_dispatch_count_max \$_epd_pkg_names\
&& [ "${_epd_pkg_dispatch_count_max}" -gt 0 ];
then
diff --git a/subr.ex/ex_pkg_env.subr b/subr.ex/ex_pkg_env.subr
index e2cfb1db..a34a2840 100644
--- a/subr.ex/ex_pkg_env.subr
+++ b/subr.ex/ex_pkg_env.subr
@@ -31,7 +31,7 @@ exp_pkg_env_defaults() {
if [ "${PKG_SUBDIR:+1}" != 1 ]; then
if [ "${PKG_URLS_GIT:+1}" = 1 ]\
&& [ "${PKG_FNAME:+1}" = 1 ]; then
- rtl_log_msg "fatalexit" "${MSG_pkg_fail_missing_vars}";
+ rtl_log_msgV "fatalexit" "${MSG_pkg_fail_missing_vars}";
elif [ "${PKG_URLS_GIT:+1}" = 1 ]; then
PKG_SUBDIR="${PKG_URLS_GIT%%=*}";
else case "${PKG_FNAME:-}" in
@@ -72,8 +72,8 @@ exp_pkg_env_set() {
_eppes_lvars="" _eppes_var_prefixes="" _eppes_vars_set="" \
_eppes_vars_unset="" _eppes_vname="" _eppes_vnames="" IFS IFS0;
- rtl_set_vars _eppes_vars_set BUILD_TYPE "DEFAULT ${_eppes_group_name} PKG_${_eppes_pkg_name}";
- rtl_set_vars _eppes_vars_set INHERIT_FROM "PKG_${_eppes_pkg_name}";
+ rtl_set_var _eppes_vars_set BUILD_TYPE "DEFAULT ${_eppes_group_name} PKG_${_eppes_pkg_name}";
+ rtl_set_var _eppes_vars_set INHERIT_FROM "PKG_${_eppes_pkg_name}";
_eppes_var_prefixes="DEFAULT DEFAULT_${PKG_BUILD_TYPE} ${_eppes_group_name}";
rtl_toupper \$_eppes_var_prefixes;
rtl_lfilter2 \$_eppes_build_vars_default \$_eppes_vnames BUILD_TYPE;
@@ -83,12 +83,12 @@ exp_pkg_env_set() {
_eppes_lvars="PKG_${PKG_INHERIT_FROM} PKG_${PKG_INHERIT_FROM}_${BUILD_KIND} PKG_${_eppes_pkg_name} PKG_${_eppes_pkg_name}_${BUILD_KIND}";
rtl_toupper \$_eppes_lvars;
rtl_lconcat2 \$_eppes_lvars \$_eppes_var_prefixes "${_eppes_lvars}";
- rtl_set_vars _eppes_vars_set "${_eppes_vname}" "${_eppes_lvars}";
+ rtl_set_var _eppes_vars_set "${_eppes_vname}" "${_eppes_lvars}";
else
_eppes_lvars="PKG_${_eppes_pkg_name} PKG_${_eppes_pkg_name}_${BUILD_KIND}";
rtl_toupper \$_eppes_lvars;
rtl_lconcat2 \$_eppes_lvars \$_eppes_var_prefixes "${_eppes_lvars}";
- rtl_set_vars _eppes_vars_set "${_eppes_vname}" "${_eppes_lvars}";
+ rtl_set_var _eppes_vars_set "${_eppes_vname}" "${_eppes_lvars}";
fi;
done;
diff --git a/subr.pkg/pkg_build.subr b/subr.pkg/pkg_build.subr
index 8eac6fc0..71b057b9 100644
--- a/subr.pkg/pkg_build.subr
+++ b/subr.pkg/pkg_build.subr
@@ -34,22 +34,24 @@ pkg_build() {
# N.B. We only specify CC= here if the current package does not use GNU
# autoconf as it often abuses it by appending -std={gnu99,...} to it
# instead of amending CFLAGS.
- rtl_run_cmd_unsplit "${PKG_MAKE}" \
- ${PKG_MAKEFLAGS_BUILD:-} \
- ${PKG_MAKEFLAGS_BUILD_EXTRA:-} \
- "AR=${PKG_AR}" "${_pb_no_autoconf:+CC=${PKG_CC}}" "RANLIB=${PKG_RANLIB}" \
- "${PKG_CFLAGS_BUILD:+CFLAGS=${PKG_CFLAGS_BUILD}}" \
- "${PKG_CFLAGS_BUILD_EXTRA:+CFLAGS+=${PKG_CFLAGS_BUILD_EXTRA}}" \
- "${PKG_CPPFLAGS_BUILD:+CPPFLAGS=${PKG_CPPFLAGS_BUILD}}" \
- "${PKG_CPPFLAGS_BUILD_EXTRA:+CPPFLAGS+=${PKG_CPPFLAGS_BUILD_EXTRA}}" \
- "${PKG_CXXFLAGS_BUILD:+CXXFLAGS=${PKG_CXXFLAGS_BUILD}}" \
- "${PKG_CXXFLAGS_BUILD_EXTRA:+CXXFLAGS+=${PKG_CXXFLAGS_BUILD_EXTRA}}" \
- "${PKG_LDFLAGS_BUILD:+LDFLAGS=${PKG_LDFLAGS_BUILD}}" \
- "${PKG_LDFLAGS_BUILD_EXTRA:+LDFLAGS+=${PKG_LDFLAGS_BUILD_EXTRA}}" \
- "${PKG_PKG_CONFIG:+PKG_CONFIG=${PKG_PKG_CONFIG}}" \
- "${PKG_PKG_CONFIG_LIBDIR:+PKG_CONFIG_LIBDIR=${PKG_PKG_CONFIG_LIBDIR}}" \
- ${_pb_libtool:+"LIBTOOL=${_pb_libtool}"} \
- ${_pb_makeflags_verbosity} \
+ rtl_run_cmdlineV ":" "${PKG_MAKE}" \
+ ${PKG_MAKEFLAGS_BUILD:-} \
+ ${PKG_MAKEFLAGS_BUILD_EXTRA:-} \
+ "AR=${PKG_AR}" \
+ "${_pb_no_autoconf:+CC=${PKG_CC}}" \
+ "RANLIB=${PKG_RANLIB}" \
+ "${PKG_CFLAGS_BUILD:+CFLAGS=${PKG_CFLAGS_BUILD}}" \
+ "${PKG_CFLAGS_BUILD_EXTRA:+CFLAGS+=${PKG_CFLAGS_BUILD_EXTRA}}" \
+ "${PKG_CPPFLAGS_BUILD:+CPPFLAGS=${PKG_CPPFLAGS_BUILD}}" \
+ "${PKG_CPPFLAGS_BUILD_EXTRA:+CPPFLAGS+=${PKG_CPPFLAGS_BUILD_EXTRA}}" \
+ "${PKG_CXXFLAGS_BUILD:+CXXFLAGS=${PKG_CXXFLAGS_BUILD}}" \
+ "${PKG_CXXFLAGS_BUILD_EXTRA:+CXXFLAGS+=${PKG_CXXFLAGS_BUILD_EXTRA}}" \
+ "${PKG_LDFLAGS_BUILD:+LDFLAGS=${PKG_LDFLAGS_BUILD}}" \
+ "${PKG_LDFLAGS_BUILD_EXTRA:+LDFLAGS+=${PKG_LDFLAGS_BUILD_EXTRA}}" \
+ "${PKG_PKG_CONFIG:+PKG_CONFIG=${PKG_PKG_CONFIG}}" \
+ "${PKG_PKG_CONFIG_LIBDIR:+PKG_CONFIG_LIBDIR=${PKG_PKG_CONFIG_LIBDIR}}" \
+ ${_pb_libtool:+"LIBTOOL=${_pb_libtool}"} \
+ ${_pb_makeflags_verbosity} \
${_pb_subdir:+-C "${_pb_subdir}"};
_pb_rc="${?}";
diff --git a/subr.pkg/pkg_build_clean.subr b/subr.pkg/pkg_build_clean.subr
index af312bd7..e3456031 100644
--- a/subr.pkg/pkg_build_clean.subr
+++ b/subr.pkg/pkg_build_clean.subr
@@ -20,13 +20,14 @@ pkg_build_clean() {
[ "${_pbc_subdir}" = ":" ] && _pbc_subdir="";
[ "${#_pbc_libtool}" -gt 0 ] && export MAKE="make LIBTOOL=${_pbc_libtool}";
- rtl_run_cmd_unsplit "${PKG_MAKE}" \
+ rtl_run_cmdlineV ":" "${PKG_MAKE}" \
${PKG_MAKEFLAGS_BUILD:-} \
${PKG_MAKEFLAGS_BUILD_EXTRA:-} \
${_pbc_libtool:+"LIBTOOL=${_pbc_libtool}"} \
${_pbc_makeflags_verbosity} \
${_pbc_subdir:+-C "${_pbc_subdir}"} \
- clean; _pbc_rc="${?}";
+ clean;
+ _pbc_rc="${?}";
[ "${#_pbc_libtool}" -gt 0 ] && unset MAKE;
[ "${_pbc_rc}" -ne 0 ] && return 1;
diff --git a/subr.pkg/pkg_install_files.subr b/subr.pkg/pkg_install_files.subr
index e79f5bc0..204bab74 100644
--- a/subr.pkg/pkg_install_files.subr
+++ b/subr.pkg/pkg_install_files.subr
@@ -106,7 +106,7 @@ pkgp_install_files_strip() {
if [ "${_ppifs_stripfl:-0}" -eq 1 ]; then
for _ppifs_bin_path in $(find "${_ppifs_tree_root}" -perm /a=x -type f); do
if objdump -sj .debug_frame -j .debug_info "${_ppifs_bin_path}" >/dev/null 2>&1; then
- rtl_log_msg "pkg_strip" "${MSG_pkg_strip}" "${_ppifs_bin_path}";
+ rtl_log_msgV "pkg_strip" "${MSG_pkg_strip}" "${_ppifs_bin_path}";
if ! "${PKG_TARGET}-strip" "${_ppifs_bin_path}"; then
return 1;
fi;
diff --git a/subr.pkg/pkg_install_make.subr b/subr.pkg/pkg_install_make.subr
index c88cff10..a3611b32 100644
--- a/subr.pkg/pkg_install_make.subr
+++ b/subr.pkg/pkg_install_make.subr
@@ -22,15 +22,18 @@ pkg_install_make() {
export MAKE="make LIBTOOL=${_pim_libtool}";
fi;
- rtl_run_cmd_unsplit "${PKG_MAKE}" \
+ rtl_run_cmdlineV ":" "${PKG_MAKE}" \
${PKG_MAKEFLAGS_INSTALL:-} \
${PKG_MAKEFLAGS_INSTALL_EXTRA:-} \
- AR="${PKG_AR}" CC="${PKG_CC}" RANLIB="${PKG_RANLIB}" \
- "${PKG_RANLIB_INSTALL:+RANLIB=${PKG_RANLIB_INSTALL}}" \
+ AR="${PKG_AR}" \
+ CC="${PKG_CC}" \
+ RANLIB="${PKG_RANLIB}" \
+ ${PKG_RANLIB_INSTALL:+"RANLIB=${PKG_RANLIB_INSTALL}"} \
${_pim_libtool:+"LIBTOOL=${_pim_libtool}"} \
"${PKG_MAKE_INSTALL_VNAME:-DESTDIR}=${PKG_DESTDIR}/" \
- ${PKG_INSTALL_TARGET:-install} \
- ${_pim_subdir:+-C "${_pim_subdir}"}; _pim_rc="${?}";
+ "${PKG_INSTALL_TARGET:-install}" \
+ ${_pim_subdir:+-C "${_pim_subdir}"};
+ _pim_rc="${?}";
if [ "${#_pim_libtool}" -gt 0 ]; then
unset MAKE;
diff --git a/subr.rtl/rtl_fetch.subr b/subr.rtl/rtl_fetch.subr
index 7946b7c7..3ebd2d06 100644
--- a/subr.rtl/rtl_fetch.subr
+++ b/subr.rtl/rtl_fetch.subr
@@ -35,7 +35,7 @@ rtl_fetch_clean_dlcache() {
if [ "${_pfdcd_skipfl}" -eq 0 ]; then
_pfdcd_fname="${_pfdcd_dlcachedir}/${_pfdcd_name}/${_pfdcd_fname}";
- rtl_log_msg "verbose" "${MSG_rtl_fetch_rm_redundant}" "${_pfdcd_fname}" "${_pfdcd_name}";
+ rtl_log_msgV "verbose" "${MSG_rtl_fetch_rm_redundant}" "${_pfdcd_fname}" "${_pfdcd_name}";
rtl_fileop rm "${_pfdcd_fname}";
fi;
done;
diff --git a/subr.rtl/rtl_fetch_wget.subr b/subr.rtl/rtl_fetch_wget.subr
index 13bc347a..361603f0 100644
--- a/subr.rtl/rtl_fetch_wget.subr
+++ b/subr.rtl/rtl_fetch_wget.subr
@@ -13,7 +13,7 @@
# @_mirrors: optional list of mirror base URLs
#
# Returns: zero (0) on success, non-zero (>0) on failure
-# N.B. URLs ($1) may contain `?' or '&' characters.
+# N.B.: URLs ($1) may contain `?' or '&' characters.
#
rtl_fetch_url_wget() {
local _rfuw_urls="${1}" _rfuw_sha256sum_src="${2}" _rfuw_target_dname="${3}" \
@@ -57,28 +57,28 @@ rtl_fetch_url_wget() {
0) break; ;;
1) if [ "${_rfuw_urls_count}" -ge 1 ]; then
- rtl_log_msg "warning" "${MSG_rtl_fetch_lockfail_retryurl}" "${_rfuw_url}";
+ rtl_log_msgV "warning" "${MSG_rtl_fetch_lockfail_retryurl}" "${_rfuw_url}";
else
- rtl_log_msg "fatal" "${MSG_rtl_fetch_lockfail}" "${_rfuw_url}";
+ rtl_log_msgV "fatal" "${MSG_rtl_fetch_lockfail}" "${_rfuw_url}";
rtl_fileop rm "${_rfuw_target_fname_full}"; break;
fi; ;;
2) if [ "${_rfuw_urls_count}" -ge 1 ]; then
- rtl_log_msg "warning" "${MSG_rtl_fetch_hashfail_retryurl}" "${_rfuw_url}" "${_rfuw_sha256sum_src}";
+ rtl_log_msgV "warning" "${MSG_rtl_fetch_hashfail_retryurl}" "${_rfuw_url}" "${_rfuw_sha256sum_src}";
else
if _rfuw_sha256sum_target="$(sha256sum "${_rfuw_target_fname_full}" |\
awk '{print $1}' 2>/dev/null)"; then
- rtl_log_msg "fatal" "${MSG_rtl_fetch_hashfail1}" "${_rfuw_url}" "${_rfuw_sha256sum_src}" "${_rfuw_sha256sum_target}";
+ rtl_log_msgV "fatal" "${MSG_rtl_fetch_hashfail1}" "${_rfuw_url}" "${_rfuw_sha256sum_src}" "${_rfuw_sha256sum_target}";
else
- rtl_log_msg "fatal" "${MSG_rtl_fetch_hashfail2}" "${_rfuw_url}" "${_rfuw_sha256sum_src}";
+ rtl_log_msgV "fatal" "${MSG_rtl_fetch_hashfail2}" "${_rfuw_url}" "${_rfuw_sha256sum_src}";
fi;
rtl_fileop rm "${_rfuw_target_fname_full}"; break;
fi; ;;
*) if [ "${_rfuw_urls_count}" -ge 1 ]; then
- rtl_log_msg "warning" "${MSG_rtl_fetch_fail_retryurl}" "${_rfuw_url}" "$((${_rfuw_rc}-2))";
+ rtl_log_msgV "warning" "${MSG_rtl_fetch_fail_retryurl}" "${_rfuw_url}" "$((${_rfuw_rc}-2))";
else
- rtl_log_msg "fatal" "${MSG_rtl_fetch_fail}" "${_rfuw_url}" "$((${_rfuw_rc}-2))";
+ rtl_log_msgV "fatal" "${MSG_rtl_fetch_fail}" "${_rfuw_url}" "$((${_rfuw_rc}-2))";
rtl_fileop rm "${_rfuw_target_fname_full}"; break;
fi; ;;
diff --git a/subr.rtl/rtl_fileop.subr b/subr.rtl/rtl_fileop.subr
index 10d741c5..0f999ad7 100644
--- a/subr.rtl/rtl_fileop.subr
+++ b/subr.rtl/rtl_fileop.subr
@@ -13,7 +13,7 @@ rtlp_fileop_check() {
};
rtlp_fileop_log() {
- rtl_log_msg "fileop" "0;${1}";
+ rtl_log_msgV "fileop" "0;${1}";
};
#
@@ -35,14 +35,14 @@ rtl_fileop() {
case "${_rf_op}" in
cd) if [ \( "${1:+1}" != 1 \) -o ! \( -L "${1}" -o -e "${1}" \) ]; then
- rtl_log_msg "fatalexit" "${MSG_rtl_fileop_invalid_dir}" "${1}";
+ rtl_log_msgV "fatalexit" "${MSG_rtl_fileop_invalid_dir}" "${1}";
elif rtlp_fileop_check "${PREFIX:-}" "${1}"; then
rtlp_fileop_log "Changing working directory to \`${1}'.";
cd -- "${1}"; _rf_rc="${?}";
fi; ;;
chmod) if [ "${#}" -lt 2 ]; then
- rtl_log_msg "fatalexit" "${MSG_rtl_fileop_invparm_chmod}" "${*}";
+ rtl_log_msgV "fatalexit" "${MSG_rtl_fileop_invparm_chmod}" "${*}";
elif _rf_mode="${1}" && shift\
&& rtlp_fileop_check "${PREFIX:-}" "${*}"; then
rtlp_fileop_log "Changing file mode bits of \`${*}' to \`${_rf_mode}'.";
@@ -50,7 +50,7 @@ rtl_fileop() {
fi; ;;
chgrp) if [ "${#}" -lt 2 ]; then
- rtl_log_msg "fatalexit" "${MSG_rtl_fileop_invparm_chgrp}" "${*}";
+ rtl_log_msgV "fatalexit" "${MSG_rtl_fileop_invparm_chgrp}" "${*}";
elif _rf_group="${1}" && shift\
&& rtlp_fileop_check "${PREFIX:-}" "${*}"; then
rtlp_fileop_log "Changing file group of \`${*}' to \`${_rf_group}'.";
@@ -58,7 +58,7 @@ rtl_fileop() {
fi; ;;
chown) if [ "${#}" -lt 2 ]; then
- rtl_log_msg "fatalexit" "${MSG_rtl_fileop_invparm_chown}" "${*}";
+ rtl_log_msgV "fatalexit" "${MSG_rtl_fileop_invparm_chown}" "${*}";
elif _rf_owner="${1}" && shift\
&& rtlp_fileop_check "${PREFIX:-}" "${*}"; then
rtlp_fileop_log "Changing file owner of \`${*}' to \`${_rf_owner}'.";
@@ -67,7 +67,7 @@ rtl_fileop() {
cp_follow)
if [ "${#}" -lt 2 ]; then
- rtl_log_msg "fatalexit" "${MSG_rtl_fileop_invparm_cp_follow}" "${*}";
+ rtl_log_msgV "fatalexit" "${MSG_rtl_fileop_invparm_cp_follow}" "${*}";
elif rtlp_fileop_check "${PREFIX:-}" "${*}"; then
_rf_src="${*}"; _rf_src="${_rf_src% *}";
_rf_dst="${*}"; _rf_dst="${_rf_dst##* }";
@@ -76,7 +76,7 @@ rtl_fileop() {
fi; ;;
cp) if [ "${#}" -lt 2 ]; then
- rtl_log_msg "fatalexit" "${MSG_rtl_fileop_invparm_cp}" "${*}";
+ rtl_log_msgV "fatalexit" "${MSG_rtl_fileop_invparm_cp}" "${*}";
elif rtlp_fileop_check "${PREFIX:-}" "${*}"; then
_rf_src="${*}"; _rf_src="${_rf_src% *}";
_rf_dst="${*}"; _rf_dst="${_rf_dst##* }";
@@ -86,7 +86,7 @@ rtl_fileop() {
install)
if [ "${#}" -lt 2 ]; then
- rtl_log_msg "fatalexit" "${MSG_rtl_fileop_invparm_install}" "${*}";
+ rtl_log_msgV "fatalexit" "${MSG_rtl_fileop_invparm_install}" "${*}";
else
rtl_lindexV \$_rf_dst -1 "${@}";
rtl_lrangeV \$_rf_install_args 0 1 "${@}";
@@ -100,7 +100,7 @@ rtl_fileop() {
ln_symbolic)
if [ \( "${1:+1}" != 1 \) -o \( "${2:+1}" != 1 \) ]; then
- rtl_log_msg "fatalexit" "${MSG_rtl_fileop_invparm_ln_symbolic}" "${*}";
+ rtl_log_msgV "fatalexit" "${MSG_rtl_fileop_invparm_ln_symbolic}" "${*}";
elif rtlp_fileop_check "${PREFIX:-}" "${2}"; then
if rtl_fileop test "${2}"; then
rtl_fileop rm "${2}";
@@ -112,14 +112,14 @@ rtl_fileop() {
fi; ;;
mv) if [ \( "${1:+1}" != 1 \) -o \( "${2:+1}" != 1 \) ]; then
- rtl_log_msg "fatalexit" "${MSG_rtl_fileop_invparm_mv}" "${*}";
+ rtl_log_msgV "fatalexit" "${MSG_rtl_fileop_invparm_mv}" "${*}";
elif rtlp_fileop_check "${PREFIX:-}" "${1}" "${2}"; then
rtlp_fileop_log "Moving \`${1}' to \`${2}' w/ -fs";
mv -f -- "${1}" "${2}"; _rf_rc="${?}";
fi; ;;
touch) if [ "${1:+1}" != 1 ]; then
- rtl_log_msg "fatalexit" "${MSG_rtl_fileop_invparm_touch}" "${*}";
+ rtl_log_msgV "fatalexit" "${MSG_rtl_fileop_invparm_touch}" "${*}";
elif rtlp_fileop_check "${PREFIX:-}" "${1}"; then
rtlp_fileop_log "Touching file \`${1}'${2:+ w/ timestamp \`${2}\'}.";
touch ${2:+-t "${2}"} -- "${1}"; _rf_rc="${?}";
@@ -128,7 +128,7 @@ rtl_fileop() {
mkdir|mkfifo|rm|source|source_opt|test)
while [ \( "${?}" -eq 0 \) -a \( ""${#}"" -gt 0 \) ]; do
if [ "${1:+1}" != 1 ]; then
- rtl_log_msg "fatalexit" "${MSG_rtl_fileop_invparm}" "${_rf_op}" "${*}";
+ rtl_log_msgV "fatalexit" "${MSG_rtl_fileop_invparm}" "${_rf_op}" "${*}";
elif [ "${_rf_op}" = mkdir ]\
&& [ ! -d "${1}" ]\
&& rtlp_fileop_check "${PREFIX:-}" "${1}"; then
@@ -166,7 +166,7 @@ rtl_fileop() {
fi; shift;
done; ;;
- *) rtl_log_msg "fatalexit" "${MSG_rtl_fileop_invparm_fileop}" "${*}"; ;;
+ *) rtl_log_msgV "fatalexit" "${MSG_rtl_fileop_invparm_fileop}" "${*}"; ;;
esac;
diff --git a/subr.rtl/rtl_install_v2.subr b/subr.rtl/rtl_install_v2.subr
index 480121f8..da4c3090 100644
--- a/subr.rtl/rtl_install_v2.subr
+++ b/subr.rtl/rtl_install_v2.subr
@@ -303,7 +303,7 @@ rtlp_install_v2_rc() {
if [ "${_ri2r_nflag}" -eq 1 ]\
|| [ "${_ri2r_vflag}" -gt 0 ]; then
- rtl_log_msg "install" "${MSG_rtl_install_v2_rc}" "${_ri2r_fn}${_ri2r_fn:+ ${*}}";
+ rtl_log_msgV "install" "${MSG_rtl_install_v2_rc}" "${_ri2r_fn}${_ri2r_fn:+ ${*}}";
fi;
if [ "${_ri2r_nflag}" -eq 0 ]; then
"${_ri2r_fn}" "${@}"; _ri2r_rc="${?}";
diff --git a/subr.rtl/rtl_list.subr b/subr.rtl/rtl_list.subr
index 5934126f..36bc77e9 100644
--- a/subr.rtl/rtl_list.subr
+++ b/subr.rtl/rtl_list.subr
@@ -34,6 +34,8 @@ rtl_lassignV() {
# @_rlist: inout reference to list
# @_litem_new: list item(s) to concatenate with
# @[_sep]: optional single non-zero, possibly multi-character, separator
+# N.B.: If @_litem_new is a list of multiple items, the separator of that list
+# must be the same as @[_sep]
#
# Returns: zero (0) on success, non-zero (>0) on failure
#
@@ -49,6 +51,8 @@ rtl_lconcat() {
# @[_sep]: optional single non-zero, possibly multi-character, separator
#
# Returns: zero (0) on success, non-zero (>0) on failure
+# N.B.: If @_litem_new is a list of multiple items, the separator of that list
+# must be the same as @[_sep]
#
rtl_lconcat2() {
local _rlc2_rlist_new="${1#\$}" _rlc2_rlist="${2#\$}" _rlc2_litem_new="${3}" \
diff --git a/subr.rtl/rtl_log.subr b/subr.rtl/rtl_log.subr
index 1254916a..69e620bf 100644
--- a/subr.rtl/rtl_log.subr
+++ b/subr.rtl/rtl_log.subr
@@ -16,6 +16,13 @@ RTLP_LOG_TERMINAL_COLOURS="$(tput colors 2>/dev/null)";
# Private subroutines
#
+#
+# rtlp_log_msg_get_attr() - get attributes e.g. ANSI escape sequences for single log tag
+# @_rattr: out reference to attributes e.g. ANSI escape sequences
+# @_tag: tag to log message at
+#
+# Returns: zero (0) on success, non-zero (>0) on failure
+#
rtlp_log_msg_get_attr() {
local _rplmga_rattr="${1#\$}" _rplmga_tag="${2}" \
_rplmga_attr="" _rplmga_attr_state="" \
@@ -57,7 +64,16 @@ rtlp_log_msg_get_attr() {
return 0;
};
-rtlp_log_printf() {
+#
+# rtlp_log_printfV() - print single message to log file
+# @_attr: attributes e.g. ANSI escape sequences to log message with
+# @_fmt_pfx: printf(1) format string prefix
+# @_fmt: printf(1) format string
+# @...: parameters to printf(1) w/ @_fmt
+#
+# Returns: zero (0) on success, non-zero (>0) on failure
+#
+rtlp_log_printfV() {
local _rplp_attr="${1}" _rplp_fmt_pfx="${2}" \
_rplp_fmt="${3#*;}" _rplp_fmt_argc="${3%%;*}";
shift 3;
@@ -66,7 +82,7 @@ rtlp_log_printf() {
if [ "${_rplp_fmt_argc}" -eq 0 ]; then
shift "${#}";
else
- rtlp_log_printf "" "" "0;==> FIXME TODO XXX MESSAGE STRING ARGUMENT COUNT MISMATCH\n";
+ rtlp_log_printfV "" "" "0;==> FIXME TODO XXX MESSAGE STRING ARGUMENT COUNT MISMATCH\n";
fi;
fi;
_rplp_msg="$(printf "${_rplp_fmt_pfx}${_rplp_fmt}" "${@}")";
@@ -86,11 +102,23 @@ rtlp_log_printf() {
# Public subroutines
#
+#
+# rtl_log_clear_tags() - clear all log tags
+#
+# Returns: zero (0) on success, non-zero (>0) on failure
+#
rtl_log_clear_tags() {
- RTLP_LOG_TAGS=""; return 0;
+ RTLP_LOG_TAGS="";
+ return 0;
};
-rtl_log_enable_tags() {
+#
+# rtl_log_enable_tagsV() - enable log tags
+# @...: list of tags to enable as positional parameters
+#
+# Returns: zero (0) on success, non-zero (>0) on failure
+#
+rtl_log_enable_tagsV() {
local IFS=","; set -- ${*};
while [ "${#}" -gt 0 ]; do
@@ -101,17 +129,24 @@ rtl_log_enable_tags() {
return 0;
};
+#
+# rtl_log_env_vars() - log all environment variables to log file
+# @_tag: tag to log environment variables at
+# @_type: type string printed in log message header
+#
+# Returns: zero (0) on success, non-zero (>0) on failure
+#
rtl_log_env_vars() {
local _rlev_tag="${1}" _rlev_type="${2}" \
_rlev_arg_len_max=0 _rlev_list="" _rlev_msg="" _rlev_msg_="";
shift 2;
- rtl_log_msg "${_rlev_tag}" "${MSG_rtl_log_vars_header}" "${_rlev_type}";
+ rtl_log_msgV "${_rlev_tag}" "${MSG_rtl_log_vars_header}" "${_rlev_type}";
_rlev_list="${@}"; rtl_lmax \$_rlev_list \$_rlev_arg_len_max;
while [ "${#}" -gt 0 ]; do
rtl_get_var_unsafe \$_rlev_msg "${1#*=}";
rtl_llift2 \$_rlev_msg \$_rlev_msg_ "" " ";
- rtl_log_msg "${_rlev_tag}" \
+ rtl_log_msgV "${_rlev_tag}" \
"2;%${_rlev_arg_len_max}.${_rlev_arg_len_max}s=%s" \
"${1%%=*}" "${_rlev_msg_}";
shift;
@@ -119,7 +154,20 @@ rtl_log_env_vars() {
return 0;
};
-rtl_log_msg() {
+#
+# rtl_log_msgV() - log message to log file
+# @_tag: tag to log message at
+# @_fmt: printf(1) format string
+# @...: parameters to printf(1) w/ @_fmt
+#
+# Returns: zero (0) on success, non-zero (>0) on failure
+# N.B.: Optional attributes e.g. ANSI escape sequences w/ which the the log message is to
+# be printed are taken from the variable corresponding to @_tag named "LOG_TAG_<@_tag>",
+# if present/set.
+#
+# @_tag must have previously been enabled w/ rtl_log_enable_tagsV() to be logged at all.
+#
+rtl_log_msgV() {
local _rlm3_tag="${1}" _rlm3_fmt="${2}" \
_rlm3_attr="" _rlm3_date_now=0 _rlm3_exitfl=0
shift 2;
@@ -132,11 +180,8 @@ rtl_log_msg() {
|| rtl_lmatch \$RTLP_LOG_TAGS "${_rlm3_tag}" ",";
then
rtlp_log_msg_get_attr \$_rlm3_attr "${_rlm3_tag}";
- if [ "${_rlm3_attr:+1}" != 1 ]; then
- rtlp_log_printf "" "" "0;==> FIXME TODO XXX UNKNOWN TAG \`${_rlm3_tag}' PASSED TO rtl_log_msg()\n";
- fi;
rtl_date \$_rlm3_date_now;
- rtlp_log_printf "${_rlm3_attr}" "==> ${_rlm3_date_now} " "${_rlm3_fmt}" "${@}";
+ rtlp_log_printfV "${_rlm3_attr}" "==> ${_rlm3_date_now} " "${_rlm3_fmt}" "${@}";
if [ "${_rlm3_exitfl}" -eq 1 ]; then
exit 1;
fi;
@@ -144,11 +189,23 @@ rtl_log_msg() {
return 0;
};
+#
+# rtl_log_set_fname() - set log file pathname
+# @_fname: pathname to new log file
+#
+# Returns: zero (0) on success, non-zero (>0) on failure
+#
rtl_log_set_fname() {
RTLP_LOG_FNAME="${1}";
return 0;
};
+#
+# rtl_log_set_no_attr() - set or clear no ANSI escape sequences in log file flag
+# @_flag: either 0 to set or 1 to clear no ANSI escape sequences in log file flag
+#
+# Returns: zero (0) on success, non-zero (>0) on failure
+#
rtl_log_set_no_attr() {
RTLP_LOG_NO_ATTR="${1}";
return 0;
diff --git a/subr.rtl/rtl_platform.subr b/subr.rtl/rtl_platform.subr
index 35229a98..9bcf0734 100644
--- a/subr.rtl/rtl_platform.subr
+++ b/subr.rtl/rtl_platform.subr
@@ -3,7 +3,14 @@
# set +o errexit -o noglob -o nounset is assumed.
#
-rtl_check_prereqs() {
+#
+# rtl_check_prereqsV() - check for existence of list of commands
+# @_rstatus: out reference to status string
+# @...: commands list as positional parameters
+#
+# Returns: zero (0) on success, non-zero (>0) on failure
+#
+rtl_check_prereqsV() {
local _rcp_rstatus="${1#\$}" \
_rcp_cmd="" _rcp_cmds_missing="" _rcp_rc=0;
shift;
@@ -20,6 +27,12 @@ rtl_check_prereqs() {
return "${_rcp_rc}";
};
+#
+# rtl_clean_env() - unset environment variables w/ exceptions
+# @_env_vars_except: list of environment variables to keep
+#
+# Returns: zero (0) on success, non-zero (>0) on failure
+#
rtl_clean_env() {
local _rce_env_vars_except="${1}" \
_rce_env_var="" _rce_env_vars="" _rce_env_vars_unset="";
@@ -38,6 +51,13 @@ rtl_clean_env() {
return 0;
};
+#
+# rtl_get_cpu_count() - obtain CPU count
+# @_rstatus: out reference to status string
+# @_rcount: out reference to CPU count
+#
+# Returns: zero (0) on success, non-zero (>0) on failure
+#
rtl_get_cpu_count() {
local _rgcc_rstatus="${1#\$}" _rgcc_rcount="${2#\$}" \
_rgcc_line="" _rgcc_ncpus=0 _rgcc_rc=0 _rgcc_sname="";
@@ -66,8 +86,19 @@ rtl_get_cpu_count() {
return "${_rgcc_rc}";
};
+#
+# rtl_get_var_unsafe() - get value of variable
+# @_rvval: out reference to variable value
+# @[-u]: optionally convert variable name to upper case
+# @_vname: variable name
+#
+# Returns: zero (0) on success, non-zero (>0) on failure
+# N.B.: This function is *unsafe* and impossible to implement otherwise w/o filtering @_vname
+# and implicitly allows for code execution and other undefined behaviour via @_vname.
+# Do *not* pass untrusted input through @_vname.
+#
rtl_get_var_unsafe() {
- local _rgvu_rvname_out="${1#\$}" \
+ local _rgvu_rvval="${1#\$}" \
_rgvu_vname="";
shift;
@@ -76,17 +107,33 @@ rtl_get_var_unsafe() {
else
_rgvu_vname="${1}";
fi;
- eval ${_rgvu_rvname_out}="\${${_rgvu_vname}:-}";
+ eval ${_rgvu_rvval}="\${${_rgvu_vname}:-}";
return 0;
};
-rtl_get_vars_fast() {
- local _rgvf_pattern="${1}";
+#
+# rtl_get_vars_unsafe_fast() - get values of multiple variables w/ pattern
+# @_pattern: pattern to match against set output
+#
+# Returns: zero (0) on success, non-zero (>0) on failure, matching variable values on stdout
+# N.B.: This function is *unsafe* and impossible to implement otherwise w/o parsing set
+# output properly and may produce spurious data.
+#
+rtl_get_vars_unsafe_fast() {
+ local _rgvuf_pattern="${1}";
- set | awk -F= '/'"${_rgvf_pattern}"'/{print $1}' | sort;
+ set | awk -F= '/'"${_rgvuf_pattern}"'/{print $1}' | sort;
return 0;
};
+#
+# rtl_kill_tree() - kill tree of processes
+# @_rpids: inout reference to list of PIDs
+# @_pid: top-level PID
+# @_signal: signal(7) to kill with
+#
+# Returns: zero (0) on success, non-zero (>0) on failure
+#
rtl_kill_tree() {
local _rkt_rpids="${1#\$}" _rkt_pid="${2}" _rkt_signal="${3:-TERM}" \
_rkt_pid_child="" _rkt_pids="";
@@ -104,64 +151,64 @@ rtl_kill_tree() {
return 0;
};
-rtl_prompt() {
- local rp_fmt="${1}" rp_choice=""; shift;
-
- printf "${rp_fmt}? (y|N) " "${@}";
- read -r rp_choice;
- case "${rp_choice}" in
- [yY]) rp_choice=1; ;;
- *) rp_choice=0; ;;
- esac;
- return "${rp_choice}";
-};
-
-rtl_rc() {
- local _rr_nflag="${1}" _rr_cmd="${2}";
+#
+# rtl_run_cmdlineV() - run command line w/ field splitting applied
+# @_sep: single non-zero, possibly multi-character, separator
+# @_cmd: command name
+# @...: command arguments as positional parameters
+#
+# Returns: zero (0) on success, non-zero (>0) on failure
+# N.B.: This is required in situations where any of the command arguments 1) are passed from
+# and as a single, expanded parameter (e.g. "${MAKEFLAGS:-}") 2) the value of the parameter
+# contains multiple parameters separated by @_sep that must be passed as separate arguments
+# to @_cmd.
+#
+rtl_run_cmdlineV() {
+ local _rrc_sep="${1}" _rrc_cmd="${2}" \
+ _rrc_cmdline="" _rrc_rc="" IFS;
shift 2;
- case "${_rr_nflag}" in
- 1) if [ "${#}" -gt 0 ]; then
- rtl_log_msg "verbose" "${MSG_rtl_platform_rc1}" "${_rr_cmd}" "${*}";
- else
- rtl_log_msg "verbose" "${MSG_rtl_platform_rc2}" "${_rr_cmd}";
- fi; ;;
- *) "${_rr_cmd}" "${@}"; ;;
- esac;
- return 0;
-};
-
-rtl_run_cmd_unsplit() {
- local _rrcu_cmd="${1}" \
- _rrcu_cmdline="" _rrcu_rc="" IFS;
- shift;
-
while [ ${#} -gt 0 ]; do
[ "${1:+1}" = 1 ] &&\
- _rrcu_cmdline="${_rrcu_cmdline:+${_rrcu_cmdline}:}${1}";
+ _rrc_cmdline="${_rrc_cmdline:+${_rrc_cmdline}${_rrc_sep}}${1}";
shift;
done;
- IFS=:; ${_rrcu_cmd} ${_rrcu_cmdline}; _rrcu_rc=$?;
- return ${_rrcu_rc};
+ IFS="${_rrc_sep}"; ${_rrc_cmd} ${_rrc_cmdline}; _rrc_rc=$?;
+ return ${_rrc_rc};
};
-rtl_set_var_from_cmdline() {
- local _rsvfc_rstatus="${1#\$}" _rsvfc_arg="${2}" \
- _rsvfc_rc=0 _rsvfc_vname="" _rsvfc_vval="";
+#
+# rtl_set_var_from_spec() - set variable from name-value specification
+# @_rstatus: out reference to status string
+# @_arg: variable name-value specification separated by single "=" (e.g. name=value)
+#
+# Returns: zero (0) on success, non-zero (>0) on failure
+#
+rtl_set_var_from_spec() {
+ local _rsvfs_rstatus="${1#\$}" _rsvfs_arg="${2}" \
+ _rsvfs_rc=0 _rsvfs_vname="" _rsvfs_vval="";
- _rsvfc_vname="${_rsvfc_arg%%=*}";
- _rsvfc_vval="${_rsvfc_arg#*=}";
+ _rsvfs_vname="${_rsvfs_arg%%=*}";
+ _rsvfs_vval="${_rsvfs_arg#*=}";
- if [ "${_rsvfc_vval:+1}" != 1 ]; then
- _rsvfc_rc=1;
- rtl_setrstatus "${_rsvfc_rstatus}" 'empty value specified for \${'"${_rsvfc_vname}"'}.';
+ if [ "${_rsvfs_vval:+1}" != 1 ]; then
+ _rsvfs_rc=1;
+ rtl_setrstatus "${_rsvfs_rstatus}" 'empty value specified for \${'"${_rsvfs_vname}"'}.';
else
- rtl_set_var_unsafe "${_rsvfc_vname}" "${_rsvfc_vval}";
+ rtl_set_var_unsafe "${_rsvfs_vname}" "${_rsvfs_vval}";
fi;
- return "${_rsvfc_rc}";
+ return "${_rsvfs_rc}";
};
-rtl_set_vars() {
+#
+# rtl_set_var() - set variable from variables w/ template
+# @_vars_set_vname: list of variable names
+# @_vname_dst: variable name to set
+# @_vname_src_tmpls: variable name template (e.g. "DEFAULT PKG_")
+#
+# Returns: zero (0) on success, non-zero (>0) on failure
+#
+rtl_set_var() {
local _rsv_vars_set_vname="${1}" _rsv_vname_dst="${2}" _rsv_vname_src_tmpls="${3}" \
_rsv_vars_set_old="" _rsv_vars_set_tmp="" _rsv_vname_src="" _rsv_vnames_src="";
diff --git a/subr.rtl/rtl_state.subr b/subr.rtl/rtl_state.subr
index d5cd8b1e..3deec599 100644
--- a/subr.rtl/rtl_state.subr
+++ b/subr.rtl/rtl_state.subr
@@ -3,52 +3,83 @@
# set +o errexit -o noglob -o nounset is assumed.
#
+#
+# rtl_state_clear() - clear state for item
+# @_workdir: pathname to directory containing state files
+# @_item_name: name of item to clear state for
+#
+# Returns: zero (0) on success, non-zero (>0) on failure
+#
rtl_state_clear() {
- local _rsc_workdir="${1}" _rsc_pkg_name="${2}" \
- _rsc_pkg_fname="";
+ local _rsc_workdir="${1}" _rsc_item_name="${2}" \
+ _rsc_item_fname="";
- for _rsc_pkg_fname in $(
+ for _rsc_item_fname in $(
find "${_rsc_workdir}" \
-maxdepth 1 \
-mindepth 1 \
- -name .${_rsc_pkg_name}.\* \
+ -name .${_rsc_item_name}.\* \
-type f);
do
- rtl_fileop rm "${_rsc_pkg_fname}";
+ rtl_fileop rm "${_rsc_item_fname}";
done;
return 0;
};
+#
+# rtl_state_set() - set state for item
+# @_workdir: pathname to directory containing state files
+# @_item_name: name of item to set state for
+# @_state: state to set
+#
+# Returns: zero (0) on success, non-zero (>0) on failure
+#
rtl_state_set() {
- local _rss_workdir="${1}" _rss_pkg_fname="${2}" _rss_build_step="${3}" \
- _rss_done_fname_pfx="${1}/.${2}";
+ local _rss_workdir="${1}" _rss_item_name="${2}" _rss_state="${3}" \
+ _rss_done_name_pfx="${1}/.${2}";
shift 3;
- rtl_fileop touch "${_rss_done_fname_pfx}.${_rss_build_step}";
+ rtl_fileop touch "${_rss_done_name_pfx}.${_rss_state}";
while [ ${#} -ge 1 ]; do
if [ "${#1}" -gt 0 ]; then
- rtl_fileop rm "${_rss_done_fname_pfx}.${1}";
+ rtl_fileop rm "${_rss_done_name_pfx}.${1}";
fi; shift;
done;
return 0;
};
+#
+# rtl_state_test() - test state(s) for item
+# @_workdir: pathname to directory containing state files
+# @_item_name: name of item to set state for
+# @_states: state(s) to test for
+# @[_lforce]: one of "ALL" (force all states to test as set,) "LAST" or "" (test all states,)
+# or exclusive list of states to force to test as set
+#
+# Returns: zero (0) if any of state(s) set, non-zero (>0) if none of state(s) set
+#
rtl_state_test() {
- local _rst_workdir="${1}" _rst_pkg_name="${2}" _rst_build_steps="${3}" \
- _rst_restart_at="${4:-}" _rst_build_step="" _rst_done_fname="" \
- IFS="," _rst_rc=0;
-
- for _rst_build_step in ${_rst_build_steps}; do
- _rst_done_fname="${_rst_workdir}/.${_rst_pkg_name}.${_rst_build_step}";
- if [ "${_rst_restart_at:+1}" != 1 ]\
- || [ "${_rst_restart_at}" = "LAST" ]; then
- rtl_fileop test "${_rst_done_fname}"; _rst_rc="${?}";
- elif [ "${_rst_restart_at}" = "ALL" ]; then
- _rst_rc=1;
- else
- rtl_lmatch \$_rst_restart_at "${_rst_build_step}" ",";
+ local _rst_workdir="${1}" _rst_item_name="${2}" \
+ _rst_states="${3}" _rst_lforce="${4:-}" \
+ _rst_state="" _rst_done_fname="" IFS="," _rst_rc=0;
+
+ for _rst_state in ${_rst_states}; do
+ _rst_done_fname="${_rst_workdir}/.${_rst_item_name}.${_rst_state}";
+
+ case "${_rst_lforce}" in
+ ALL)
+ _rst_rc=1; ;;
+ ""|LAST)
+ rtl_fileop test "${_rst_done_fname}"; _rst_rc="${?}"; ;;
+ *)
+ rtl_lmatch \$_rst_lforce "${_rst_state}" ",";
_rst_rc=$((${?} ? 0 : 1));
- fi; [ "${_rst_rc}" -eq 0 ] && break;
+ ;;
+ esac;
+
+ if [ "${_rst_rc}" -eq 0 ]; then
+ break;
+ fi;
done;
return "${_rst_rc}";
};
diff --git a/vars/texinfo.vars b/vars/texinfo.vars
index a23f8642..38b20cf7 100644
--- a/vars/texinfo.vars
+++ b/vars/texinfo.vars
@@ -3,17 +3,19 @@
#
pkg_texinfo_build_pre() {
- if ! rtl_run_cmd_unsplit make \
- ${PKG_MAKEFLAGS_BUILD:-} \
- ${PKG_MAKEFLAGS_BUILD_EXTRA:-} \
- ${PKG_LIBTOOL:+"LIBTOOL=${PKG_LIBTOOL}"} \
- -C tools \
- || ! rtl_run_cmd_unsplit make \
- ${PKG_MAKEFLAGS_BUILD:-} \
- ${PKG_MAKEFLAGS_BUILD_EXTRA:-} \
- ${PKG_LIBTOOL:+"LIBTOOL=${PKG_LIBTOOL}"} \
- LDFLAGS="-L${PREFIX}/lib -Wl,-rpath,${PREFIX}/lib" LIBS="-ltinfo" \
- -C "tools/info"; then
+ if ! rtl_run_cmdlineV ":" "${PKG_MAKE}" \
+ ${PKG_MAKEFLAGS_BUILD:-} \
+ ${PKG_MAKEFLAGS_BUILD_EXTRA:-} \
+ ${PKG_LIBTOOL:+"LIBTOOL=${PKG_LIBTOOL}"} \
+ -C tools \
+ || ! rtl_run_cmdlineV ":" "${PKG_MAKE}" \
+ ${PKG_MAKEFLAGS_BUILD:-} \
+ ${PKG_MAKEFLAGS_BUILD_EXTRA:-} \
+ ${PKG_LIBTOOL:+"LIBTOOL=${PKG_LIBTOOL}"} \
+ LDFLAGS="-L${PREFIX}/lib -Wl,-rpath,${PREFIX}/lib" \
+ LIBS="-ltinfo" \
+ -C "tools/info";
+ then
return 1;
fi;
};