summaryrefslogtreecommitdiffhomepage
path: root/build.sh
diff options
context:
space:
mode:
authorLucio Andrés Illanes Albornoz <lucio@lucioillanes.de>2020-03-11 16:09:22 +0000
committerLucio Andrés Illanes Albornoz <lucio@lucioillanes.de>2020-03-11 16:09:22 +0000
commit8a27f992e5b7c62e144dbbfc3435a90c470d92a4 (patch)
tree52aa6aabc1ab3c79a0475bed758828d316180377 /build.sh
parentfca18e9d6857d335027d012d462f61ac648ef93a (diff)
downloadmidipix_build-8a27f992e5b7c62e144dbbfc3435a90c470d92a4.tar.bz2
midipix_build-8a27f992e5b7c62e144dbbfc3435a90c470d92a4.tar.xz
Initial implementation of pkgtool.sh.
build.sh:build(): move cd(1) to $(dirname "${0}"). etc/{build.usage,README.md}: updated. midipix.env:${DEFAULT_CLEAR_ENV_VARS_EXCEPT}: allow inheriting ARCH, BUILD, BUILD_DLCACHEDIR, BUILD_WORKDIR, and PREFIX* from the environment. pkgtool.sh: initial implementation. subr/build_init.subr:buildp_init_defaults(): allow inheriting ARCH, BUILD, BUILD_DLCACHEDIR, BUILD_WORKDIR, and PREFIX* from the environment. subr/build_init.subr:buildp_init_env(): move cd(1) to $(dirname "${0}"). subr/build_init.subr:buildp_init_files(): correctly pass ${_status} from rtl_check_path_vars(). subr/ex_pkg_exec.subr:ex_pkg_exec(): dump subset of variables and exported variables on build failure and --dump-on-abort. subr/pkgtool_init.subr: adapted from subr/build_init.subr. subr/rtl_complex.subr:rtl_filter_vars(): initial implementation. subr/rtl_string.subr:rtl_subst(): initial implementation.
Diffstat (limited to 'build.sh')
-rwxr-xr-xbuild.sh18
1 files changed, 14 insertions, 4 deletions
diff --git a/build.sh b/build.sh
index 51c2a23b..72883c13 100755
--- a/build.sh
+++ b/build.sh
@@ -35,12 +35,20 @@ buildp_dispatch_fail_pkg() {
: $((BUILD_NFAIL+=1)); BUILD_PKGS_FAILED="$(rtl_lconcat "${BUILD_PKGS_FAILED}" "${_pkg_name}")";
if [ "${ARG_RELAXED:-0}" -eq 1 ]; then
rtl_log_msg fail "$(printf "Build failed in \`%s', check \`%s' for details." "${_pkg_name}" "${BUILD_WORKDIR}/${_pkg_name}_stderrout.log")";
+ if [ "${ARG_DUMP_ON_ABORT:-0}" -eq 1 ]; then
+ rtl_log_msg vnfo "Logged environment dump for failed package \`${_pkg_name}' to \`${BUILD_WORKDIR}/${_pkg_name}.dump'.";
+ fi;
else rtl_log_msg fail "${BUILD_WORKDIR}/${_pkg_name}_stderrout.log:";
cat "${BUILD_WORKDIR}/${_pkg_name}_stderrout.log";
if [ -n "${DEFAULT_BUILD_LAST_FAILED_PKG_FNAME}" ]; then
printf "%s" "${_pkg_name}" > "${DEFAULT_BUILD_LAST_FAILED_PKG_FNAME}";
fi;
- rtl_log_msg failexit "$(printf "Build failed in \`%s'." "${_pkg_name}")";
+ rtl_log_msg fail "$(printf "Build failed in \`%s', check \`%s' for details." "${_pkg_name}" "${BUILD_WORKDIR}/${_pkg_name}_stderrout.log")";
+ if [ "${ARG_DUMP_ON_ABORT:-0}" -eq 1 ]; then
+ rtl_log_msg vnfo "Logged environment dump for failed package \`${_pkg_name}' to \`${BUILD_WORKDIR}/${_pkg_name}.dump'.";
+ rtl_log_msg vnfo "Enter an interactive package build shell w/ the command line: ./pkgtool.sh -a ${ARCH} -b ${BUILD} ${_pkg_name} PREFIX=\"${PREFIX}\"";
+ fi;
+ exit 1;
fi;
};
@@ -94,9 +102,11 @@ build() {
local _build_time_hours=0 _build_time_mins=0 _build_time_secs=0 _pkg_name="" \
BUILD_DATE_START="" BUILD_NFAIL=0 BUILD_NFINI=0 BUILD_NSKIP=0 \
BUILD_PKGS_FAILED="" EX_PKG_DISPATCH_UNKNOWN="";
- if trap "buildp_ast abort" HUP INT TERM USR1 USR2\
- && trap "buildp_ast exit" EXIT\
- && . ./subr/build_init.subr && build_init "${@}"; then
+ if ! cd "$(dirname "${0}")"; then
+ printf "Error: failed to setup environment.\n"; exit 1;
+ elif trap "buildp_ast abort" HUP INT TERM USR1 USR2\
+ && trap "buildp_ast exit" EXIT\
+ && . ./subr/build_init.subr && build_init "${@}"; then
BUILD_DATE_START="$(rtl_date %Y-%m-%d-%H-%M-%S)"; _build_time_secs="$(rtl_date %s)";
rtl_log_msg info "Build started by ${BUILD_USER:=${USER}}@${BUILD_HNAME:=$(hostname)} at ${BUILD_DATE_START}.";
rtl_log_env_vars "build (global)" ${DEFAULT_LOG_ENV_VARS};