summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xbuild.sh6
-rwxr-xr-xpkgtool.sh29
-rw-r--r--subr/build_init.subr15
-rw-r--r--subr/ex_pkg_exec.subr7
4 files changed, 45 insertions, 12 deletions
diff --git a/build.sh b/build.sh
index 72883c13..d2d41756 100755
--- a/build.sh
+++ b/build.sh
@@ -36,7 +36,7 @@ buildp_dispatch_fail_pkg() {
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'.";
+ rtl_log_msg info "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";
@@ -45,8 +45,8 @@ buildp_dispatch_fail_pkg() {
fi;
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}\"";
+ rtl_log_msg info "Logged environment dump for failed package \`${_pkg_name}' to \`${BUILD_WORKDIR}/${_pkg_name}.dump'.";
+ rtl_log_msg info "Enter an interactive package build shell w/ the command line: ./pkgtool.sh -a ${ARCH} -b ${BUILD} ${_pkg_name} PREFIX=\"${PREFIX}\"";
fi;
exit 1;
fi;
diff --git a/pkgtool.sh b/pkgtool.sh
index ec17cc0e..2241f4af 100755
--- a/pkgtool.sh
+++ b/pkgtool.sh
@@ -56,15 +56,36 @@ pkgtoolp_update_diff() {
fi;
};
+pkgtoolp_env() {
+ local _rc=0; _status="";
+ if [ ! -e "${BUILD_WORKDIR}/${PKG_NAME}.dump" ]; then
+ rtl_log_msg fail "Warning: failed to locate environment dump for package \`${PKG_NAME}' in \`${BUILD_WORKDIR}'.";
+ rtl_log_msg info "Rebuilding package \`${PKG_NAME}' w/ --dump-in build...";
+ (export ARCH BUILD \
+ BUILD_DLCACHEDIR BUILD_WORKDIR \
+ PREFIX PREFIX_CROSS PREFIX_MINGW32 PREFIX_MINIPIX \
+ PREFIX_NATIVE PREFIX_ROOT PREFIX_RPM;
+ ./build.sh -a "${ARCH}" -b "${BUILD}" --dump-in build -P -r "${PKG_NAME}" -v);
+ if [ ! -e "${BUILD_WORKDIR}/${PKG_NAME}.dump" ]; then
+ _rc=1; _status="Error: failed to locate environment dump for package \`${PKG_NAME}' in \`${BUILD_WORKDIR}'.";
+ fi;
+ else
+ _rc=0;
+ fi;
+ if [ "${_rc:-0}" -eq 0 ]\
+ && ! . "${BUILD_WORKDIR}/${PKG_NAME}.dump"; then
+ _rc=1; _status="Error: failed to source environment dump for package \`${PKG_NAME}' from \`${BUILD_WORKDIR}'.";
+ fi; return "${_rc}";
+};
+
pkgtool() {
+ local _status="";
if ! cd "$(dirname "${0}")"\
|| ! . ./subr/pkgtool_init.subr\
|| ! pkgtool_init "${@}"; then
printf "Error: failed to setup environment.\n"; exit 1;
- elif [ ! -e "${BUILD_WORKDIR}/${PKG_NAME}.dump" ]; then
- rtl_log_msg failexit "Error: failed to locate environment dump for package \`${PKG_NAME}' in \`${BUILD_WORKDIR}'.";
- elif ! . "${BUILD_WORKDIR}/${PKG_NAME}.dump"; then
- rtl_log_msg failexit "Error: failed to source environment dump for package \`${PKG_NAME}' from \`${BUILD_WORKDIR}'.";
+ elif ! pkgtoolp_env; then
+ rtl_log_msg failexit "${_status}";
elif ! rtl_fileop cd "${PKG_BUILD_DIR}"; then
rtl_log_msg failexit "Error: failed to change working directory to \`${PKG_BUILD_DIR}'.";
elif [ -n "${ARG_RESTART_AT}" ]; then
diff --git a/subr/build_init.subr b/subr/build_init.subr
index e3bf7b3c..e07facaf 100644
--- a/subr/build_init.subr
+++ b/subr/build_init.subr
@@ -49,9 +49,9 @@ buildp_init_defaults() {
# Command-line arguments
: ${ARCH:="nt64"}; : ${BUILD:="debug"};
- ARG_AS_NEEDED=0; ARG_CLEAN_BUILDS=""; ARG_DEBUG_MINIPIX=0; ARG_DUMP_ON_ABORT=0;
- ARG_DIST=""; ARG_FETCH_FORCE=0; ARG_PARALLEL=1; ARG_RELAXED=0; ARG_RESTART="";
- ARG_VERBOSE=0;
+ ARG_AS_NEEDED=0; ARG_CLEAN_BUILDS=""; ARG_DEBUG_MINIPIX=0; ARG_DUMP_IN="";
+ ARG_DUMP_ON_ABORT=0; ARG_DIST=""; ARG_FETCH_FORCE=0; ARG_PARALLEL=1; ARG_RELAXED=0;
+ ARG_RESTART=""; ARG_VERBOSE=0;
# Build parameters & state
BUILD_HNAME=""; BUILD_IS_PARENT=1; BUILD_GROUPS=""; BUILD_GROUPS_INHIBIT_DEPS=0;
@@ -126,6 +126,11 @@ buildp_init_getopts() {
while [ "${#}" -gt 0 ]; do
case "${1}" in
--as-needed) ARG_AS_NEEDED=1; _shiftfl=1; ;;
+ --dump-in) if [ "${#}" -ge 2 ]; then
+ ARG_DUMP_IN="${2}"; ARG_DUMP_ON_ABORT=1; _shiftfl=2;
+ else
+ _rc=1; _status="Error: missing argument to option --dump-in.";
+ fi; ;;
--dump-on-abort)
ARG_DUMP_ON_ABORT=1; _shiftfl=1; ;;
--debug-minipx) ARG_DEBUG_MINIPIX=1; _shiftfl=1; ;;
@@ -134,7 +139,9 @@ buildp_init_getopts() {
done; _shiftfl=1; ;;
*) _shiftfl=0; ;;
esac;
- if [ "${_shiftfl}" -gt 0 ]; then
+ if [ "${_rc}" -ne 0 ]; then
+ break;
+ elif [ "${_shiftfl}" -gt 0 ]; then
shift "${_shiftfl}"; continue;
elif getopts a:b:C:D:Fhp:Pr:R _opt; then
case "${_opt}" in
diff --git a/subr/ex_pkg_exec.subr b/subr/ex_pkg_exec.subr
index f21bc3d8..fb0cfa02 100644
--- a/subr/ex_pkg_exec.subr
+++ b/subr/ex_pkg_exec.subr
@@ -101,7 +101,12 @@ ex_pkg_exec() {
else set -- ${PKG_BUILD_STEPS};
while [ ${#} -gt 0 ]; do
_step="${1}"; _step_next="${2}"; shift;
- if [ "${PKG_FORCE:-0}" -eq 0 ]\
+ if [ "${ARG_DUMP_IN}" = "${_step}" ]; 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";
+ exit 1;
+ elif [ "${PKG_FORCE:-0}" -eq 0 ]\
&& ex_pkg_state_test "${_pkg_name}" "${_step}" "${_restart_at}" ; then
continue;
elif ! exp_pkg_exec_step "${_group_name}" "${_pkg_name}" "${_restart_at}" "${_step}"; then