ci: Add a pre-build checkup stage to ci_verify_configure.sh
Also update comments and tracing printouts in ci/ci_*.sh
diff --git a/ci/ci_verify_cmake.sh b/ci/ci_verify_cmake.sh
index 1d3e973..908b90a 100755
--- a/ci/ci_verify_cmake.sh
+++ b/ci/ci_verify_cmake.sh
@@ -82,13 +82,12 @@
}
function ci_cleanup_old_build {
- if [[ -e $CI_BUILD_DIR || -e $CI_INSTALL_DIR ]]
- then
- ci_info "## START OF PRE-BUILD CLEANUP ##"
+ ci_info "## START OF PRE-BUILD CLEANUP ##"
+ [[ ! -e $CI_BUILD_DIR && ! -e $CI_INSTALL_DIR ]] || {
ci_spawn rm -fr "$CI_BUILD_DIR"
ci_spawn rm -fr "$CI_INSTALL_DIR"
- ci_info "## END OF PRE-BUILD CLEANUP ##"
- fi
+ }
+ ci_info "## END OF PRE-BUILD CLEANUP ##"
}
function ci_build {
@@ -127,7 +126,7 @@
ci_spawn export CMAKE_GENERATOR="$CI_CMAKE_GENERATOR"
[[ $CI_CMAKE_GENERATOR_PLATFORM ]] &&
ci_spawn export CMAKE_GENERATOR_PLATFORM="$CI_CMAKE_GENERATOR_PLATFORM"
- # Build!
+ # And... build!
# Use $CI_BUILD_TO_SRC_RELDIR and $CI_BUILD_TO_INSTALL_RELDIR
# instead of $CI_SRC_DIR and $CI_INSTALL_DIR from this point onwards.
ci_spawn mkdir -p "$CI_BUILD_DIR"
@@ -181,6 +180,7 @@
ci_err "unknown option: '$1'"
done
shift $((OPTIND - 1))
+ # And... go!
ci_init_build
ci_trace_build
[[ $# -eq 0 ]] || {
diff --git a/ci/ci_verify_configure.sh b/ci/ci_verify_configure.sh
index 9be76d9..4542070 100755
--- a/ci/ci_verify_configure.sh
+++ b/ci/ci_verify_configure.sh
@@ -73,13 +73,19 @@
}
function ci_cleanup_old_build {
- if [[ -e $CI_BUILD_DIR || -e $CI_INSTALL_DIR ]]
- then
- ci_info "## START OF PRE-BUILD CLEANUP ##"
+ ci_info "## START OF PRE-BUILD CHECKUP ##"
+ ci_spawn test '!' -f "$CI_SRC_DIR/config.status" || {
+ # Warn the user, but do not delete their files.
+ ci_warn "unexpected build configuration file: '$CI_SRC_DIR/config.status'"
+ ci_warn "the configure script might fail"
+ }
+ ci_info "## END OF PRE-BUILD CHECKUP ##"
+ ci_info "## START OF PRE-BUILD CLEANUP ##"
+ [[ ! -e $CI_BUILD_DIR && ! -e $CI_INSTALL_DIR ]] || {
ci_spawn rm -fr "$CI_BUILD_DIR"
ci_spawn rm -fr "$CI_INSTALL_DIR"
- ci_info "## END OF PRE-BUILD CLEANUP ##"
- fi
+ }
+ ci_info "## END OF PRE-BUILD CLEANUP ##"
}
function ci_build {
@@ -97,7 +103,7 @@
ci_spawn export CFLAGS="-fsanitize=$CI_SANITIZERS ${CFLAGS:-"-O2"}"
ci_spawn export LDFLAGS="-fsanitize=$CI_SANITIZERS $LDFLAGS"
}
- # Build!
+ # And... build!
ci_spawn mkdir -p "$CI_BUILD_DIR"
ci_spawn cd "$CI_BUILD_DIR"
# Spawn "configure".
diff --git a/ci/ci_verify_makefiles.sh b/ci/ci_verify_makefiles.sh
index beda3b4..511a72b 100755
--- a/ci/ci_verify_makefiles.sh
+++ b/ci/ci_verify_makefiles.sh
@@ -108,7 +108,7 @@
[[ $ALL_LD_FLAGS ]] && ALL_MAKE_VARS+=(LDFLAGS="$ALL_LD_FLAGS")
[[ $CI_LIBS ]] && ALL_MAKE_VARS+=(LIBS="$CI_LIBS")
ALL_MAKE_VARS+=($CI_MAKE_VARS)
- # Build!
+ # And... build!
local MY_MAKEFILE
for MY_MAKEFILE in $CI_MAKEFILES
do