From 8a27f992e5b7c62e144dbbfc3435a90c470d92a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucio=20Andr=C3=A9s=20Illanes=20Albornoz?= Date: Wed, 11 Mar 2020 16:09:22 +0000 Subject: 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. --- subr/ex_pkg_exec.subr | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'subr/ex_pkg_exec.subr') diff --git a/subr/ex_pkg_exec.subr b/subr/ex_pkg_exec.subr index 9e4629ba..f21bc3d8 100644 --- a/subr/ex_pkg_exec.subr +++ b/subr/ex_pkg_exec.subr @@ -2,6 +2,21 @@ # set +o errexit -o noglob is assumed. # +exp_pkg_exec_filter_vars_fn() { + local _vname="${1}"; + case "${_vname}" in + DEFAULT|PKG_*) + return 0; ;; + BUILD_DLCACHEDIR|BUILD_WORKDIR|MIDIPIX_BUILD_PWD) + return 0; ;; + CONFIG_CACHE_GNULIB) + return 0; ;; + PREFIX|PREFIX_CROSS|PREFIX_MINGW32|PREFIX_MINIPIX|PREFIX_NATIVE|PREFIX_RPM) + return 0; ;; + *) return 1; ;; + esac; +}; + # # exp_pkg_exec_pre() - XXX # @_group_name: build group name @@ -102,6 +117,11 @@ ex_pkg_exec() { || [ "${_restart_at}" = "ALL" ]; then ex_pkg_state_set "${_pkg_name}" finish; fi; + elif [ "${_rc:-0}" -ne 0 ]\ + && [ "${ARG_DUMP_ON_ABORT:-0}" -eq 1 ]; then + printf "" > "${BUILD_WORKDIR}/${_pkg_name}.dump"; + rtl_filter_vars exp_pkg_exec_filter_vars_fn >> "${BUILD_WORKDIR}/${_pkg_name}.dump"; + export >> "${BUILD_WORKDIR}/${_pkg_name}.dump"; fi; fi; return "${_rc}"; -- cgit v1.2.3