|
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) |
f6a5cb |
pre_setup_args "${@}"; pre_setup_env; pre_check; pre_subdirs;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f6a5cb |
build_files_init; {(
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
c27bea |
log_msg info "Build started by ${BUILD_USER:=${USER}}@${BUILD_HNAME:=$(hostname)} at ${BUILD_DATE_START}.";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
c27bea |
log_env_vars "build (global)" ${LOG_ENV_VARS};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
for BUILD_TARGET_LC in $(subst_tgts invariants ${BUILD_TARGETS_META:-world}); do
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
49b460 |
BUILD_TARGET="$(toupper "${BUILD_TARGET_LC}")";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
1fb552 |
BUILD_PACKAGES="$(get_var_unsafe ${BUILD_TARGET}_PACKAGES)";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
if [ "${BUILD_TARGET}" != "INVARIANTS" ]\
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
&& [ -n "${BUILD_PACKAGES_RESTART}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
BUILD_PACKAGES="$(lfilter "${BUILD_PACKAGES}" "${BUILD_PACKAGES_RESTART}")";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
802215 |
for PKG_NAME in ${BUILD_PACKAGES}; do
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
3e19f0 |
pkg_setup_dispatch "${BUILD_TARGET}" "${PKG_NAME}" \
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
3e19f0 |
"${ARG_RESTART}" "${ARG_RESTART_AT}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
3e19f0 |
BUILD_SCRIPT_RC=${?};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
3e19f0 |
case ${BUILD_SCRIPT_RC} in
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
802215 |
0) log_msg succ "Finished \`${PKG_NAME}' build.";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
59765f |
: $((BUILD_NFINI+=1)); continue; ;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
802215 |
*) log_msg fail "Build failed in \`${PKG_NAME}' (last return code ${BUILD_SCRIPT_RC}.).";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
a0f521 |
: $((BUILD_NFAIL+=1));
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ceeb88 |
if [ ${ARG_RELAXED:-0} -eq 1 ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ceeb88 |
BUILD_PKGS_FAILED="${BUILD_PKGS_FAILED:+${BUILD_PKGS_FAILED} }${PKG_NAME}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ceeb88 |
continue;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ceeb88 |
else
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ceeb88 |
break;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ceeb88 |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
59765f |
esac;
|
|
lalbornoz |
340f4c |
done;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
1fb552 |
if [ "${BUILD_SCRIPT_RC:-0}" -ne 0 ]; then
|
|
lalbornoz |
340f4c |
break;
|
|
lalbornoz |
340f4c |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f6a5cb |
done; build_files_fini;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
96b309 |
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) |
820be1 |
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) |
ceeb88 |
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) |
49b460 |
exit "${BUILD_SCRIPT_RC:-0}")} 2>&1 | tee "${BUILD_LOG_FNAME}" & TEE_PID="${!}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f6a5cb |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
e2a4f2 |
trap "rm -f ${BUILD_STATUS_IN_PROGRESS_FNAME}; \
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
e2a4f2 |
log_msg fail \"Build aborted.\"; \
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
e2a4f2 |
echo kill ${TEE_PID}; \
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
f6a5cb |
kill ${TEE_PID}" HUP INT TERM USR1 USR2; wait;
|
|
lalbornoz |
340f4c |
|
|
lalbornoz |
340f4c |
# vim:filetype=sh
|