summaryrefslogtreecommitdiffhomepage
path: root/build.sh
diff options
context:
space:
mode:
authorLucio Andrés Illanes Albornoz (arab, vxp) <lucio@lucioillanes.de>2017-11-22 16:00:55 +0000
committerLucio Andrés Illanes Albornoz (arab, vxp) <lucio@lucioillanes.de>2017-11-22 18:06:58 +0000
commitfc9417f077a909539495531229f9035c15fe10f0 (patch)
tree30195a268ceb7d5a6bb5a1c6167385bbbf68e58d /build.sh
parent14c984b00aece1050b63288fe5856854ebcbb352 (diff)
downloadmidipix_build-fc9417f077a909539495531229f9035c15fe10f0.tar.bz2
midipix_build-fc9417f077a909539495531229f9035c15fe10f0.tar.xz
build.sh, subr/ex_pkg_dispatch.subr: splits build logging and job control logic.
subr/ex_pkg_dispatch.subr: dispatch background jobs w/ redirected std{err,out} & FIFO. subr/ex_pkg_state.subr:ex_pkg_state_init(): trap(1) signals to abort build. vars/{gcc,musl}.vars: don't exit(1) from within package subroutine.
Diffstat (limited to 'build.sh')
-rwxr-xr-xbuild.sh34
1 files changed, 16 insertions, 18 deletions
diff --git a/build.sh b/build.sh
index c54400ac..a834a929 100755
--- a/build.sh
+++ b/build.sh
@@ -3,10 +3,10 @@
#
for __ in $(find subr -name *.subr); do . "${__}"; done;
-ex_setup_args "${@}"; ex_setup_env; ex_setup_checks; ex_setup_subdirs;
-ex_pkg_state_init; {(
+ex_setup_args "${@}"; ex_setup_env; ex_setup_checks; ex_setup_subdirs; ex_pkg_state_init;
ex_log_msg info "Build started by ${BUILD_USER:=${USER}}@${BUILD_HNAME:=$(hostname)} at ${BUILD_DATE_START}.";
ex_log_env_vars "build (global)" ${LOG_ENV_VARS};
+
for BUILD_TARGET_META in invariants ${BUILD_TARGETS_META:-world}; do
for BUILD_TARGET_LC in $(ex_get_var_unsafe "$(ex_toupper "${BUILD_TARGET_META}")_TARGET"); do
BUILD_TARGET="$(ex_toupper "${BUILD_TARGET_LC}")";
@@ -16,38 +16,36 @@ for BUILD_TARGET_META in invariants ${BUILD_TARGETS_META:-world}; do
BUILD_PACKAGES="$(ex_lfilter "${BUILD_PACKAGES}" "${BUILD_PACKAGES_RESTART}")";
fi;
for PKG_NAME in ${BUILD_PACKAGES}; do
+ ex_log_msg vnfo "Starting \`${PKG_NAME}' build...";
ex_pkg_dispatch "${BUILD_TARGET}" "${PKG_NAME}" \
"${ARG_RESTART}" "${ARG_RESTART_AT}";
BUILD_SCRIPT_RC=${?};
case ${BUILD_SCRIPT_RC} in
0) ex_log_msg succ "Finished \`${PKG_NAME}' build.";
- : $((BUILD_NFINI+=1)); continue; ;;
- *) ex_log_msg fail "Build failed in \`${PKG_NAME}' (last return code ${BUILD_SCRIPT_RC}.).";
- : $((BUILD_NFAIL+=1));
- if [ ${ARG_RELAXED:-0} -eq 1 ]; then
- BUILD_PKGS_FAILED="${BUILD_PKGS_FAILED:+${BUILD_PKGS_FAILED} }${PKG_NAME}";
- continue;
- else
- break;
- fi;
+ : $((BUILD_NFINI+=1)); continue; ;;
+ *) ex_log_msg fail "Build failed in \`${PKG_NAME}', check \`${WORKDIR}/${PKG_NAME}_std{err,out}.log' for details.";
+ : $((BUILD_NFAIL+=1));
+ if [ ${ARG_RELAXED:-0} -eq 1 ]; then
+ BUILD_PKGS_FAILED="${BUILD_PKGS_FAILED:+${BUILD_PKGS_FAILED} }${PKG_NAME}";
+ continue;
+ else
+ break;
+ fi; ;;
esac;
done;
if [ "${BUILD_SCRIPT_RC:-0}" -ne 0 ]; then
break;
fi;
done;
-done; ex_pkg_state_fini;
+done;
+
+ex_pkg_state_fini;
ex_log_msg info "${BUILD_NFINI} finished, ${BUILD_NSKIP} skipped, and ${BUILD_NFAIL} failed builds in ${BUILD_NBUILT} build script(s).";
ex_log_msg info "Build time: ${BUILD_TIMES_HOURS} hour(s), ${BUILD_TIMES_MINUTES} minute(s), and ${BUILD_TIMES_SECS} second(s).";
if [ ${ARG_RELAXED:-0} -eq 1 ]\
&& [ -n "${BUILD_PKGS_FAILED}" ]; then
ex_log_msg info "Build script failure(s) in: ${BUILD_PKGS_FAILED}.";
fi;
-exit "${BUILD_SCRIPT_RC:-0}")} 2>&1 | tee "${BUILD_LOG_FNAME}" & TEE_PID="${!}";
-
-trap "rm -f ${BUILD_STATUS_IN_PROGRESS_FNAME}; \
- ex_log_msg fail \"Build aborted.\"; \
- echo kill ${TEE_PID}; \
- kill ${TEE_PID}" HUP INT TERM USR1 USR2; wait;
+exit "${BUILD_SCRIPT_RC:-0}"
# vim:filetype=sh