From 3bd696ab678dacb392adee796b3992c54781a32b Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Thu, 7 May 2020 01:04:01 -0400 Subject: Improvements: * Add spm_debug_shell(): to be called from within a build script * Incorporate realpath instead of relying on python --- scripts/spmbuild | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/spmbuild b/scripts/spmbuild index 46bfe7c..8222849 100755 --- a/scripts/spmbuild +++ b/scripts/spmbuild @@ -1,5 +1,6 @@ #!/usr/bin/env bash trap spm_build_cleanup EXIT +THIS_SCRIPT=$(dirname ${BASH_SOURCE[0]}) function pushd() { command pushd "$@" >/dev/null @@ -48,8 +49,32 @@ function tar() { $cmd "$@" } +function spm_debug_shell() { + local where + + where="${1}" + if [[ -z "${where}" ]] || [[ ! -d "${where}" ]]; then + where="$(pwd)" + fi + + pushd "${where}" || exit 1 + + PS1="(SPMBUILD DEBUG)$ " + export PS1 + + echo "ENTERING DEBUG SHELL" + env bash + + # Exiting here prevents the user from leaving debug calls in their build scripts + # (i.e. when this function is used, no package archives will be generated) + exit 1 +} + function spm_build_initialize_stage1() { - export SPMDEV=$(python -c "import os; print(os.path.abspath('$(dirname ${BASH_SOURCE[0]})/../cmake-build-debug/src/spm'))") + rp=$(which realpath 2>/dev/null \ + || which spm_realpath 2>/dev/null \ + || echo ./spm_realpath) + export SPMDEV=$($rp "${THIS_SCRIPT}/../src/spm") export SPM=$(which spm 2>/dev/null || echo ${SPMDEV}) spm_build_check_rt_env -- cgit