diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2020-05-07 01:04:01 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2020-05-07 01:04:01 -0400 |
commit | 3bd696ab678dacb392adee796b3992c54781a32b (patch) | |
tree | 7cd7eb43088d02f04c087400854a7c671cbe1de7 /scripts | |
parent | e2470a89c3cd542b9c2a1e63ed0d78e0f39bed68 (diff) | |
download | spmc-3bd696ab678dacb392adee796b3992c54781a32b.tar.gz |
Improvements:
* Add spm_debug_shell(): to be called from within a build script
* Incorporate realpath instead of relying on python
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/spmbuild | 27 |
1 files changed, 26 insertions, 1 deletions
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 |