blob: f099dd6a2ca823118543378c2af41df43c0d7c78 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#
# set -o errexit -o noglob are assumed.
#
ex_pkg_dispatch() {
local _tgt_name="${1}" _pkg_name="${2}" \
_restart="${3}" _restart_at="${4}" \
_stdout_path _stderr_path \
_pipe_path _pipe_msg _script_rc=1;
if ex_pkg_state_test "${_pkg_name}" finish \
&& [ -z "${_restart}" ] \
&& [ "${_tgt_name}" != "INVARIANTS" ]; then
return 0;
else
_pipe_path="${WORKDIR}/${_pkg_name}_build.fifo";
ex_build_fileop rm "${_pipe_path}"; mkfifo "${_pipe_path}";
_stderr_path="${WORKDIR}/${_pkg_name}_stderr.log";
_stdout_path="${WORKDIR}/${_pkg_name}_stdout.log";
ex_build_fileop rm "${_stderr_path}" "${_stdout_path}";
fi;
(set -o errexit -o noglob;
trap "if [ \${?} -eq 0 ]; then \
echo \"done ${PKG_NAME}\" >&3; \
else \
echo \"fail ${PKG_NAME}\" >&3; \
fi;" EXIT HUP INT TERM USR1 USR2;
if [ "${ARG_XTRACE:-0}" -eq 1 ]; then
set -o xtrace;
fi;
ex_pkg_vars;
if [ "${PKG_DISABLED:-0}" -eq 1 ]; then
ex_log_msg vnfo "Skipping disabled package \`${PKG_NAME}.'";
else
ex_pkg_env;
ex_pkg_steps "${_tgt_name}" "${_pkg_name}" \
"${_restart}" "${_restart_at}";
fi;) 1>"${_stdout_path}" 2>"${_stderr_path}" \
3>"${_pipe_path}" &
while read _pipe_msg; do
case "${_pipe_msg%% *}" in
done) _script_rc=0; break; ;;
fail) _script_rc=1; break; ;;
*) _script_rc=1; break; ;;
esac; done <"${_pipe_path}";
ex_build_fileop rm "${_pipe_path}";
return "${_script_rc:-1}";
};
# vim:filetype=sh
|