summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--dist/dist_gitref.dist2
-rw-r--r--dist/dist_minipix.dist2
-rw-r--r--dist/dist_zipdist.dist10
-rw-r--r--subr.ex/ex_pkg_dispatch.subr19
-rw-r--r--subr.ex/ex_pkg_exec.subr6
-rw-r--r--vars/gcc.vars2
6 files changed, 30 insertions, 11 deletions
diff --git a/dist/dist_gitref.dist b/dist/dist_gitref.dist
index 5a671dc1..e1f2152c 100644
--- a/dist/dist_gitref.dist
+++ b/dist/dist_gitref.dist
@@ -9,7 +9,7 @@ pkg_dist_gitref_all() {
(rtl_fileop cd "${MIDIPIX_BUILD_PWD}" &&\
git rev-parse HEAD > "${PREFIX}/build.gitref");
if [ "${?}" -eq 0 ]; then
- printf "step ${_pdga_group_name} ${_pdga_pkg_name} finish\n" >&3;
+ ex_pkg_dispatch_send "step" "${_pdga_group_name}" "${_pdga_pkg_name}" "finish";
ex_pkg_state_set "${_pdga_pkg_name}" "finish";
return 0;
else
diff --git a/dist/dist_minipix.dist b/dist/dist_minipix.dist
index 8f6d2024..843e1b4f 100644
--- a/dist/dist_minipix.dist
+++ b/dist/dist_minipix.dist
@@ -94,7 +94,7 @@ pkg_dist_minipix_all() {
return 1;
fi;
- printf "step ${_pdma_group_name} ${_pdma_pkg_name} finish\n" >&3;
+ ex_pkg_dispatch_msg "step" "${_pdma_group_name}" "${_pdma_pkg_name}" "finish";
ex_pkg_state_set "${_pdma_pkg_name}" "finish";
return 0;
diff --git a/dist/dist_zipdist.dist b/dist/dist_zipdist.dist
index 3eb249aa..505fcac6 100644
--- a/dist/dist_zipdist.dist
+++ b/dist/dist_zipdist.dist
@@ -11,7 +11,7 @@ pkg_dist_zipdist_all() {
return 0;
fi;
- echo "msg_pkg dist dist_zipdist ${MSG_zipdist_begin}" >&3;
+ ex_pkg_dispatch_send "msg_pkg" "dist" "dist_zipdist" "${MSG_zipdist_begin}";
rtl_log_msg "zipdist" "${MSG_zipdist_begin}";
for _pdza_pkg_name in $(cat "${_pdza_pkglist_fname}"); do
@@ -43,14 +43,14 @@ pkg_dist_zipdist_all() {
return 1;
fi;
- echo "msg_pkg dist dist_zipdist ${MSG_zipdist_finished}" >&3;
+ ex_pkg_dispatch_send "msg_pkg" "dist" "dist_zipdist" "${MSG_zipdist_finished}";
rtl_log_msg "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
- echo "msg_pkg dist dist_zipdist ${MSG_zipdist_signing}" >&3;
+ ex_pkg_dispatch_send "msg_pkg" "dist" "dist_zipdist" "${MSG_zipdist_signing}";
rtl_log_msg "zipdist" "${MSG_zipdist_signing}";
if ! gpg --armor --passphrase-file /dev/null \
@@ -59,11 +59,11 @@ pkg_dist_zipdist_all() {
return 1;
fi;
- echo "msg_pkg dist dist_zipdist ${MSG_zipdist_signed}" >&3;
+ ex_pkg_dispatch_send "msg_pkg" "dist" "dist_zipdist" "${MSG_zipdist_signed}";
rtl_log_msg "zipdist" "${MSG_zipdist_signed}";
fi;
- printf "step ${_pdza_group_name} ${_pdza_pkg_name} finish\n" >&3;
+ ex_pkg_dispatch_send "step" "${_pdza_group_name}" "${_pdza_pkg_name}" "finish";
ex_pkg_state_set "${_pdza_pkg_name}" "finish";
return 0;
diff --git a/subr.ex/ex_pkg_dispatch.subr b/subr.ex/ex_pkg_dispatch.subr
index 1274aa64..217bd360 100644
--- a/subr.ex/ex_pkg_dispatch.subr
+++ b/subr.ex/ex_pkg_dispatch.subr
@@ -380,4 +380,23 @@ ex_pkg_dispatch() {
return "${_epd_rc}";
};
+#
+# ex_pkg_dipatch_send() - send message from dispatcher child process to dispatcher parent process across FIFO
+# @_op: message operation string
+#
+# Return: zero (0) invariably.
+#
+ex_pkg_dispatch_send() {
+ local _epds_op="${1}";
+ shift 1;
+
+ trap '' PIPE;
+ while ! printf "%s%s\n" "${_epds_op}" "${*:+ "${*}"}" 1>&3 2>/dev/null; do
+ :;
+ done;
+ trap - PIPE;
+
+ return 0;
+};
+
# vim:filetype=sh textwidth=0
diff --git a/subr.ex/ex_pkg_exec.subr b/subr.ex/ex_pkg_exec.subr
index 6b35cff9..568266e7 100644
--- a/subr.ex/ex_pkg_exec.subr
+++ b/subr.ex/ex_pkg_exec.subr
@@ -139,7 +139,7 @@ exp_pkg_exec() {
"${_eppe_restart_at}" "${_eppe_step}";
then
_eppe_rc=1; break;
- else printf "step %s %s %s\n" "${_eppe_group_name}" "${_eppe_pkg_name}" "${_eppe_step}" >&3;
+ else ex_pkg_dispatch_send "step" "${_eppe_group_name}" "${_eppe_pkg_name}" "${_eppe_step}";
ex_pkg_state_set2 "${_eppe_workdir}" "${_eppe_pkg_name}" "${_eppe_step}" "${@}";
fi;
done;
@@ -192,9 +192,9 @@ ex_pkg_exec() {
rtl_lconcat "${_epdp_rdispatch_wait}" "${_epdp_pkg_name}";
(trap "if [ \${?} -eq 0 ]; then \
- printf \"done %s %s %d\n\" \"${_epdp_group_name}\" \"${_epdp_pkg_name}\" \"${_epdp_dispatch_count_new}\" >&3; \
+ ex_pkg_dispatch_send \"done\" \"${_epdp_group_name}\" \"${_epdp_pkg_name}\" \"${_epdp_dispatch_count_new}\"; \
else \
- printf \"fail %s %s %d\n\" \"${_epdp_group_name}\" \"${_epdp_pkg_name}\" \"${_epdp_dispatch_count_new}\" >&3; \
+ ex_pkg_dispatch_send \"fail\" \"${_epdp_group_name}\" \"${_epdp_pkg_name}\" \"${_epdp_dispatch_count_new}\"; \
pkill -U "${$}"; \
fi;" EXIT HUP INT TERM USR1 USR2;
set +o errexit -o noglob -o nounset; BUILD_IS_PARENT=0; rtl_log_set_fname ""; rtl_log_set_no_attr 1;
diff --git a/vars/gcc.vars b/vars/gcc.vars
index fa87f862..8a26fcea 100644
--- a/vars/gcc.vars
+++ b/vars/gcc.vars
@@ -10,7 +10,7 @@
pkgp_gcc_build_dir() { PKG_BUILD_DIR="${1}-${2}-${PKG_TARGET}"; return 0; };
pkgp_gcc_state_set() {
- printf "step unknown %s %s\n" "${PKG_NAME}" "${1}" >&3;
+ ex_pkg_dispatch_msg "step" "unknown" "${PKG_NAME}" "${1}";
ex_pkg_state_set "${PKG_NAME}" "${1}" ${2:+"${2}"};
return 0;
};