|
lalbornoz |
340f4c |
#!/bin/sh
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
a39ccb |
# Copyright (c) 2016, 2017 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
1d0876 |
#
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
090fd4 |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f6a5cb |
for __ in $(find subr -name *.subr); do . "${__}"; done;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
fc9417 |
ex_setup_args "${@}"; ex_setup_env; ex_setup_checks; ex_setup_subdirs; ex_pkg_state_init;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
ex_log_msg info "Build started by ${BUILD_USER:=${USER}}@${BUILD_HNAME:=$(hostname)} at ${BUILD_DATE_START}.";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
ex_log_env_vars "build (global)" ${LOG_ENV_VARS};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
fc9417 |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
for BUILD_TARGET_META in invariants ${BUILD_TARGETS_META:-world}; do
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
for BUILD_TARGET_LC in $(ex_get_var_unsafe "$(ex_toupper "${BUILD_TARGET_META}")_TARGET"); do
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
BUILD_TARGET="$(ex_toupper "${BUILD_TARGET_LC}")";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
BUILD_PACKAGES="$(ex_get_var_unsafe ${BUILD_TARGET}_PACKAGES)";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
if [ "${BUILD_TARGET}" != "INVARIANTS" ]\
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
&& [ -n "${BUILD_PACKAGES_RESTART}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
BUILD_PACKAGES="$(ex_lfilter "${BUILD_PACKAGES}" "${BUILD_PACKAGES_RESTART}")";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
9bed93 |
ex_log_msg info "Starting \`${BUILD_TARGET_LC}' build target...";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
for PKG_NAME in ${BUILD_PACKAGES}; do
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
3961f3 |
ex_log_msg info "Starting \`${PKG_NAME}' build...";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
ex_pkg_dispatch "${BUILD_TARGET}" "${PKG_NAME}" \
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
"${ARG_RESTART}" "${ARG_RESTART_AT}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
BUILD_SCRIPT_RC=${?};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
case ${BUILD_SCRIPT_RC} in
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
3961f3 |
0) : $((BUILD_NFINI+=1));
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
3961f3 |
if [ "${ARG_VERBOSE2:-0}" -eq 1 ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
3961f3 |
cat "${WORKDIR}/${PKG_NAME}_stdout.log";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
4b2ce1 |
if [ "${ARG_XTRACE:-0}" -eq 1 ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
4b2ce1 |
ex_log_msg vvfo "${WORKDIR}/${PKG_NAME}_stderr.log:";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
4b2ce1 |
cat "${WORKDIR}/${PKG_NAME}_stderr.log";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
4b2ce1 |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
3961f3 |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
3961f3 |
ex_log_msg succ "Finished \`${PKG_NAME}' build."; ;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
3961f3 |
*) : $((BUILD_NFAIL+=1));
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
3961f3 |
if [ "${ARG_RELAXED:-0}" -eq 1 ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
3961f3 |
ex_log_msg fail "Build failed in \`${PKG_NAME}', check \`${WORKDIR}/${PKG_NAME}_std{err,out}.log' for details.";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
648b81 |
BUILD_PKGS_FAILED="${BUILD_PKGS_FAILED:+${BUILD_PKGS_FAILED} }${PKG_NAME}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
fc9417 |
continue;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
fc9417 |
else
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
3961f3 |
ex_log_msg fail "${WORKDIR}/${PKG_NAME}_stdout.log:";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
3961f3 |
cat "${WORKDIR}/${PKG_NAME}_stdout.log";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
3961f3 |
ex_log_msg fail "${WORKDIR}/${PKG_NAME}_stderr.log:";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
3961f3 |
cat "${WORKDIR}/${PKG_NAME}_stderr.log";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
3961f3 |
ex_log_msg fail "Build failed in \`${PKG_NAME}'.";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
fc9417 |
break;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
fc9417 |
fi; ;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
esac;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
done;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
if [ "${BUILD_SCRIPT_RC:-0}" -ne 0 ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
break;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
9bed93 |
else
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
9bed93 |
ex_log_msg succ "Finished \`${BUILD_TARGET_LC}' build target.";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
fi;
|
|
lalbornoz |
340f4c |
done;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
fc9417 |
done;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
fc9417 |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
fc9417 |
ex_pkg_state_fini;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
ex_log_msg info "${BUILD_NFINI} finished, ${BUILD_NSKIP} skipped, and ${BUILD_NFAIL} failed builds in ${BUILD_NBUILT} build script(s).";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
ex_log_msg info "Build time: ${BUILD_TIMES_HOURS} hour(s), ${BUILD_TIMES_MINUTES} minute(s), and ${BUILD_TIMES_SECS} second(s).";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ceeb88 |
if [ ${ARG_RELAXED:-0} -eq 1 ]\
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ceeb88 |
&& [ -n "${BUILD_PKGS_FAILED}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
ex_log_msg info "Build script failure(s) in: ${BUILD_PKGS_FAILED}.";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ceeb88 |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
fc9417 |
exit "${BUILD_SCRIPT_RC:-0}"
|
|
lalbornoz |
340f4c |
|
|
lalbornoz |
340f4c |
# vim:filetype=sh
|